Count Differing Positions
a and b have the same length. Return the number of positions i where a[i] is not equal to b[i].
Example 1
a "karolin"
b "kathrin"
returns 3
They differ at 3 positions.
Constraints
0 <= len(a) <= 50len(b) == len(a)
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.
More Strings problems
- Count Prefixes of a Given StringBeginner
- Defanging an IP AddressBeginner
- Determine if String Halves Are AlikeBeginner
- Find Words Containing CharacterBeginner
- Join the Non-Empty PartsBeginner
- Longest Vowel RunBeginner
- Longest Word in a SentenceBeginner
- Maximum Nesting Depth of ParenthesesBeginner