This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Leetcode daily challenge - 14.06.22 | |
// https://leetcode.com/problems/delete-operation-for-two-strings | |
// Top Down DP approach - O(n*m) space and O(n^2) time complexity | |
class Solution { | |
public: | |
int minDistance(string word1, string word2) { | |
int n = word1.size(),m = word2.size(); | |
int dp[n+1][m+1]; | |