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.
Printing the input yourself. Not a kata issue.
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.
Everything seems to be working correctly now (using C# 8.0 at least).
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
You can reference my solution, which may be the fastest way. Hope it will help you.
"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?
I'm in the same spot! Any hints would be a lifesaver!
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?
Got a typo here "ValidRegoin" should be Region*, good solution!
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???