+ 3

Merge two arrays by following given sequences.

Given two arrays of integers x and y of sizes m and n respectively. Write a program with a function named merge() which will produce a third array named z, such that the following sequences is followed: 1. All odd no of x from left to right are copied into z from left to right. 2. All even no of x from left to right are copied into z from right to left. 3. All odd no of y from left to right are copied into z from left to right. 4. All even no of y from left to right are copied into z from right to left.

28th Jul 2017, 2:27 PM
Kartikey Sahu
Kartikey Sahu - avatar
9 Réponses
28th Jul 2017, 3:49 PM
Hatsy Rei
Hatsy Rei - avatar
28th Jul 2017, 5:23 PM
Garikai
Garikai - avatar
+ 2
https://code.sololearn.com/chUIGkd9OgLx/?ref=app
28th Jul 2017, 11:23 PM
Emrullah şahin
Emrullah şahin - avatar
+ 2
Here's the cpp program as you want and takes input of two arrays x and y from the user. https://code.sololearn.com/cDp4HR6pLan4/?ref=app Firstly you have to enter no. of terms in x and y and then their values respectively.
29th Jul 2017, 3:09 AM
Lakshay
Lakshay - avatar
+ 1
e.g., x is { 3, 2, 1, 7, 6, 3 } and y is { 9, 3, 5, 6, 2, 8, 10 } then z = { 3, 1, 7, 3, 9, 3, 5, 10, 8, 2, 6, 6, 2 }
28th Jul 2017, 2:29 PM
Kartikey Sahu
Kartikey Sahu - avatar
+ 1
hey, challenge accepted, here on JavaScript: https://code.sololearn.com/WZKmo7mHodUK/?ref=app noticed by comment on: https://code.sololearn.com/WoUjEYWDOir8/?ref=app
28th Jul 2017, 6:14 PM
ysraelcon
ysraelcon - avatar
21st Aug 2017, 12:16 PM
Amit Dubey
Amit Dubey - avatar
30th Jul 2017, 3:05 AM
Vari93
Vari93 - avatar