[Community Puzzle] Stunning numbers

Coding Games and Programming Challenges to Code Better

Send your feedback or ask for help here!

Created by @VilBoub,validated by @Antsurf,@jddingemanse and @FredericLocquet.
If you have any issues, feel free to ping them.

Doing this in C.

I had execution time problems on tests 8 and 10 in my first approach, which just tried every single number starting from n+1 until finding the next “stunning” one.

I redid it in a much more efficient way after realizing a clever trick (not spoiling it) and now I pass all tests but Validator 3 doesn’t validate, and I don’t know why…

Since my first method did pass Validator 3, I could do some horrible stuff like this (value of 8 could change):

if strlen(n) < 8

but that’s disgusting and awful.

It’s 3am, so I’m leaving it at 90% for now.
But I’d appreciate some feedback, if other people have had any trouble with this validator or not.

1 Like

The only difference between Test 3 and Validator 3 is the number length parity.

Fun puzzle.
Maybe i took the puzzle in the wrong way but for me it wasn’t so simple…
For me it’s not an “easy puzzle” anyway !

1 Like

That was interesting, thank you. At first it seemed too easy for me until I got to the seventh test :). And here I had to think a little.

At first I thought I had found the solution, by simply iterating, but like other people it blocked when the numbers got too long. I’ve been thinking about it for days when the other “simple” problems didn’t take me that long. It’s both very interesting to think about and come up with ideas for resolution, and also very frustrating to fail on a supposedly simple problem. Could those who have succeeded confirm that this problem does not require an IQ of 140, which obviously I do not have :slight_smile:

Thanks in advance

1 Like

The basic concept is easy but I would say passing all the tests was not. None of the published solutions seem simple/easy to me. For myself, I finally was able to put it all together when I realized I needed to work from the middle outwards (but it looks like there are other ways to solve it, too).

1 Like

You don’t need high IQ. My tip is to try everything with paper and pen, it helps a lot !

1 Like

Hey, Fellow C Developer.
To solve this puzzle you need to know two tricks.
You was to tired to see what is going on.

Try second time after rest.
I had similar problem. My code was OK in IDE but failed on my PC. Validator 3 was a pain in the neck until I got a break :sunglasses: