DEV Community

Discussion on: A coding interview question asked at Google

 
firee80 profile image
Firee80 • Edited

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