Skip to content

Commit 78bb002

Browse files
authored
Update 0072-edit-distance.md
1 parent 682d559 commit 78bb002

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

dsa-solutions/lc-solutions/0000-0099/0072-edit-distance.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ sidebar_label: 0072-Edit-Distance
55
tags:
66
- String
77
- Dynamic Programming
8-
description: Given two strings `word1` and `word2`, return the minimum number of operations required to convert `word1` to `word2`.
8+
description: Given two strings word1 and word2, return the minimum number of operations required to convert word1 to word2.
99
sidebar_position: 72
1010
---
1111

@@ -110,7 +110,7 @@ Reason: We are using a recursion stack space(O(N+M)) and a 2D array ( O(N*M)).
110110
111111
### Approach 2: Iterative Dynamic Programming (Tabulation)
112112
113-
Concept: In the recursive logic, we set the base case too `if(i<0)` and if(j<0) but we can’t set the dp array’s index to -1. Therefore a hack for this issue is to shift every index by 1 towards the right.
113+
Concept: In the recursive logic, we set the base case to `if(i<0)` and `if(j<0)` but we can’t set the dp array’s index to -1. Therefore a hack for this issue is to shift every index by 1 towards the right.
114114
115115
#### Algorithm
116116
@@ -160,7 +160,7 @@ int editDistance(string& S1, string& S2) {
160160

161161
### Complexity Analysis
162162

163-
- **Time complexity**: O(N*M)
163+
- **Time complexity**: $O(N \times M)$
164164
Reason: There are two nested loops
165-
- **Space complexity**: O(N*M)
165+
- **Space complexity**: $O(N \times M)$
166166
Reason: We are using an external array of size ‘N*M’. Stack Space is eliminated.

0 commit comments

Comments
 (0)