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).
- A. 2
- B. 425
- C. 627
- 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
- Problem: A pattern-matching task uses the string "abxcabcyabd" and the target "abc". How many length-3 windows of the text differ from…
- Problem: Using shell-style wildcards ( matches any run of characters including empty, ? matches exactly one character), how many words in…
- Problem: Choose a subsequence of [2, 3, 5, 7, 8] with no two chosen elements at adjacent positions. How many such non-empty choices sum to…
- Problem: The egg-dropping puzzle with 2 eggs and a 10-floor building: what is the minimum number of drops needed in the worst case to find…
- Problem: How many ways can 10 be made using coins {1, 2, 5} where order does not matter (combinations of coin counts)?
- Problem: On a 3×3 matrix [[9,9,4],[6,6,8],[2,1,1]], a strictly increasing path moves up, down, left or right between adjacent cells with…