Minimize ASCII Delete Sum for Two Strings with Dynamic Programming

Day 10 / #100DaysOfCode LeetCode 712 — Minimum ASCII Delete Sum for Two Strings (Medium) Problem: Given two strings, delete characters from either string so that both become equal, while minimizing the sum of ASCII values of deleted characters. Approach: - Used Dynamic Programming where dp[i][j] represents the minimum delete sum to make substrings s1[i:] and s2[j:] equal - If characters match, move both pointers forward with no cost - Otherwise, delete one character and take the minimum cost between the two choices Key insight: This is a variation of LCS-style DP, but instead of maximizing length, we minimize the deletion cost. #LeetCode #DSA #Java 

  • text

To view or add a comment, sign in

Explore content categories