Re: 195 - Anagram
Posted: Fri Feb 05, 2016 10:33 pm
Hi everyone,
I wrote my solution in Java and here's what I did:
1) I worked with StringBuilders. I know that might be not the best option, but I'm a self-taught non-competitive guy who just learns how to code using UVa Judge.
2) The first thing I do is I sort my input string converted to StringBuilder. However, there's an implementation trick which I will talk about in 3)
3) The trick of this program is comparison, since "aaAabBbzZz" should be sorted into '"AaaaBbbZzz". To achieve that I wrote my own function to compare two chars which I call 'less' (following the name given by R. Sedgewick).
4) After that I just implemented the Narayana algorithm, which also uses my less(...) function.
My Java solution is 0.139.
If anyone needs the code, please write at akuptsov.hseATgmail.com
Sorry, I don't have a git yet, I'm a noob and perhaps I don't have super-cool code to brag about, haha )
I wrote my solution in Java and here's what I did:
1) I worked with StringBuilders. I know that might be not the best option, but I'm a self-taught non-competitive guy who just learns how to code using UVa Judge.
2) The first thing I do is I sort my input string converted to StringBuilder. However, there's an implementation trick which I will talk about in 3)
3) The trick of this program is comparison, since "aaAabBbzZz" should be sorted into '"AaaaBbbZzz". To achieve that I wrote my own function to compare two chars which I call 'less' (following the name given by R. Sedgewick).
4) After that I just implemented the Narayana algorithm, which also uses my less(...) function.
My Java solution is 0.139.
If anyone needs the code, please write at akuptsov.hseATgmail.com
Sorry, I don't have a git yet, I'm a noob and perhaps I don't have super-cool code to brag about, haha )