O(1) constact space edition updated