[Community Puzzle] In Stereo

Coding Games and Programming Challenges to Code Better

Send your feedback or ask for help here!

Created by @snoyes,validated by @David_Augusto_Villa,@Alex-1 and @Nagato_Uzumaki.
If you have any issues, feel free to ping them.

I am not sure how to determine the current index on the pattern after insert or delete characters.

Common sense tells that when A is removed, index falls on B. When B is removed, index falls on C. But the example shows that index falls on D. What are the rules for this result?

1 Like

It falls on C (see end of row 1) and then it advances of 1 (as seen in start of row 2).


Thank you. Got it solved.
There was a massive amount of info in the statement to digest. After reading the statement a few times I was still missing some key processing hints, later rediscovered during debug.

For anyone who is stuck, these requirements are in the statement but may be you are not (yet) aware of:

  • need to reset the given pattern and stock for each line of map
  • reset pattern pointer to 0 for each line
  • inc pattern pointer after each map char processing
  • don’t forget to round-robin the pointer in the inc

I can see the hidden image in the wikipedia example, but I can’t in the “CodinGame” big example. That’s very frustrating!
But I liked this problem! As said ealier, “there was a massive amount of info in the statement to digest”, but the result is satisfying (or I guess it is, when you can see it :sob:).

It’s much harder with those, I can only see the biggest ones.
Maybe try to duplicate so that the height is bigger.

I never ever was able to ‘see’ any of such pictures properly. It is just random noise for my eyes.
Luckily, it was not needed to pass the coding part… :slight_smile:

1 Like

It needs a little training to your eyes to see them.
Basically when you are watching the picture you try to see through it - try to control your eye muscles to focus on something behind the picture. Your eyes may refuse to react because your brain tells them the object is already in focus. But you have to tell the brain to override the default focusing mode.

1 Like

I have trouble understandig this:
Pattrern: “.8.8…88.”
Depth: 0
Position: 9 or the last symbol in pattern ‘.’

When the next depth is 2, two symbols should be removed from the pattern, starting from the position 9. This results in new pattern “8.8…88” and position 0 relative to the pattern - symbol ‘8’. But the test case seems to insist that the symbol should be ‘.’

1 Like

I modified your pattern to something more obvious.

a pattern of length 10

pointer pointing at 9
delete 9
pointer pointing at the non-existing index 9
pointer round robin to index 0

pointing at 0
delete again
deleted 0

pointer remains at index 0, pointing at 1
pattern becomes 12345678

index will advance 1, to point at 2 in the next iteration


Hum, on IDE i only pass the first two test, but on submit only the “Example” is failling…

Also i think there is an error in the “Diamond” test:
Trouvé : 8 8 88 8 8 88 8 8 88 8 8 8 88
Attendu : 8 8 88 8 8 88 8 8 888 8 88 88
But since it’s the last line and it’s filed with zero in the depth map, it should repeat 8 8 88 8 8 four time.

When you submit your code it is checked against validators that are different than visible test cases (could have the same names though).
So it is possible to have different failures on submit.

Depth map for the last line is filled with zeroes so it will look exactly the same as the first line which is also filled with zeroes.

You can take a look at the whole expected output by using menu option in top-right corner of test cases panel.

1 Like

ok, i figured it out^^ Thanks.
The problem came from the case when i had to remove elements in my patern but the position + |change in depth| > pattern size.

Thanks a lot for your explanation of this case. My code stop at 75 % before i read that !

I think you need a better example case. What the behavior should be isn’t well stated in the instructions (the step by step instructions only have you wrapping the pointer back to the beginning in the 3rd step, ignoring the case where you shorten the pattern by more than one character in a single pass).

The provided example does not disambiguate what should be done as it reduces the pattern to a single character, making it impossible to tell what the correct behavior should be.

1 Like

If the pattern is a single character, then advancing and wrapping around will stay on that single character.

Can you give details about the situation you find confusing?

I think the example provided by java_coffee_cup is a better example of what the correct behavior is, and is less ambiguous.

Two thing I hate about this puzzle:

  1. Bold char-pointer in the explanation that totaly indistinguishable atleast on my screen.
  2. Actually what many puzzle is struggling - useless test. Tests should help understand problem, only first “example” test is readable and helpfull, rest are “validators”.
    I mean does anyone really expect to someone debug this:
    Basicly puzzle with 1 test to debug
1 Like

For me the explanation was a little bit confusing, that’s how I did it:
I) Beginning of each row set back the default values of the pattern, the stock and the depth
II) Iterate through the depths of the row and in every iteration:

  1. Calculate depth change
  2. Decide which action should I do, then do it (add or remove)
  3. Print the Output
  4. Shift the new pattern

The difference is that I didn’t move the current position or the pointer, I just shifted the pattern. Shifting means I moved the first character of the pattern to the end.

And here is the extended example in this case:

        | Current | New   | Change   |          | New     |       |       |
Pattern | Depth   | Depth | in Depth | Action   | Pattern | Stock | Output| Shift New Pattern
ABCD    | 0       | 2     | +2       | Remove 2 | CD      | UVWX  | C     | DC
DC      | 2       | 3     | +1       | Remove 1 | C       | UVWX  | C     | C
C       | 3       | 2     | -1       | Add 1    | UC      | VWX   | U     | CU
CU      | 2       | 0     | -2       | Add 2    | VWCU    | X     | V     | WCUV
WCUV    | 0       | 0     | 0        | Nothing  | WCUV    | X     | W     | CUVW

Hopefully it will help to understand the task a bit better. :slight_smile: