Ad
  • Default User Avatar

    the pattern that you only needed to do two sides, this is the most impressive solution I've seen

  • Default User Avatar

    this dude charges by the line...

  • Custom User Avatar

    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.

  • Default User Avatar

    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?

  • Custom User Avatar

    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!

  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Default User Avatar

    many thanks trevdoz, indeed I needed to use a sledge hammer rather than a scalpel to define the words

  • Default User Avatar

    nice, makes sense. coding for undescribed requirements, sexy :)

  • Custom User Avatar

    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.

  • Default User Avatar

    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.

  • Default User Avatar

    In JS at least, the test cases completely ignore "the wheel"; the straight from ace to 5.

    These tests should pass:

        it("wheel beats high card king kicker", function() { assert(Result.win, "AS 2H 3D 4S 5S", "KH AD 4C 5H 9D");});
        it("wheel beats pair", function() { assert(Result.win, "AS 2H 3D 4S 5S", "2H 2D 8C 4D 5H");});
        it("wheel beats two pair", function() { assert(Result.win, "AS 2H 3D 4S 5S", "2H 2D 9C 9D 5H");});
        it("wheel beats trips", function() { assert(Result.win, "AS 2H 3D 4S 5S", "2H 2D 2C 4D 5H");});
    

    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 :)

  • Default User Avatar

    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.

  • Default User Avatar

    cross character, nice. you might like to use the french accented 'í' instead of an i... anyone maintaining the code will go insane ;)

  • Default User Avatar

    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 :)