Time complexity: O(log(n))
Space complexity: O(1)
Runtime 1 ms Beats 86.25% Memory 41.06 MB Beats 14.00%