DEV Community

Discussion on: Find duplicates algorithm series- A SORTED array as an input.

Collapse
 
aliahsan07 profile image
Ali Ahsan

Referring to the example above, wouldn't this give us 4 twice in the duplicates table?

Collapse
 
s_awdesh profile image
Awdesh • Edited

you are right, I should check if item already exists inside the duplicate list. I have updated the code and attached repl.
Thanks for the feedback.