522. Strings Differ by One Character
Given an array of strings words, return true if there are two different strings in the array that differ by exactly one character in the same index, otherwise, return false.
Example 1:
Input: dict = ["abcd", "acbd", "aacd"]
Output: true
Explanation:
"abcd" and "aacd" differ by exactly one character ('b' vs 'a').
"acbd" and "aacd" also differ by exactly one character.
Example 2:
Input: dict = ["aaaa", "bbbb", "cccc"]
Output: false
Explanation:
No two strings differ by exactly one character.
Now Your Turn!
Pick the correct output for the given inputInput: dict=["apple", "apply", "ample","maple"]
Still unsure what the problem is asking ?
Let’s go through a few more examples, step by step, to make it clearer.
Constraints:
- The number of characters in dict <= 105
- dict[i].length == dict[j].length
- dict[i] should be unique.
- dict[i] contains only lowercase English letters.