Shubham
BAN USER
Comments (4)
Reputation 20
Page:
1
Comment hidden because of low score. Click to expand.
Comment hidden because of low score. Click to expand.
Comment hidden because of low score. Click to expand.
1
of 1 vote
int main()
{
int n,m,N;
cin>>N>>m;
int A[N],B[m];
n=N-m; //given elements of first array
for(int i=0;i<n;i++) cin>>A[i];
for(int i=0;i<m;i++) cin>>B[i];
int k=N-1,i,j;
for(i=n-1,j=m-1;i>=0 && j>=0;){
if(A[i]>B[j]) A[k--]=A[i--];
else A[k--]=B[j--];
}
while(j>=0) A[k--]=B[j--];
for(int i=0;i<N;i++) cout<<A[i]<<" ";
return 0;
}
Comment hidden because of low score. Click to expand.
Page:
1
CareerCup is the world's biggest and best source for software engineering interview preparation. See all our resources.
kindly post it as a code rather than a plain text so that its readable. use triple brackets '{' like this
- Shubham August 12, 2013