File tree 1 file changed +0
-24
lines changed
src/main/java/com/fishercoder/solutions
1 file changed +0
-24
lines changed Original file line number Diff line number Diff line change 1
1
package com .fishercoder .solutions ;
2
2
3
- /**
4
- * 712. Minimum ASCII Delete Sum for Two Strings
5
- *
6
- * Given two strings s1, s2, find the lowest ASCII sum of deleted characters to make two strings equal.
7
-
8
- Example 1:
9
- Input: s1 = "sea", s2 = "eat"
10
- Output: 231
11
- Explanation: Deleting "s" from "sea" adds the ASCII value of "s" (115) to the sum.
12
- Deleting "t" from "eat" adds 116 to the sum.
13
- At the end, both strings are equal, and 115 + 116 = 231 is the minimum sum possible to achieve this.
14
-
15
- Example 2:
16
- Input: s1 = "delete", s2 = "leet"
17
- Output: 403
18
- Explanation: Deleting "dee" from "delete" to turn the string into "let",
19
- adds 100[d]+101[e]+101[e] to the sum. Deleting "e" from "leet" adds 101[e] to the sum.
20
- At the end, both strings are equal to "let", and the answer is 100+101+101+101 = 403.
21
- If instead we turned both strings into "lee" or "eet", we would get answers of 433 or 417, which are higher.
22
-
23
- Note:
24
- 0 < s1.length, s2.length <= 1000.
25
- All elements of each string will have an ASCII value in [97, 122].
26
- */
27
3
public class _712 {
28
4
public static class Solution1 {
29
5
//credit: https://leetcode.com/articles/minimum-ascii-delete-sum-for-two-strings/
You can’t perform that action at this time.
0 commit comments