Map<char,int> charCountMap = new HashMap();
for(String char : characters.length){
if(charCountMap.containsKey(char){
charCountMap.get(char)++;
}else{
charCountMap.put(char,1);
}
}
later read the map and print the count and key it might suffice.
On Tue, Aug 9, 2011 at 6:37 PM, ankit sambyal <[email protected]>wrote:
> @shady : I think there is a catch in that approach. Plz post ur code....
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
--
Thanks and regards,
Raghavan.K.L
<http://in.linkedin.com/in/raghavankl>
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.