[Community Puzzle] abcdefghijklmnopqrstuvwxyz

I got 100% score despite not getting Test 2 correctly
I got this output for Test 2:

---------------
abcd-----------
-one-----------
qpmf-----------
rklg----------s
sjih-----------
t--------------
u--------------
vwx------------
--y------------
--z------------
---------------
---------------
---------------
---------------

Expected Output:

---------------
abcd-----------
-one-----------
qpmf-----------
rklg-----------
sjih-----------
t--------------
u--------------
vwx------------
--y------------
--z------------
---------------
---------------
---------------
---------------

There is an extra s!

Hi, i’m having an issue with the validators 3,4 and 5 in the IDE while my code passes all the given tests.
I don’t understand what’s the issue and cannot even troubleshoot it cause the code breaks only in the IDE.
I’m aware of the long ass and unoptimized code i made but in logic my code should pass the IDE since i get no errors in the given tests. I don’t think that my solution is hard coded for the given tests but i’m always open for solutions if that is the case.

Anyways here’s my code :
[Mod edit: Please avoid posting codes on the forum.]

Your code times out with Validators 3 to 5.

Your code seems to get stuck in an infinite loop in Validator 3, for example. If I add the following line

console.error(i, o)

after

if (a < 25) {

The following is the error output:

[some other coordinates first]
6 1
6 3
6 1
6 3
6 1
6 3
[6 1 and 6 3 repeat until timeout]

Thank you for the response, so the issue comes from the “building the response tab in tab2” part of the code you’d say ? Or i might have to redo everything ? :smiling_face_with_tear:

Your code may be simplified quite a bit. Part of your code may be recycled.
• Note down where the "a"s are when reading the input.
• Try each “a” to see the alphabet sequence starts from that “a”.
• All four directions of checking may be combined as a single for-loop. For example, if the current cell is at (i, j) (row i, column j), then the next four cells to check are (i - 1, j), (i + 1, j), (i, j - 1) and (i, j + 1). For each of the four cells, check if it is within the boundaries, and check if it contains the next letter in the sequence. If it is, repeat the process with that cell.
• If any sequence breaks at the middle, do not check any more. Try the next “a”.

1 Like

Okay i see !! I’m gonna try that then, thx again for your response and the provided help :pray:

I only passed test 1 and I don’t know how to pass the others.
Below is my code.

[mod edit: please avoid posting codes on the forum]

I need some help, thanks.

Did you check what your code outputs for Test 2? Your code has found one valid sequence but it seems that it still searches further despite that.

So if it searches for an incomplete sequence, don’t I need to record it?

Or adding something into dfs function?

When you don’t have a complete sequence yet, you have to record the incomplete sequence. But once you’ve found a complete sequence, you should stop searching/recording more.

function dfs(current_position, sequence_so_far):
    if sequence_so_far is complete:
        return sequence_so_far
    for next_position in explore(current_position):
        result = dfs(next_position, sequence_so_far + next_position)
        if result is good:
            return result
    return bad
1 Like

Thank you, I have passed all the tests!
By the way, why am I receiving this [mod edit: please avoid posting codes on the forum]?

Good job!

I’ve edited your message and inserted that message. Please avoid posting codes on this forum.

When you have a question on a puzzle, please try describing the approach/flow/structure of your code, and which tests/validators you have trouble with first. We may already be able to respond based on the information provided without the code. If we do want to see your code, we’ll ask you to provide it via private message.

1 Like

Hello,
I think I’ve found an uncovered case.
When the “a” (or any other letter in the final sequence) is surrounded by its next letter, it produces several “dead branch” on the tree. That’s what the instructions suggests.
But i haven’t see any test on this point, and I’ve found many committed codes that don’t cover this case.
Which is wrong, the instructions or the validators ?

this kind of form :

e b l r
b a b c
h b d d

Can you give a full example where some committed codes don’t work?

It’s also possible that the validators were edited after some of the codes had been committed.

Hello, my code passes all the tests but cannot pass validator 2, is there a hint for that?

Thanks

It’s difficult to give a hint for this puzzle. Please double check your code first, and see if your code checks all possible starting positions of “a”, and checks all of, and only, the valid branches from each letter.

I think my code can already do all that, but I don’t know why ?. Can I send you a pm?

OK, please do.

1 Like