Skip to content

Commit 861981a

Browse files
refactor 72
1 parent 763bf66 commit 861981a

File tree

1 file changed

+1
-15
lines changed
  • src/main/java/com/fishercoder/solutions

1 file changed

+1
-15
lines changed

src/main/java/com/fishercoder/solutions/_72.java

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,5 @@
11
package com.fishercoder.solutions;
22

3-
/**
4-
* 72. Edit Distance
5-
*
6-
* Given two words word1 and word2,
7-
* find the minimum number of steps required to convert word1 to word2.
8-
* (each operation is counted as 1 step.)
9-
10-
You have the following 3 operations permitted on a word:
11-
12-
a) Insert a character
13-
b) Delete a character
14-
c) Replace a character
15-
*/
16-
173
public class _72 {
184

195
public static class Solution1 {
@@ -43,7 +29,7 @@ public int minDistance(String word1, String word2) {
4329
cost = 1;
4430
}
4531
table[i][j] = Math.min(Math.min(table[i - 1][j] + 1, table[i][j - 1] + 1),
46-
table[i - 1][j - 1] + cost);
32+
table[i - 1][j - 1] + cost);
4733
}
4834
}
4935
return table[m][n];

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy