Added O(n) solution using dict