Tap here to switch tabs
Problem
Submissions

Problem: Delete Operation for Two Strings

med
30 min
Try to solve the Delete Operation for Two Strings problem.

Statement

Given two strings word1 and word2, return the minimum number of deletion steps required to make word1 and word2 the same.

In each step, you can delete exactly one character from either string.

Constraints:

  • 1≤1 \leq word1.length, word2.length ≤500\leq 500

  • word1 and word2 consist of only lowercase English letters.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Delete Operation for Two Strings

med
30 min
Try to solve the Delete Operation for Two Strings problem.

Statement

Given two strings word1 and word2, return the minimum number of deletion steps required to make word1 and word2 the same.

In each step, you can delete exactly one character from either string.

Constraints:

  • 1≤1 \leq word1.length, word2.length ≤500\leq 500

  • word1 and word2 consist of only lowercase English letters.