Bird
0
0

What is the Levenshtein distance between the strings "book" and "back"?

medium📝 Predict Output Q4 of 15
NLP - Text Similarity and Search
What is the Levenshtein distance between the strings "book" and "back"?
A1
B2
C3
D4
Step-by-Step Solution
Solution:
  1. Step 1: Compare characters of "book" and "back"

    Positions: b vs b (same), o vs a (substitution), o vs c (substitution), k vs k (same).
  2. Step 2: Count edits needed

    Two substitutions are needed (o->a and o->c), so distance is 2.
  3. Final Answer:

    2 -> Option B
  4. Quick Check:

    Count substitutions = 2 [OK]
Quick Trick: Count character differences for small strings [OK]
Common Mistakes:
MISTAKES
  • Counting only one substitution
  • Counting insertions instead
  • Ignoring repeated characters

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More NLP Quizzes