-
Notifications
You must be signed in to change notification settings - Fork 85
Answer for Array duplicates doesn't pass test #41
Comments
+1, except I would assume them to be float number as well. So my suggestion would be dupes.push(Number(item)); |
I made a pull-req on #43. |
The same problem I meet and |
None of these solutions is optimal as it assumes the array entries are numbers. What is needed is a data structure that preserves the type of the key when tracking for duplicates. An object won't do this as the keys will be converted to strings. |
I'm curious. Can I look at your solution sir? I'd like to learn more of this. |
@technowar I just tried it out, and it works flawlessly
|
Are we supposed to purposely avoid ES6 methods? Cause this works much better than the proposed solution:
And the performance is much better too: https://jsperf.com/check-for-duplicates-in-array |
The current answer for the duplicates question is this:
The test rejects it saying:
I changed the following line in my code to make it pass:
It seems like either the test should expect strings or the answer should be updated.
The text was updated successfully, but these errors were encountered: