Time complexity: O(log(n))
Space complexity: O(1)
Runtime 25 ms Beats 68.26% Memory 40.64 MB Beats 7.20%