Back to course home
0% completed
Vote For New Content
I do not understand the return statement (in the JS solution). How can this retu...
Patrick Reid
Feb 6, 2023
I do not understand the return statement (in the JS solution). How can this return anything but the index of where the non duplicates end?
Wouldn't we need to return a slice or something to only get the non-duplicate array? And wouldn't that increase the space complexity anyway?
I have to say, so far I am wildly disappointed with my purchase of this course. It does not feel like the people who put this together understands JavaScript.
0
0
Comments
Comments
S
Salah Osman3 years ago
Not exactly, slicing isn't required -- they're keeping track of the number of unique values with the left pointer.
As left pointer gets shifted, it also tracks current number of unique values.