built into JS = standard LIBRARY. You get what I mean.
The post states that this is specifically a JS interview question, not an algorithm or computer science test.
Yes, this post lacks a lot of details about the problem. It is actually a general problem, he is just using JS to solve it.
Before the author edited the post, he mentioned that the space complexity should be O(1) (this is what is required in many places where this problem is described) which your solution does not meet.
This is an interview situation where you should try to highlight everything you know, including being able to identify more efficient solutions.
So, what's the overall performance of your solution? What's the time and space complexity?
The original problem requires you to use constant space and linear time, so that means you should work with the array in place and not allocate an extra array.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
built into JS = standard LIBRARY. You get what I mean.
Yes, this post lacks a lot of details about the problem. It is actually a general problem, he is just using JS to solve it.
Before the author edited the post, he mentioned that the space complexity should be O(1) (this is what is required in many places where this problem is described) which your solution does not meet.
You can see more details about the problem here:
interviewbit.com/problems/remove-d...
leetcode.com/problems/remove-dupli...
So, what's the overall performance of your solution? What's the time and space complexity?
The original problem requires you to use constant space and linear time, so that means you should work with the array in place and not allocate an extra array.