Practice Make Three Strings Equal
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
You are given three strings: s1, s2, and s3. In one operation you can choose one of these strings and delete its rightmost character. Note that you cannot completely empty a string. Return the minimum number of operations required to make the strings equal. If it is impossible to make them equal, return -1.
Source: Make Three Strings Equal on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
Input
s1 = "abc", s2 = "abb", s3 = "ab"
Output
2
# Example 2
Input
s1 = "dac", s2 = "bac", s3 = "cac"
Output
-1
Constraints
1 <= s1.length, s2.length, s3.length <= 100
s1, s2 and s3 consist only of lowercase English letters.
Related LeetCode Problems
Practice more problems similar to Make Three Strings Equal.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.