if extra space is required to increase with your input, then space complexity is O(n).
If extra space (extra variable) is fixed and does not increase with your input than space complexity is O(1) (constant space complexity)
Space Complexity
最新推荐文章于 2021-07-25 19:04:03 发布