optimize space complexity