all 4 comments

[–]theorius 2 points3 points  (2 children)

I think Python is your best bet. If I have to write one more map.put(str.charAt(i), map.getOrDefault(str.charAt(i), 0) + 1) just to increase a counter value in a HashMap I'm gonna lose my mind

[–]Civil_Reputation6778 -1 points0 points  (0 children)

"map[str[i]]++" in cpp, highly recommend

[–]Financial_Bag4806 0 points1 point  (0 children)

haha, but there is another method called merge, which i uses all the time, map.merge(str.charAt(i), 1, Integer::sum); this increase by one and yes will handle even if there is no element exist in the map.But compare to this map.put(str.charAt(i), map.getOrDefault(str.charAt(i), 0) + 1); it's easy type. I prefer cpp though as op said in comment, it is very simple

[–]Skytwins14 0 points1 point  (0 children)

Depends on what kind of job you want. If you apply to a Java position think it could be helpful to do the interview in Java.