Medium · Strings

Strings Differ by One Character

Given a list dict of distinct 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

Read every interview problem free. Ten rooms need no account. A token opens a problem in full — Pro never counts.

More Strings problems