Time complexity: O(m*log(n))
Space complexity: O(1)
Runtime 0 ms Beats 100.00% Memory 88.09 MB Beats 83.25%