0% completed
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
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.
On this page
Problem Statement
Solution
Step-by-Step Algorithm
Algorithm Walkthrough
Code
Complexity Analysis
Time Complexity
Space Complexity
Similar Questions
Solution:
Complexity Analysis
Time Complexity
Space Complexity