Tap here to switch tabs
Problem
Submissions

Problem: Check if Word Equals Summation of Two Words

med
30 min
Try to solve the Check if Word Equals Summation of Two Words problem.

Statement

The letter value of a letter is defined as its position in the alphabet starting from 00 (that is, 'a' corresponds to 00, 'b' corresponds to 11, 'c' corresponds to 22, and so on up to 'j' which corresponds to 99).

The numerical value of a string of lowercase English letters is the integer formed by replacing each letter with its letter value and concatenating the digits in order.

Given three strings firstWord, secondWord, and targetWord, return true if the sum of the numerical values of firstWord and secondWord equals the numerical value of targetWord, or false otherwise.

Constraints:

  • 1≤1 \leq firstWord.length, secondWord.length, targetWord.length ≤8\leq 8

  • firstWord, secondWord, and targetWord consist of lowercase English letters from 'a' to 'j' inclusive.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Check if Word Equals Summation of Two Words

med
30 min
Try to solve the Check if Word Equals Summation of Two Words problem.

Statement

The letter value of a letter is defined as its position in the alphabet starting from 00 (that is, 'a' corresponds to 00, 'b' corresponds to 11, 'c' corresponds to 22, and so on up to 'j' which corresponds to 99).

The numerical value of a string of lowercase English letters is the integer formed by replacing each letter with its letter value and concatenating the digits in order.

Given three strings firstWord, secondWord, and targetWord, return true if the sum of the numerical values of firstWord and secondWord equals the numerical value of targetWord, or false otherwise.

Constraints:

  • 1≤1 \leq firstWord.length, secondWord.length, targetWord.length ≤8\leq 8

  • firstWord, secondWord, and targetWord consist of lowercase English letters from 'a' to 'j' inclusive.