Medium · Strings

Strings Differ by One Character

Given a list dict of distinct ASCII strings that all have the same length, return true if some two of them differ in exactly one position (the same index in both), otherwise false.

Examples

Example 1

[abcd, acbd, aacd]

Output: true — differ by one

Example 2

[ab, cd, yz]

Output: false — no pair

Rebuild it in the studio

Core interview problems are free with a full runner and lessons; Pro opens the complete library.

More Strings problems