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.]
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 ?
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”.
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
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.
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 ?
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.