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
Very readable and logical. Oh, this language design...
I think in question it is specifically mentioned that hashcode & equals contract has been already taken care of So no need to worry about that key collision. But still yes to be on more safer side we can use this Identity hashmap.
If we make a concatenation of string is better to declare a "std::stringstream" instead of "std::string"?!?
Why?
Thank you for sharing the tip with the IdentityHashMap. I did not know about IdentityHashMap. That's why I used a LinkedList and the '==' operator. I didn't realized that I also could put the object identity to a map :-D
Why is that ?
I did not know about IdentityHashMap, thanks for sharing! That would definitely work here.
When I used a HashMap, I used Node.toString() as the key. Now I understand that I was making an assumption that the toString() and hashCode() methods where no overridden in a way that would break my HashMap.
added a brief warning at the bottom of the description. thanks for the feedback!
Well, that's to be expected, no?
This comment is hidden because it contains spoiler information about the solution
Now really fixed, thank you! :)
Not fixed as far as I can tell.
I did.
25 million, not 40, sorry.
I am a newbie to Java but interestingly this solution runs faster than the StringBuilder. I tried to run them both to see which one runs faster. But I guess its because the string isn't long enough? I am from the Javascript land so I was excited to see this approach since this looks close to JS.
Thank you.
Loading more items...