We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Unfortunately, the "Collections.sort" method degrades the performance to O(N*log(N)). Besides, the "ArrayList" collection uses an additional O(N) amount of memory. An optimal solution should run in O(N*log(K)) time and use O(K) space.
Luck Balance
You are viewing a single comment's thread. Return to all comments →
Unfortunately, the "Collections.sort" method degrades the performance to O(N*log(N)). Besides, the "ArrayList" collection uses an additional O(N) amount of memory. An optimal solution should run in O(N*log(K)) time and use O(K) space.