Feat: add new Markdown parser (#39800)

and change all the challenges to new `md` format.
This commit is contained in:
Oliver Eyton-Williams
2020-11-27 19:02:05 +01:00
committed by GitHub
parent a07f84c8ec
commit 0bd52f8bd1
2580 changed files with 113436 additions and 111979 deletions

View File

@ -1,42 +1,48 @@
---
title: Averages/Mode
id: 594d8d0ab97724821379b1e6
title: Averages/Mode
challengeType: 5
forumTopicId: 302226
---
## Description
<section id='description'>
Write a program to find the <a href='https://en.wikipedia.org/wiki/Mode (statistics)' title='wp: Mode (statistics)' target='_blank'>mode</a> value of a collection.
# --description--
Write a program to find the [mode](<https://en.wikipedia.org/wiki/Mode (statistics)> "wp: Mode (statistics)") value of a collection.
The case where the collection is empty may be ignored. Care must be taken to handle the case where the mode is non-unique.
If it is not appropriate or possible to support a general collection, use a vector (array), if possible. If it is not appropriate or possible to support an unspecified value type, use integers.
</section>
## Instructions
<section id='instructions'>
# --hints--
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>mode</code> should be a function.
testString: assert(typeof mode === 'function');
- text: <code>mode([1, 3, 6, 6, 6, 6, 7, 7, 12, 12, 17])</code> should equal <code>[6]</code>
testString: assert.deepEqual(mode(arr1), [6]);
- text: <code>mode([1, 2, 4, 4, 1])</code> should equal <code>[1, 4]</code>.
testString: assert.deepEqual(mode(arr2).sort(), [1, 4]);
`mode` should be a function.
```js
assert(typeof mode === 'function');
```
</section>
`mode([1, 3, 6, 6, 6, 6, 7, 7, 12, 12, 17])` should equal `[6]`
## Challenge Seed
<section id='challengeSeed'>
```js
assert.deepEqual(mode(arr1), [6]);
```
<div id='js-seed'>
`mode([1, 2, 4, 4, 1])` should equal `[1, 4]`.
```js
assert.deepEqual(mode(arr2).sort(), [1, 4]);
```
# --seed--
## --after-user-code--
```js
const arr1 = [1, 3, 6, 6, 6, 6, 7, 7, 12, 12, 17];
const arr2 = [1, 2, 4, 4, 1];
```
## --seed-contents--
```js
function mode(arr) {
@ -45,24 +51,7 @@ function mode(arr) {
}
```
</div>
### After Test
<div id='js-teardown'>
```js
const arr1 = [1, 3, 6, 6, 6, 6, 7, 7, 12, 12, 17];
const arr2 = [1, 2, 4, 4, 1];
```
</div>
</section>
## Solution
<section id='solution'>
# --solutions--
```js
function mode(arr) {
@ -86,7 +75,4 @@ function mode(arr) {
});
return result;
}
```
</section>