Skip to content

Instantly share code, notes, and snippets.

@Fredpwol
Last active May 13, 2021 14:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Fredpwol/09f5952b1a5330ea82ff90a875a56d00 to your computer and use it in GitHub Desktop.
Save Fredpwol/09f5952b1a5330ea82ff90a875a56d00 to your computer and use it in GitHub Desktop.
Merge Sorted List
def mergeSortedList(l1, l2):
if l1 == None and l2 == None:
return []
elif l1 != None and l2 == None:
return l1
elif l2 != None and l1 == None:
return l2
res = []
l1_count = 0
l2_count = 0
while l1_count < len(l1) and l2_count < len(l2):
if l1[l1_count] < l2[l2_count]:
res.append(l1[l1_count])
l1_count += 1
else:
res.append(l2[l2_count])
l2_count += 1
if l1_count < len(l1) :
res += l1[l1_count:]
if l2_count < len(l2):
res += l2[l2_count:]
return res
@meekg33k
Copy link

meekg33k commented May 13, 2021

Hello @Fredpwol, thank you for participating in Week 5 of #AlgorithmFridays.

Congratulations! 🎉🎉, your solution has been selected as one of the 12 winning solutions for Week 5 of #AlgorithmFridays.

Your solution was selected because it is clean, robust, had the best time-efficiency and passes all of the test cases. Kudos to you!

However since only 3 solutions can be awarded the $20 prize, there will be a 'raffle draw' tomorrow Friday May 14 at 9.00 am WAT (1.00 am PST) to select 3 out of the 12 solutions in a fair manner.

If you will to participate in the raffle draw, please send an email to uduak@meekg33k.dev or send me a DM on Twitter @meekg33k so I can share the meeting link with you.

Congratulations once again and thank you for participating. See you tomorrow for Week 6 of #AlgorithmFridays.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment