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.
Hi @prathameshbagek1,
Thanks bro. After seeing your code I removed an extra for loop. And I can suggest little opti in your code as well.
You can just remove the if else in the first for loop isn't it?
for (String string : strings) {
map.put(string, ++count);
}
I was just curious. Let me know if I am wrong. Thanks once again. :)
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Sparse Arrays
You are viewing a single comment's thread. Return to all comments →
Hi @prathameshbagek1, Thanks bro. After seeing your code I removed an extra for loop. And I can suggest little opti in your code as well.
You can just remove the if else in the first for loop isn't it? for (String string : strings) { map.put(string, ++count); } I was just curious. Let me know if I am wrong. Thanks once again. :)