Algorithm · Snapchat · Medium
You are given N lists, each already ordered from smallest to largest (allowing equal values). Combine all of them into a single list that remains sorted. Example lists = [[0,3,8],[1,3,7],[2,9]] Output: [0,1,2,3,3,7,8,9] Assumed constraints 1 <= N <= 1e5 Let M = sum(len(li)); 0 <= M <= 2e5 Aim for a running time near O(M log N). Example
Checking your access…