Time complexity: O(n)
Space complexity: O(n)
Runtime 2 ms
Beats 94.00% of users with Java
Memory 43.03 MB
Beats 24.50% of users with Java
Time complexity: O(n*log(n))
Space complexity: O(1)
Runtime 3 ms
Beats 36.48% of users with Java
Memory 42.76 MB
Beats 49.32% of users with Java