Ad
  • Custom User Avatar

    Even the random ones somehow have never hit this case for me.

  • Custom User Avatar

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

  • Custom User Avatar
  • Custom User Avatar

    I can explain. Unfortunately, quality checking on Codewars is poor, people can rate katas and raise issues, but it's up to the author's ability to understand what's wrong and their good will (which they may lack even if they clearly understand and know how to correct, having been politely informed – happened to me, so I don't want to do it anymore until the Codewars team come up with some improvement to the process (I do have some ideas) (but unlikely, as they have serious issues reported on GitHub and unsolved for almost 10 years, like the one that you can try to see your friend's or your own solution which definitely exists (as shown by Codewars elsewhere) but it's not there)). One of the most common problems is that tests test for too little (and often also too much) and allow much easier incorrect solutions to pass. (One of my ideas: allow others to write tests and earn honor points thereby, with some verification, e.g. by some supermajority of votes, perhaps weighted by voters' honor (a ninja could use proposed but yet unverified tests as an option, not required to pass the kata, but potentially useful).)

  • Custom User Avatar

    This isn't guaranteed to work. For sort to return a permutation of the elements to sort it's required (per https://tc39.es/ecma262/multipage/indexed-collections.html#consistent-comparator) for the passed function to be a consistent comparator. One of the conditions is that 0 must be returned when the same argument is passed in both position. With yours it's -1 when a and b are 0.

  • Custom User Avatar
  • Custom User Avatar

    added to Java, JS, C#

  • Custom User Avatar

    what language ? added to JS

  • Custom User Avatar

    I know the problem. The definition of Caesar cipher you quoted is the general one. As far as I remember (the kata has many years... first translation is 7 y.o) I avoided negative shift though I am rather sure that in my solutions I wrote "my" modulo to prevent that kind of problem in some languages. For a lot of reasons (lack of time amongst others) I don't see interest to change something. Sorry:-) Maybe one day you author your own kata (some kind of variation on Caesar cipher with negative shift:-) and see the pain to try to maintain them as best as possible!

  • Custom User Avatar

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

  • Custom User Avatar

    Yes, it works now, thanks!

    By the way, the test suite (including basic and random) seems to always give strings starting with a letter to encode. From what I see in the solutions, some people assume it (as did I up to the moment I realized the desciption didn't guarantee it, so it's required to handle the other case too), some don't. I imagine you wouldn't like (or even be able to, depending on how Codewars works; I don't know, I haven't created any kata yet) to invalidate those solutions, so maybe add this condition to the description.

  • Custom User Avatar

    Could you try again? There was such a dubious case but I removed it.

  • Custom User Avatar

    The random tests in Scala give data like this to decode: List( _ (cpofnp * (, cpaple 20 1000, )) LctesxpetnP, inpaetzy tyepr, pc zgpcqwzh ). This is impossible – you can't get it from encode, the first 2 characters are always letters.

    Also, adding a sample test in which the data to encode doesn't start with a letter (but contains at least one, which is one of the many implicit conditions the kata description entails) would be prudent IMO.

  • Custom User Avatar

    Imagine me saying in my best attempt at a Vulcan voice: "It's adequate" 🖖

  • Custom User Avatar

    Nevertheless I modified the dubious case.
    Thanks for your posts!

  • Loading more items...