educative.io

Educative

Inplace solution does not require returning value

inplace solution [space complexity O(1)] does not require returning value.
eg. [1,3,4,5],[2,6,7,8] becomes [1, 2, 3, 4,],[5, 6, 7, 8]

Hi @ankit6,

We merge the results from the two lists and save it in the lst1 passed as an argument to the function. Finally, we return the lst1 which has the sorted list obtained by merging the lst2.

Happy learning!

Anum Hassan | Developer Advocate
educative.io