finished 2.1,;used hashtable; O(n) time complexity