O(1) space Hard