Please review the following resources before lecture:
For this assignment, you will need to implement the functions and logic required to calculate a mathematical expression. After implementing the add, divide, and multiply functions, you will combine these functions to compute the final result.
# Example config for students assigned to homework "D".
HW_VERSION=D
npm install
npm run compile
npm start
npm start
npm run check
expression_calculator.ts and .env.test files to receive full credit.Implement a function that validates whether a given alphabetic abbreviation matches a word using a special encoding system.
In this system, numbers in abbreviations are replaced by their corresponding alphabet letters:
Function Signature:
function isValidAlphaAbbreviation(word: string, abbr: string): boolean
Examples:
Example 1:
Input: word = "internationalization", abbr = "imzdn"
Output: true
Explanation:
- "internationalization" can be abbreviated as "i m z d n"
- i + (m=13 chars) + z + (d=4 chars) + n
- i + nternationaliza + z + atio + n = "internationalization"
Example 2:
Input: word = "substitution", abbr = "sjn"
Output: true
Explanation:
- s + (j=10 chars) + n
- s + ubstitutio + n = "substitution"
Invalid Examples:
Input: word = "test", abbr = "ab"
Output: false
Explanation: Adjacent letters 'a' and 'b' would represent adjacent abbreviated substrings
Constraints: