Time complexity: O(n)
Space complexity: O(1)
Runtime 0 ms Beats 100.00% Memory 44.06 MB Beats 63.86%
Space complexity: O(n/k)