Practice Check if Word Equals Summation of Two Words
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
The letter value of a letter is its position in the alphabet starting from 0 (i.e. 'a' -> 0, 'b' -> 1, 'c' -> 2, etc.). The numerical value of some string of lowercase English letters s is the concatenation of the letter values of each letter in s, which is then converted into an integer. You are given three strings firstWord, secondWord, and targetWord, each consisting of lowercase English letters 'a' through 'j' inclusive. Return true if the summation of the numerical values of firstWord and secondWord equals the numerical value of targetWord, or false otherwise.
Source: Check if Word Equals Summation of Two Words on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
firstWord = "acb", secondWord = "cba", targetWord = "cdb"
true
# Example 2
firstWord = "aaa", secondWord = "a", targetWord = "aab"
false
# Example 3
firstWord = "aaa", secondWord = "a", targetWord = "aaaa"
true
Constraints
Related LeetCode Problems
Practice more problems similar to Check if Word Equals Summation of Two Words.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.