Description
Given two strings s1 and s2, return the lowest ASCII sum of deleted characters to make two strings equal.
Examples
Input:
s1 = "sea", s2 = "eat"Output:
231Explanation:
Delete 's' (115) and 't' (116) = 231.
Input:
s1 = "a", s2 = "a"Output:
0Explanation:
Edge case with a single character.
Input:
s1 = "delete", s2 = "leet"Output:
403Explanation:
To make both strings equal, delete characters not in the longest common subsequence. The sum of ASCII values of deleted characters is minimized by keeping the maximum-value common subsequence. The minimum deletion cost is the result.
Constraints
- •
1 ≤ s1.length, s2.length ≤ 1000