Feat: add new Markdown parser (#39800)
and change all the challenges to new `md` format.
This commit is contained in:
committed by
GitHub
parent
a07f84c8ec
commit
0bd52f8bd1
@ -5,51 +5,77 @@ challengeType: 5
|
||||
forumTopicId: 16037
|
||||
---
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
# --description--
|
||||
|
||||
Return the number of total permutations of the provided string that don't have repeated consecutive letters. Assume that all characters in the provided string are each unique.
|
||||
For example, <code>aab</code> should return 2 because it has 6 total permutations (<code>aab</code>, <code>aab</code>, <code>aba</code>, <code>aba</code>, <code>baa</code>, <code>baa</code>), but only 2 of them (<code>aba</code> and <code>aba</code>) don't have the same letter (in this case <code>a</code>) repeating.
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
<section id='instructions'>
|
||||
For example, `aab` should return 2 because it has 6 total permutations (`aab`, `aab`, `aba`, `aba`, `baa`, `baa`), but only 2 of them (`aba` and `aba`) don't have the same letter (in this case `a`) repeating.
|
||||
|
||||
</section>
|
||||
# --hints--
|
||||
|
||||
## Tests
|
||||
<section id='tests'>
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>permAlone("aab")</code> should return a number.
|
||||
testString: assert.isNumber(permAlone('aab'));
|
||||
- text: <code>permAlone("aab")</code> should return 2.
|
||||
testString: assert.strictEqual(permAlone('aab'), 2);
|
||||
- text: <code>permAlone("aaa")</code> should return 0.
|
||||
testString: assert.strictEqual(permAlone('aaa'), 0);
|
||||
- text: <code>permAlone("aabb")</code> should return 8.
|
||||
testString: assert.strictEqual(permAlone('aabb'), 8);
|
||||
- text: <code>permAlone("abcdefa")</code> should return 3600.
|
||||
testString: assert.strictEqual(permAlone('abcdefa'), 3600);
|
||||
- text: <code>permAlone("abfdefa")</code> should return 2640.
|
||||
testString: assert.strictEqual(permAlone('abfdefa'), 2640);
|
||||
- text: <code>permAlone("zzzzzzzz")</code> should return 0.
|
||||
testString: assert.strictEqual(permAlone('zzzzzzzz'), 0);
|
||||
- text: <code>permAlone("a")</code> should return 1.
|
||||
testString: assert.strictEqual(permAlone('a'), 1);
|
||||
- text: <code>permAlone("aaab")</code> should return 0.
|
||||
testString: assert.strictEqual(permAlone('aaab'), 0);
|
||||
- text: <code>permAlone("aaabb")</code> should return 12.
|
||||
testString: assert.strictEqual(permAlone('aaabb'), 12);
|
||||
`permAlone("aab")` should return a number.
|
||||
|
||||
```js
|
||||
assert.isNumber(permAlone('aab'));
|
||||
```
|
||||
|
||||
</section>
|
||||
`permAlone("aab")` should return 2.
|
||||
|
||||
## Challenge Seed
|
||||
<section id='challengeSeed'>
|
||||
```js
|
||||
assert.strictEqual(permAlone('aab'), 2);
|
||||
```
|
||||
|
||||
<div id='js-seed'>
|
||||
`permAlone("aaa")` should return 0.
|
||||
|
||||
```js
|
||||
assert.strictEqual(permAlone('aaa'), 0);
|
||||
```
|
||||
|
||||
`permAlone("aabb")` should return 8.
|
||||
|
||||
```js
|
||||
assert.strictEqual(permAlone('aabb'), 8);
|
||||
```
|
||||
|
||||
`permAlone("abcdefa")` should return 3600.
|
||||
|
||||
```js
|
||||
assert.strictEqual(permAlone('abcdefa'), 3600);
|
||||
```
|
||||
|
||||
`permAlone("abfdefa")` should return 2640.
|
||||
|
||||
```js
|
||||
assert.strictEqual(permAlone('abfdefa'), 2640);
|
||||
```
|
||||
|
||||
`permAlone("zzzzzzzz")` should return 0.
|
||||
|
||||
```js
|
||||
assert.strictEqual(permAlone('zzzzzzzz'), 0);
|
||||
```
|
||||
|
||||
`permAlone("a")` should return 1.
|
||||
|
||||
```js
|
||||
assert.strictEqual(permAlone('a'), 1);
|
||||
```
|
||||
|
||||
`permAlone("aaab")` should return 0.
|
||||
|
||||
```js
|
||||
assert.strictEqual(permAlone('aaab'), 0);
|
||||
```
|
||||
|
||||
`permAlone("aaabb")` should return 12.
|
||||
|
||||
```js
|
||||
assert.strictEqual(permAlone('aaabb'), 12);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function permAlone(str) {
|
||||
@ -59,15 +85,7 @@ function permAlone(str) {
|
||||
permAlone('aab');
|
||||
```
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
## Solution
|
||||
<section id='solution'>
|
||||
|
||||
# --solutions--
|
||||
|
||||
```js
|
||||
function permAlone(str) {
|
||||
@ -104,7 +122,4 @@ function permuter(str) {
|
||||
}
|
||||
|
||||
permAlone('aab');
|
||||
|
||||
```
|
||||
|
||||
</section>
|
||||
|
Reference in New Issue
Block a user