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.
the pattern that you only needed to do two sides, this is the most impressive solution I've seen
this dude charges by the line...
it's not a bug and you are misinterpreting your stats. Highest trained means what language you have trained to the highest level, and not a level of the most difficultkata you have solved.
Curious about stats on my profile... it says the highest Kata I've trained is 4, but on my list of kata there's clearly a 1 sitting in the list. Bug?
Your solution shows a deep "problem" maybe related to your history with Java. I can tell, because one should almost NEVER use StringBuffers anymore. In Java and for sure not in Kotlin. For decades already, you should -in Java- prefer StringBuilders, as StringBuffers are "the old version" which are synchronized and much slower than StringBuilders. It is absolutely bad practice to use them for no good reason.
If I stumble upon such code, I ask myself: "Why is the use of a StringBuffer required? Are there multi-threading related problem?" Clearly, there are no threading things touched here.
Your code simply is a not-so-good Java solution translated 1:1 to Kotlin, which is not what you should do when learning a new language.
Try to embrace Kotlin's powerful features, its clear statement to favor all immutable structures and vals over vars.
Learn your toolset well. Good luck!
This comment is hidden because it contains spoiler information about the solution
many thanks trevdoz, indeed I needed to use a sledge hammer rather than a scalpel to define the words
nice, makes sense. coding for undescribed requirements, sexy :)
I was running into this issue initially(solving in Java). It could be using the frequency method in java to essentially assert that the 3 words in the returned array "appear" that many times in the input string. My hint to you is make sure that you are replacing all posiblle delimiters correctly. You can pass the inital sample tests because the input strings do not contain delimiters "sandwiched" between two words (eg. "word word word(some delimiter)word"). Remember a word is a defined as a string of characters (a-z) that can contain one or more apostrophes.
random tests on this are failing on me with Incorrect frequencies expected:<[29, 27, 18]> but was:<[27, 29, 14]>
...output is completely opaque as to what input was being tested and what it's even expecting. all the regular tests pass.
In JS at least, the test cases completely ignore "the wheel"; the straight from ace to 5.
These tests should pass:
Almost all solutions are not looking for it. Without this check, this straight loses to even a high card (ace and anything over a 5), a basic pair, everything. Example, A2345 should soundly beat A3456 (busted straight) and everything up to trips, without the check it loses to most things.
...even the solutions marked "best practice" don't do it, which is quite funny really. "Best practice" on this site, really doesn't mean what people thinks it means :)
the clever votes are fine, but people voting "best practice" on this site either aren't looking at the other solutions or not much of an idea about computing overhead...
this solution has n² compute time and memory; every position re-runs the array count, and the counting done by making new arrays and the call stack.
whereas managing counts in a dictionary is n.
I mean no ill to the author, it's nice to look at as a piece of code, a cool alternative, I'm fine with it being marked as clever, I really am.
cross character, nice. you might like to use the french accented 'í' instead of an i... anyone maintaining the code will go insane ;)
I think people get too worked up over the 'Best Practices' button... dude was clearly golfing, and golfing is amusing and he did well. if he wants to golf, let him golf :)