Skip to content

Instantly share code, notes, and snippets.

@hodbby
Created January 29, 2012 13:56
Show Gist options
  • Save hodbby/1698934 to your computer and use it in GitHub Desktop.
Save hodbby/1698934 to your computer and use it in GitHub Desktop.
Google 10 rows solution
def linear_merge(list1, list2):
result = []
while len(list1) and len(list2):
if list1[0] < list2[0]:
result.append(list1.pop(0))
else:
result.append(list2.pop(0))
result.extend(list1)
result.extend(list2)
return result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment