Isn’t it still O(n) space ?
Kamil Konieczny
1

The array already exists in memory since it’s bwing passed in at runtime, and were not making it any bigger. As far as I can tell, we’d be working with O(1) memory.