Tap here to switch tabs
Problem
Submissions

Problem: Equalize Strings by Adding or Removing End Characters

Try to solve the Equalize Strings by Adding or Removing End Characters problem.

Statement

You are given two strings initial and target.

In one operation, you can perform either of the following actions on the current string:

  • Add any character to the front or back of the string.

  • Remove the character at the front or back of the string.

Return the minimum number of operations required to transform initial into target.

Constraints:

  • 1≤1 \leq initial.length, target.length ≤1000\leq 1000

  • initial and target consist only of lowercase English letters.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Equalize Strings by Adding or Removing End Characters

Try to solve the Equalize Strings by Adding or Removing End Characters problem.

Statement

You are given two strings initial and target.

In one operation, you can perform either of the following actions on the current string:

  • Add any character to the front or back of the string.

  • Remove the character at the front or back of the string.

Return the minimum number of operations required to transform initial into target.

Constraints:

  • 1≤1 \leq initial.length, target.length ≤1000\leq 1000

  • initial and target consist only of lowercase English letters.