Time complexity: O(n k log(k))
Space complexity: O(n k)
Runtime 0 ms Beats 100.00% Memory 42.56 MB Beats 26.55%