Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
Corrected regex compared to my previous solution, which didn't handle 6 consecutive separators correctly (now, it does).
In fact, the regex should be "(\W|\w+)+?", I just realised this by myself (too late), otherwise 6 consecutive separators in the input will be shortened to the word "4", however this is an edge case, which the test cases don't cover.
For me, this is a huge wtf xD
This is not grandma's average Java code ...
Nice effort dude !
I found the usage of "modern" java features rather creative for this Kata, but I find the readability took a serious smash in the face. Good job anyway !
Thanks for the honest answser, it's really appreciated. "Horrifying" is a strong word after all, sorry about that ^^" I do understand these Kata's are only exercises :) However when you say "you know your parameters and they won't change"... I dearly hope that is the case for you if you're a professionnal programmer, because where I work, the client changes his mind every 5 minutes and thinking ahead has become a second nature for me, and I can never take his word for granted on any requirement what so ever -_-"
This solution doesn't handle this case properly : "an invalid sequence (a string with non numeric character).
Using input data "1 a" returns 0 instead of 1.
Not OOP design, but still trying to be both generic and understandable.
Add a 4th type of bill and you will have to rewrite the whole method, because the logic varies directly according to the bill value. I believe this is wrong design. Am I the only one this type of solution horrifies ?
Finally a solution which goes the generic way ! I love it ! The value-specific logic proposed in most solutions horrifies me to no end ...
Not with modern versions of the java compiler. They now tend to automatically replace string concatenation with a StringBuilder and multiple append(String) calls on it at compile-time.