Tap here to switch tabs
Problem
Submissions

Problem: Make Three Strings Equal

med
30 min
Try to solve the Make Three Strings Equal problem.

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

med
30 min
Try to solve the Make Three Strings Equal problem.

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.