Click here to see the full article post
I have a question about the runtime of Approach#2: will the line of sorting "Collections.sort(list, (a, b) -> a == b ? a - b : a - b);" be the dominant part of run time?
Since in the worst case the list size is O(s∗l), I guess sorting can take O(sllog(s*l)) ?
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.