Ad
  • Custom User Avatar

    Printing the input yourself. Not a kata issue.

  • Custom User Avatar

    Not using TestCases for C# tests is extremely poor form. It leads to useless error messages like this: "Test Failed, Expected: 19 But was: 23". How am I supposed to know the parameters? Please write tests properly.

  • Custom User Avatar

    Everything seems to be working correctly now (using C# 8.0 at least).

  • Default User Avatar

    My code finds the answer in:
    177 ns ± 2.46 ns per loop (mean ± std. dev. of 7 runs, 10000000 loops each),
    but time outs on the server.
    next_smaller(11911)
    ->11191

  • Default User Avatar

    You can reference my solution, which may be the fastest way. Hope it will help you.

  • Custom User Avatar

    "Everything is fast for small N"

    A clue from the description: "some tests will include very large numbers."

    You'll need to either tweak your current algorithm to make it more efficient or find another more efficient one in order to pass before CW enforces the timeout.

    Some good advice when you fail a test on CW is to console.log the inputs.

    How about this -- imagine you were doing this by hand and you were supplied a number with just two unique digits, let's say 11911, how would you go about it? What ways would you throw out if you were doing it by hand? Let's suppose you counted downward, checking for the first number that has the same digits. None of the first 700 will satisfy the same digits criteria: 11910, 11909, 11908, 11907, 11906 .. 11900, 11899 .. 11200 .. 11199 (getting close) ... 11191 <-- our answer! This is what I call a "brute force" solution. Brute force solutions are in no way clever, but for simple problems they are often good enough. This is not one of the kata where brute force is good enough. Imagine you notice that the 9 just needs to move to the right to render a smaller number. Well now it's easy the answer is 11191. This hint alone is not enough to solve the kata -- things get only a bit more complicated with more digits -- however, this is where the fun is. Can you figure it out?

  • Custom User Avatar

    I'm in the same spot! Any hints would be a lifesaver!

  • Custom User Avatar

    Think this Kata is broken, in C# atleast, it is saying that my exceptions do no get thrown, tested in visual studio with the same input and they do indeed get thrown, how can we fix this?

  • Custom User Avatar

    Got a typo here "ValidRegoin" should be Region*, good solution!

  • Custom User Avatar

    This Kata has me kicking myself, in C# my sample tests pass easily but the attempt times out every time, can anyone give me a hint???