Skip to content

Commit 46f7fc1

Browse files
committed
add space complexity clarification
1 parent 5b522d9 commit 46f7fc1

3 files changed

Lines changed: 8 additions & 0 deletions

File tree

articles/next-greater-element-i.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,8 @@ impl Solution {
229229
- Time complexity: $O(m * n)$
230230
- Space complexity: $O(1)$
231231

232+
> The output array is not counted towards space complexity, as the [standard convention](https://en.wikipedia.org/wiki/DSPACE) measures only auxiliary working space.
233+
232234
> Where $m$ is the size of the array $nums1$ and $n$ is the size of the array $nums2$.
233235

234236
---

articles/replace-elements-with-greatest-element-on-right-side.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,8 @@ impl Solution {
184184
- Time complexity: $O(n ^ 2)$
185185
- Space complexity: $O(1)$
186186

187+
> The output array is not counted towards space complexity, as the [standard convention](https://en.wikipedia.org/wiki/DSPACE) measures only auxiliary working space.
188+
187189
---
188190

189191
## 2. Suffix Max
@@ -347,6 +349,8 @@ impl Solution {
347349
- Time complexity: $O(n)$
348350
- Space complexity: $O(1)$
349351

352+
> The output array is not counted towards space complexity, as the [standard convention](https://en.wikipedia.org/wiki/DSPACE) measures only auxiliary working space.
353+
350354
---
351355

352356
## Common Pitfalls

articles/successful-pairs-of-spells-and-potions.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,8 @@ impl Solution {
213213
- Time complexity: $O(n * m)$
214214
- Space complexity: $O(1)$
215215

216+
> The output array is not counted towards space complexity, as the [standard convention](https://en.wikipedia.org/wiki/DSPACE) measures only auxiliary working space.
217+
216218
> Where $n$ and $m$ are the sizes of the arrays $spells$ and $potions$ respectively.
217219
218220
---

0 commit comments

Comments
 (0)