Data Structures & AlgorithmsModerateGATE CS · TCS NQT
The substitutions-only distance (Hamming distance) between "karolin" and "kathrin" counts positions where the letters differ. What is that value?
- A. 0
- B. 5
- C. 3
- D. 14
Correct answer: C. 3
Hamming distance compares letters position by position and only works for equal lengths. Edit distance allows insertions and deletions, so it can be smaller or larger; LCS-based counts measure a different quantity.
Practise more Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questionsArrays, Strings, Linked Lists, Stacks, Queues and Hashing: notes and key points
More Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questions
- What is the length of the longest repeating subsequence of "aabebcdd"? It is a subsequence that appears at least twice, where the two…
- Four houses are painted with one of 3 colours. Painting house i with colour c costs cost[i][c] = [[17, 2, 17], [16, 16, 5], [14, 3, 19]…
- Events are given as (start day, end day) inclusive: [(1, 2), (2, 3), (3, 4), (1, 2), (3, 5)]. You may attend at most one event per day…
- Split "ababcbacadefegdehijhklij" into the maximum number of contiguous pieces so that each letter appears in at most one piece. What is…
- Unit-time tasks have deadlines [1, 2, 2, 3, 3, 3, 5, 6] (a task must finish by its deadline, and only one task runs at a time from time…
- What is the minimum number of characters you must DELETE from "aabbbcaaddd" so that no two adjacent characters are equal?