This question needs clarification. I just used sorted(lst1 + lst2) instead of the multiple lines in the solution. I did not realise you can’t use sorted function
Same. I wrote the same solution as you. I just used the most ‘pythonic’ library functions, as I would in a real life code problem.
Hi Daugavpils,
According to the problem, we should prefer solving the problem by not using any built-in functions.
For our practice, we should prefer writing our own code.
Usually, to prepare for coding interviews, we should prepare ourselves for each situation.
However, I used the following code, which works fine for me, and passed all test cases.
def merge_lists(lst1, lst2):
return sorted(lst1 + lst2)
I hope this answered your question.
Thank you!
I wrote the same. I guess it makes sense to not use the in-built functions just for the sake of learning how things really happen at the back end.
I’d like to add my vote for better clarification. I too solved it with the built-in function since nowhere in the challenge description does it say to exclude built-in functions in our solution.