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

Open every published interview problem, solution, scene, and memory room free, with no account.

More Strings problems