DEV Community

loading...

Discussion on: A coding interview question asked at Google

Collapse
dmadden51 profile image
David Madden

Doesn't Set remove duplicates?

Thread Thread
firee80 profile image
Firee80

yes.. that is why end result size should be 1
[1,1,1] => [1]
the code checks first that the initial array has more than 1 input so
[1] => [1]
would fail on the first length check