freeCodeCamp/curriculum/challenges/chinese/10-coding-interview-prep/project-euler/problem-17-number-letter-co...

34 lines
881 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

---
id: 5900f37d1000cf542c50fe90
title: 问题17数字字母计数
challengeType: 5
videoUrl: ''
---
# --description--
如果数字1到5用文字写出则总共使用3 + 3 + 5 + 4 + 4 = 19个字母。如果从1到包含`limit`所有数字都用文字写出,那么会使用多少个字母? **注意:** 不要计算空格或连字符。例如342三百四十二包含23个字母115一百一十五包含20个字母。在写出数字时使用“和”符合英国的用法。
# --hints--
`numberLetterCounts(5)`应返回19。
```js
assert.strictEqual(numberLetterCounts(5), 19);
```
`numberLetterCounts(150)`应该返回1903。
```js
assert.strictEqual(numberLetterCounts(150), 1903);
```
`numberLetterCounts(1000)`应该返回21124。
```js
assert.strictEqual(numberLetterCounts(1000), 21124);
```
# --solutions--