• + 0 comments

    Unfortunately, the "Collections.sort" method degrades the performance to O(n*log(n)). Besides, the "List" 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.