[Community Puzzle] Find the Replacement


There is something hinky with either the validators or the test cases. My code does not pass validator 5 (Random, all different), but passes the test cases 100%.

If I don’t check for endless loops, my algorithm correctly identifies all of the changes the validator is looking for, then will just infinitely cycle between two letters.

Has anyone else seen this behavior.

Hello, validator 5 contains letters and uppercase letters. Like all other test cases, there exists a set of replacements A->B such that 1. A does not repeat, and 2. multiple replacements may point to B.

Due to the nature of the problem requiring the output to print found replacements in the same order as they are found (output specification), if the dict / set type in your language does not maintain order, you may need to keep a separate ordered array to complement your solution to prevent printing them in the wrong order and being considered a wrong solution. If you already have that covered, as the test case is long, you may need to use a lookup table for efficiency if your current implementation uses multiple nested loops to prevent timeouts.

1 Like