time:O(log(m+n)),space:O(1)
time:O(n),space:O(n)
time:O(m+n),space:O(1)
time:O(mn),space:O(n)