time:O(n),space:O(m)(m < n)