Practice Verbal Arithmetic Puzzle
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
Assign one decimal digit to each distinct letter appearing in words and result, using the same digit for every occurrence and different digits for different letters. Each word and result must represent a number without a leading zero; a single-letter number may be zero. Return whether an assignment exists for which the sum of the numbers represented by words equals the number represented by result.
Source: Verbal Arithmetic Puzzle on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
words = ["SEND","MORE"], result = "MONEY"
true
# Example 2
words = ["SIX","SEVEN","SEVEN"], result = "TWENTY"
true
# Example 3
words = ["LEET","CODE"], result = "POINT"
false
Constraints
Related LeetCode Problems
Practice more problems similar to Verbal Arithmetic Puzzle.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.