Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
I was asked this question in my own interview for my current job 5 years ago. I liked it so much I decided to make Katas from the memorable ones.
Where does it go thru the array twice?
After
.map
it's a join. Is that considered to be going thru the array?I am glad others are saying it was difficult too!! I totally underestimated it!
I don't know that this exact implementation is a popular problem (restricting the user to these particular indices), but it's a version of the two-sum problem which is a well-known problem. I wouldn't really consider what you did cheating, by the way ;)