Grokking the Coding Interview: Patterns for Coding Questions
Ask Author
Back to course home

0% completed

Vote For New Content
The Similar Questions solution is missing the part where it returns a new array ...

Brian Dy

Sep 26, 2022

The Similar Questions solution is missing the part where it returns a new array or subarray without the duplicates. If the current solution is acceptable, then Two Pointers is unnecessary and we could have just incremented the counter for any element != key.

1

0

Comments
Comments
Design Gurus
Design Gurus3 years ago

Both the questions change the input array and move all the required elements to the beginning of the array and return the length of the array containing only the required element.

On this page

Problem Statement

Try it yourself