Max sum space complexity fixed