In the solution, we loop through the list once inside mergeKCountries
function. This makes time complexity O(k), where k is the number of lists.
Next, we go through each list in merge2Countries
which is O(n), where n is the maximum length of the list.
This makes time complexity => O(n*k).
Is this the right logic?
Thanks in advance.
Type your question above this line.
Course: https://www.educative.io/collection/10370001/5808777738059776
Lesson: https://www.educative.io/collection/page/10370001/5808777738059776/5391999346147328