JOIN
Get Time
forums  Revision History
Search My Post History  |  My Watches  |  User Settings
Forums Round Tables General Career Discussions Re: Foiled by a Div2-250! Revision History (1 edit)
Re: Foiled by a Div2-250! (response to post by dimkadimon)
just FYI:

I ran some speed tests on that algorithm.
2.8 seconds using String and String.indexOf(string);
1.7 seconds using String and String.indexOf(char);
.8 seconds using StringBuffer and String.indexOf(char);

although if you really were worried about effeciency you would use the original solution posted before this one. This one looks through the string for every letter of the alphabet. Better to look through the whole string and grab each letter as you pass it.
Re: Foiled by a Div2-250! (response to post by dimkadimon)
just FYI:

I ran some speed tests on that algorithm.
2.8 seconds using String and String.indexOf(string);
1.7 seconds using String and String.indexOf(char);
.8 seconds using StringBuffer and String.indexOf(char);