Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def merge(A,B):
- C = []
- i = 0
- j = 0
- while(1):
- if(i == len(A) and j == len(B)):
- break
- if(i < len(A) and j < len(B)):
- if(A[i]<B[j]):
- C.append(A[i])
- i += 1
- else:
- C.append(B[j])
- j+=1
- elif(i < len(A)):
- C.append(A[i])
- i += 1
- else:
- C.append(B[j])
- j += 1
- return C
- print(*merge(list(map(int,input().split())),list(map(int,input().split()))))
Add Comment
Please, Sign In to add comment