Convert number words to integer
Company: Bank of America
Role: Data Scientist
Category: Coding & Algorithms
Difficulty: Medium
Interview Round: Take-home Project
Given a line containing an English phrase representing a number in the range −999,999,999 to 999,999,999, convert it to its integer value. Supported words: negative, zero, one, two, three, four, five, six, seven, eight, nine, ten, eleven, twelve, thirteen, fourteen, fifteen, sixteen, seventeen, eighteen, nineteen, twenty, thirty, forty, fifty, sixty, seventy, eighty, ninety, hundred, thousand, million. Negative numbers are prefixed with "negative". The word "hundred" is not used when "thousand" could be (e.g., 1500 is "one thousand five hundred"). Print the decimal representation for each input line. Examples: "fifteen" → 15; "negative six hundred thirty eight" → -638.
Quick Answer: This question evaluates textual number parsing, tokenization, and numeric mapping skills, testing string manipulation and lexical interpretation within the Coding & Algorithms domain for a Data Scientist role and emphasizing practical application rather than pure theoretical concepts.