Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

create and return a merged list of all the elements in sorted order

result = []
while list1 and list2:
    result.append((list1 if list1[-1] > list2[-1] else list2).pop(-1))

if len(list1):
    result += list1[-1::-1]
if len(list2):
    result += list2[-1::-1]

return result[-1::-1]
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #create #return #merged #list #elements #sorted #order
ADD COMMENT
Topic
Name
3+5 =