Ad
  • Custom User Avatar

    This is just an old answer, so its had a long time to slowly accumulate votes. There's no generic upvote, you either vote for best practice or clever, and this is definitely NOT clever.

    It's also rust, which very few people truly understand (certainly including me) so many people don't know what they're looking at.

    That being said, I haven't ever used C and C++ only like 15 years ago, so this is more just general procedural language not really C/C++. But yeah, there are definitely more concise ways of doing this in rust, considering it's awesome methods on iterables.

  • Custom User Avatar

    Good call, thanks!

  • Custom User Avatar

    Good kata, fairly straightforward, though. Only thing that tripped me up was parsing the msg format.

  • Custom User Avatar

    While nice and code-golfy, I would not call this a best practice. Violates style left and right, in the name of fewer lines. I also doubt the user was going for "best practices" when he wrote it; this is just an advisement to people learning Python while reading this and seeing 20 best practices votes.

  • Custom User Avatar

    Thanks. Great kata, though. I smiled and was super excited when I saw it. Sad that it didn't work out.

  • Custom User Avatar

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

  • Custom User Avatar

    You should really stop just closing all these issues because you think there's nothing wrong with your Kata, especially when they just keep opening up: Your description is very unclear. "The entire pair" to me means the sum of the indexes, but that's not true -- the earlier summand doesn't matter at all, only the later one. So maybe your description should be changed so it clearly states that the chosen choice is the pair with the second index being the lowest. Or, give one "x" and the other "y", or "i" and "j" and say:
    Where "i" is the first summand in the matching pair, and "j" is the second summand, the "first" pair is the pair where "j" is the lowest, or occurs first in the list.

  • Custom User Avatar

    Yes, this and the general, horrible instability are the two biggest weaknesses of this site. Doing simple string multiplication is 1-3 lines in many languages, but in some (like Solidity), it's rather involved due to weak standard libraries. Rust is similar -- it has very little in its standard lib.

  • Custom User Avatar

    The problem is that the game can be won while there are still empty spaces. If the game isn't won, and there are empty spaces, then return -1. Otherwise, return the winner.

  • Custom User Avatar

    You can have two requires in a single function; but you shouldn't require it at all. Description does not say to raise an exception. Simply do nothing.

  • Custom User Avatar

    Don't require/assert anything. The description isn't overly clear (I opened an issue) and the error is horribly unclear, but you should simply do nothing when there are insufficient funds. Your require() is causing the problem.

  • Custom User Avatar

    The description does not say to assert/require or raise an exception when the funds are not present; simply do nothing.

  • Custom User Avatar

    The explanation regarding expected behavior when insufficient funds exist is not clear -- when doing what I assumed was correct and require()ing that the funds exist, it was erroring. This should be cleared up in the description.

  • Custom User Avatar

    It's just memoization. Given feedback, blacklist unsuccessful responses, don't give unsuccessful responses more than once. If I returned action 1 when the command was 2, and the response was bad, don't return 1 when its 2 ever again.

  • Custom User Avatar

    For the Go translation (and probably others) PLEASE add to the description what the "constant" function is that returns the actions. It's not called ACTIONS like it is in Java, but Actions. Most people (all but two, one of them me) end up implementing their own copy from the test sample because they can't figure it out. Even better, provide the implementation so it's clearer! Inferring what you decided to name your function, and if it was implemented the same way as in Java, should not be the bulk of the difficulty of this Kata.

    Also, this is way too easy for a 4 kyu, without the "infer the actions" part, and the "what the hell is this description actually saying" part.

  • Loading more items...