problem 1 - O(1) solution