We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
@mcgonigb
Thank you so much for your example! I was looking for a solution in Java and not only found it, but also the idea of sorting before adding to the map and this line: "totalCount=totalCount+value;" are totally great!!!
I made a version without sorting and adding the totalCount as simple as you did and it passed all casses except 2, because of time limit.
Anyway your solution is ellegant, simple and quick.
Thanks!
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Sherlock and Anagrams
You are viewing a single comment's thread. Return to all comments →
@mcgonigb Thank you so much for your example! I was looking for a solution in Java and not only found it, but also the idea of sorting before adding to the map and this line: "totalCount=totalCount+value;" are totally great!!! I made a version without sorting and adding the totalCount as simple as you did and it passed all casses except 2, because of time limit.
Anyway your solution is ellegant, simple and quick.
Thanks!