Tap here to switch tabs
Problem
Submissions

Problem: Minimum Steps to Convert String with Operations

Minimum Steps to Convert String with Operations asks you to partition one string into nonempty substrings and transform it into another with the fewest replacements, swaps, and reversals.

Statement

You are given two strings word1 and word2 of equal length.

You can partition word1 into one or more non empty contiguous substrings. For each substring, you can perform any number of the following operations:

  • Type 11: Replace any single character in the substring with any lowercase English letter.

  • Type 22: Swap any two characters in the substring.

  • Type 33: Reverse the substring.

Each operation on a substring counts as 11 operation.

Return the minimum total number of operations required to transform word1 into word2.

Constraints:

  • 1≤1 \leq word1.length == word2.length ≤100\leq 100

  • word1 and word2 consist only of lowercase English letters.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Minimum Steps to Convert String with Operations

Minimum Steps to Convert String with Operations asks you to partition one string into nonempty substrings and transform it into another with the fewest replacements, swaps, and reversals.

Statement

You are given two strings word1 and word2 of equal length.

You can partition word1 into one or more non empty contiguous substrings. For each substring, you can perform any number of the following operations:

  • Type 11: Replace any single character in the substring with any lowercase English letter.

  • Type 22: Swap any two characters in the substring.

  • Type 33: Reverse the substring.

Each operation on a substring counts as 11 operation.

Return the minimum total number of operations required to transform word1 into word2.

Constraints:

  • 1≤1 \leq word1.length == word2.length ≤100\leq 100

  • word1 and word2 consist only of lowercase English letters.