Tap here to switch tabs
Problem
Submissions

Problem: Make Three Strings Equal

Make Three Strings Equal asks you to remove rightmost characters from three strings until they are identical and non-empty, using the fewest operations or returning negative one if impossible.

Statement

You are given three strings s1, s2, and s3. In one operation, you can choose any of the three strings and remove its rightmost character.

Return the minimum number of operations required to make all three strings equal and non empty. If it is impossible to make them equal, return −1-1.

Constraints:

  • 1≤1 \leq s1.length, s2.length, s3.length ≤100\leq 100

  • s1, s2, and s3 consist only of lowercase English letters.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Make Three Strings Equal

Make Three Strings Equal asks you to remove rightmost characters from three strings until they are identical and non-empty, using the fewest operations or returning negative one if impossible.

Statement

You are given three strings s1, s2, and s3. In one operation, you can choose any of the three strings and remove its rightmost character.

Return the minimum number of operations required to make all three strings equal and non empty. If it is impossible to make them equal, return −1-1.

Constraints:

  • 1≤1 \leq s1.length, s2.length, s3.length ≤100\leq 100

  • s1, s2, and s3 consist only of lowercase English letters.