Correct space complexity