Data Structures & AlgorithmsVery hardICPC regional · Product Company SDE

Problem: The minimum ASCII delete sum to make the strings "sea" and "eat" equal is the least total ASCII value of deleted characters. Give that minimum (ASCII values: s=115, e=101, a=97, t=116).

  1. A. 2
  2. B. 425
  3. C. 627
  4. D. 231

Correct answer: D. 231

Keep the common subsequence with the largest ASCII weight, 'ea', and delete s (115) and t (116): 231. Counting deleted characters gives 2, keeping only 'e' deletes s, a, a, t (425), and deleting everything costs 627.

More Coding Interview Problems questions

Exams that ask this topic