【Amazon面经】Onsite | English Words to Integer 职场讨论

兔精精 2020-5-17 700


Hey all, I received a question called "String to Int" in an interview, and I was flabberghasted at how simple it sounded at first, but difficult it is in practice.

Turn a string to a number

Example 1:

Input: "Three hundred million"

Output: 300,000,000

Example 2:

Input: "Five Hundred Thousand"

Output: 500,000

I immedietly thought of int to string https://leetcode.com/problems/integer-to-english-words/, but I realized it is much more difficult than that. Anyone see this question in an interview before ?

最新回复 (0)
返回