Tap here to switch tabs
Problem
Submissions

Problem: Delete Operation for Two Strings

Delete Operation for Two Strings asks for the fewest single-character deletions from either of two strings needed to make them exactly the same.

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

Delete Operation for Two Strings asks for the fewest single-character deletions from either of two strings needed to make them exactly the same.

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.