[Community Puzzle] Russian Dolls - Puzzle discussion

Coding Games and Programming Challenges to Code Better

Send your feedback or ask for help here!

Created by @java_coffee_cup,validated by @Rafarafa,@Eulero314 and @Stef_3.
If you have any issues, feel free to ping them.

1 Like

Hey, I’m having trouble understanding one of the examples I failed on:

Here’s the group printed as it was received:

-9 -2 2 -6 -5 5 6 9
I responded “2” but it turns out I should have selected -1. Can someone help me understand why this is an invalid answer? @java_coffee_cup

If it helps, this is under “Basic validator”. My code passes all other test cases. (Well, except the two after this one, as it’s the 98th test case and I can’t check those)

Nevermind! I messed up in my debug checking, it’s the NEXT one that failed and it’s obvious. Cheers on a great puzzle!

Yes it was the next line that caused failure. Good to know you found it out by yourself.

Okay, I gotta ask, how’d you know???

Seems like a really rare edge case that triggered due to an oversight I made on examining the outer doll.

I guessed CG was printing out the last line it can print before an error was found. If that line did not trigger an error, the next line could be.

1 Like

The last 3 lines of the example have

Input
-11 11
-5 -4 -3 -2 -1 1 2 3 4 5
-10 -3 -2 2 3 -1 1 -5 -4 -1 1 4 5 10

Output
1
1
3

shouldn’t the output for them be this ??
0
1
2

The first one is a stand alone solid doll. Ans is 1.
The third one has been drawn in the statement with lines connecting pairs of doll parts. The solid dolls sizes are #2, #1 and #1. No more smaller dolls are insides these three pairs of parts.
-10 -3 -2 2 3 -1 1 -5 -4 -1 1 4 5 10

so every doll with nothing inside is solid - that wasn’t clear to me from the description - I thought only 1-size-dolls are solid.

but the description is clear enough - i see it now
‘The size #3 doll has a size #2 solid doll inside.’

well, thanks for your time . . .

The definition of “solid” can be found in a line below the first example:
“… without another doll inside indicating this doll is a solid wood”