Files
freeCodeCamp/curriculum/challenges/chinese/10-coding-interview-prep/project-euler/problem-158-exploring-strings-for-which-only-one-character-comes-lexicographically-after-its-neighbour-to-the-left.md

56 lines
1.5 KiB
Markdown
Raw Normal View History

---
id: 5900f40a1000cf542c50ff1d
challengeType: 5
videoUrl: ''
2020-10-01 17:54:21 +02:00
title: 问题158探索在其邻居之后只有一个字符按字典顺序出现的字符串
---
## Description
<section id="description">从字母表的26个字母中取三个不同的字母可以形成长度为3的字符串。例如&#39;abc&#39;&#39;hat&#39;&#39;zyx&#39;。当我们研究这三个例子时,我们看到对于&#39;abc&#39;,两个字符在其左边的邻居之后以字典方式出现。对于“帽子”,只有一个字符在其左边的邻居之后按字典顺序排列。对于&#39;zyx&#39;在左边的邻居之后字典上有零个字符。总共有10400个长度为3的字符串其中一个字符在其左边的邻居之后按字典顺序排列。我们现在考虑字母表中n≤26个不同字符的字符串。对于每个npn是长度为n的字符串的数量正好一个字符在其左边的邻居之后按字典顺序排列。 pn的最大值是多少 </section>
## Instructions
<section id="instructions">
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>euler158()</code>应该返回409511334375。
testString: assert.strictEqual(euler158(), 409511334375);
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function euler158() {
// Good luck!
return true;
}
euler158();
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
/section>