The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
December 2000

Advertisement

Advertisement

This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.

Message:

Just hint!!!

Posted by Kishori Sharan on December 04, 2000 at 3:12 PM

1) Create a hashtable which won't allow you to have duplicates.
2) Loop thru all characters in the string one at a time.
3) Within loop get the character, check if it is already there in hashtable as a key, then just increment the value by one for that key, else create a new entry in hashtable with key as that character and its value as one.
4) After loop is over get the maximum of all values in the hastable and the corresponding key in hashtable.





Replies:

Sponsored Links



Google
  Web Artima.com   
Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us