freeCodeCamp/curriculum/challenges/chinese/08-coding-interview-prep/project-euler/problem-158-exploring-strin...

56 lines
1.6 KiB
Markdown
Raw Normal View History

---
id: 5900f40a1000cf542c50ff1d
challengeType: 5
title: 'Problem 158: Exploring strings for which only one character comes lexicographically after its neighbour to the left'
videoUrl: ''
localeTitle: 问题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, "<code>euler158()</code> should return 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>