Grokking Data Structures & Algorithms for Coding Interviews
Ask Author
Back to course home

0% completed

Vote For New Content
incorrect space complexity

zaid

Jan 31, 2024

the sorting could be space o(n) or o(1) but we don't count the input as space since its gives and we are not allocating new space for a new array.

2

0

Comments
Comments
Miguel
Miguel a year ago

Agreed. Including the input in the space complexity would also be inconsistent with almost all of the previous examples in these materials.

S
sw94070 7 months ago

Maybe a text mistake? The space is required for sorting. Arrays.sort() requires O(n) space for int[][].

On this page