leetcode在力扣 App 中打开
调试中...
调试中...
题目描述
题目描述
题解
题解
提交记录
提交记录
代码
代码
测试用例
测试用例
测试结果
测试结果
困难
相关标签
相关企业
提示

将非负整数 num 转换为其对应的英文表示。

 

示例 1:

输入:num = 123
输出:"One Hundred Twenty Three"

示例 2:

输入:num = 12345
输出:"Twelve Thousand Three Hundred Forty Five"

示例 3:

输入:num = 1234567
输出:"One Million Two Hundred Thirty Four Thousand Five Hundred Sixty Seven"

 

提示:

  • 0 <= num <= 231 - 1
通过次数
42.6K
提交次数
115.9K
通过率
36.8%


相关企业

提示 1
Did you see a pattern in dividing the number into chunk of words? For example, 123 and 123000.

提示 2
Group the number by thousands (3 digits). You can write a helper function that takes a number less than 1000 and convert just that chunk to words.

提示 3
There are many edge cases. What are some good test cases? Does your code work with input such as 0? Or 1000010? (middle chunk is zero and should not be printed out)

相似题目

评论 (0)

贡献者
© 2025 领扣网络(上海)有限公司
0 人在线
行 1,列 1
num =
123
Source