Supposedly there is a O(1) running-time solution