Given the two strings “cats” and “dogs”. What is the Hamming distance between two strings?
Given the two strings “cats” and “dogs”. What is the Hamming distance between two strings? Correct Answer 3
The Hamming distance between two strings of equal length is the number of positions at which the corresponding symbols are different. It is the number of substitutions required to transform one string into another. cats ⇒ dats (substitute ‘d’ for ‘c’) dats ⇒ dots (substitute ‘o’ for ‘a’) dots ⇒ dogs (substitute ‘g’ for ‘t’) So hamming distance is 3 as it requires 3 edit operations to convert “cats” to “dogs”.
মোঃ আরিফুল ইসলাম
Feb 20, 2025