Back to course home
0% completed
Vote For New Content
Space complexity is O(1) not O(N)
Aravind Badiger
Oct 30, 2024
Whether we consider a returning result variable or replace elements in the original array the space complexity is O(1)
0
0
Comments
Comments
C
c a year ago
Assuming N is the number of elements in nums array, the result array takes space of N as well. Therefore the space complexity is O(N) as it grows the same way as N does
On this page
Problem Statement
Examples
Solution
Step-by-step Algorithm
Algorithm Walkthrough
Code
Complexity Analysis
Time Complexity
Space Complexity