The notes say:
(1) You are not allowed to modify the array ( The array is read only ).
(2) Try to do it using constant extra space.
The “best” solution to this problem does require modifying or copying the array.
Which means if we follow note (1) we can’t follow note (2) because we need to copy the array, which means o(n) space complexity.