Skip to content

Commit 42d6d17

Browse files
authored
Update 0448-find-all-numbers-disappeared-in-an-array.cpp
The time complexity should be O(n), since the worst case scenario the size of ans will be n - 1. It's not O(1)
1 parent de6010f commit 42d6d17

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

cpp/0448-find-all-numbers-disappeared-in-an-array.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class Solution {
88
At the end, which ever places are positive, add them to our answer.
99
1010
Time complexity: O(n)
11-
Space complexity: O(1)
11+
Space complexity: O(n)
1212
*/
1313
vector<int> findDisappearedNumbers(vector<int>& nums) {
1414
vector<int> ans;
@@ -23,4 +23,4 @@ class Solution {
2323

2424
return ans;
2525
}
26-
};
26+
};

0 commit comments

Comments
 (0)