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,49 +5,102 @@ challengeType: 5
|
||||
forumTopicId: 302326
|
||||
---
|
||||
|
||||
## Description
|
||||
|
||||
<section id='description'>
|
||||
# --description--
|
||||
|
||||
Write a function that takes multiple sorted arrays of items, and returns one array of sorted items.
|
||||
|
||||
</section>
|
||||
# --hints--
|
||||
|
||||
## Instructions
|
||||
`mergeLists` should be a function.
|
||||
|
||||
<section id='instructions'>
|
||||
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
|
||||
<section id='tests'>
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>mergeLists</code> should be a function.
|
||||
testString: assert(typeof mergeLists == 'function');
|
||||
- text: <code>mergeLists([[1, 3, 5, 9, 10], [2, 4, 6, 7, 8]])</code> should return an array.
|
||||
testString: assert(Array.isArray(mergeLists([[1, 3, 5, 9, 10], [2, 4, 6, 7, 8]])));
|
||||
- text: <code>mergeLists([[1, 3, 5, 9, 10], [2, 4, 6, 7, 8]])</code> should return <code>[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]</code>.
|
||||
testString: assert.deepEqual(mergeLists([[1, 3, 5, 9, 10], [2, 4, 6, 7, 8]]), [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
|
||||
- text: <code>mergeLists([[1, 4, 7, 10], [2, 5, 8, 11], [3, 6, 9, 12]])</code> should return <code>[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]</code>.
|
||||
testString: assert.deepEqual(mergeLists([[1, 4, 7, 10], [2, 5, 8, 11], [3, 6, 9, 12]]), [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]);
|
||||
- text: <code>mergeLists([[1, 3, 9, 14, 15, 17, 28], [7, 8, 14, 14, 23, 26, 28, 29, 30], [9, 23, 25, 29]])</code> should return <code>[1, 3, 7, 8, 9, 9, 14, 14, 14, 15, 17, 23, 23, 25, 26, 28, 28, 29, 29, 30]</code>.
|
||||
testString: assert.deepEqual(mergeLists([[1, 3, 9, 14, 15, 17, 28], [7, 8, 14, 14, 23, 26, 28, 29, 30], [9, 23, 25, 29]]), [1, 3, 7, 8, 9, 9, 14, 14, 14, 15, 17, 23, 23, 25, 26, 28, 28, 29, 29, 30]);
|
||||
- text: <code>mergeLists([[3, 14, 15], [2, 17, 18], [], [2, 3, 5, 7]])</code> should return <code>[2, 2, 3, 3, 5, 7, 14, 15, 17, 18]</code>.
|
||||
testString: assert.deepEqual(mergeLists([[3, 14, 15], [2, 17, 18], [], [2, 3, 5, 7]]), [2, 2, 3, 3, 5, 7, 14, 15, 17, 18]);
|
||||
- text: <code>mergeLists([[1, 19, 1999], [17, 33, 2999, 3000], [8, 500, 3999]])</code> should return <code>[1, 8, 17, 19, 33, 500, 1999, 2999, 3000, 3999]</code>.
|
||||
testString: assert.deepEqual(mergeLists([[1, 19, 1999], [17, 33, 2999, 3000], [8, 500, 3999]]), [1, 8, 17, 19, 33, 500, 1999, 2999, 3000, 3999]);
|
||||
```js
|
||||
assert(typeof mergeLists == 'function');
|
||||
```
|
||||
|
||||
</section>
|
||||
`mergeLists([[1, 3, 5, 9, 10], [2, 4, 6, 7, 8]])` should return an array.
|
||||
|
||||
## Challenge Seed
|
||||
```js
|
||||
assert(
|
||||
Array.isArray(
|
||||
mergeLists([
|
||||
[1, 3, 5, 9, 10],
|
||||
[2, 4, 6, 7, 8]
|
||||
])
|
||||
)
|
||||
);
|
||||
```
|
||||
|
||||
<section id='challengeSeed'>
|
||||
`mergeLists([[1, 3, 5, 9, 10], [2, 4, 6, 7, 8]])` should return `[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]`.
|
||||
|
||||
<div id='js-seed'>
|
||||
```js
|
||||
assert.deepEqual(
|
||||
mergeLists([
|
||||
[1, 3, 5, 9, 10],
|
||||
[2, 4, 6, 7, 8]
|
||||
]),
|
||||
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
|
||||
);
|
||||
```
|
||||
|
||||
`mergeLists([[1, 4, 7, 10], [2, 5, 8, 11], [3, 6, 9, 12]])` should return `[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]`.
|
||||
|
||||
```js
|
||||
assert.deepEqual(
|
||||
mergeLists([
|
||||
[1, 4, 7, 10],
|
||||
[2, 5, 8, 11],
|
||||
[3, 6, 9, 12]
|
||||
]),
|
||||
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
|
||||
);
|
||||
```
|
||||
|
||||
`mergeLists([[1, 3, 9, 14, 15, 17, 28], [7, 8, 14, 14, 23, 26, 28, 29, 30], [9, 23, 25, 29]])` should return `[1, 3, 7, 8, 9, 9, 14, 14, 14, 15, 17, 23, 23, 25, 26, 28, 28, 29, 29, 30]`.
|
||||
|
||||
```js
|
||||
assert.deepEqual(
|
||||
mergeLists([
|
||||
[1, 3, 9, 14, 15, 17, 28],
|
||||
[7, 8, 14, 14, 23, 26, 28, 29, 30],
|
||||
[9, 23, 25, 29]
|
||||
]),
|
||||
[1, 3, 7, 8, 9, 9, 14, 14, 14, 15, 17, 23, 23, 25, 26, 28, 28, 29, 29, 30]
|
||||
);
|
||||
```
|
||||
|
||||
`mergeLists([[3, 14, 15], [2, 17, 18], [], [2, 3, 5, 7]])` should return `[2, 2, 3, 3, 5, 7, 14, 15, 17, 18]`.
|
||||
|
||||
```js
|
||||
assert.deepEqual(mergeLists([[3, 14, 15], [2, 17, 18], [], [2, 3, 5, 7]]), [
|
||||
2,
|
||||
2,
|
||||
3,
|
||||
3,
|
||||
5,
|
||||
7,
|
||||
14,
|
||||
15,
|
||||
17,
|
||||
18
|
||||
]);
|
||||
```
|
||||
|
||||
`mergeLists([[1, 19, 1999], [17, 33, 2999, 3000], [8, 500, 3999]])` should return `[1, 8, 17, 19, 33, 500, 1999, 2999, 3000, 3999]`.
|
||||
|
||||
```js
|
||||
assert.deepEqual(
|
||||
mergeLists([
|
||||
[1, 19, 1999],
|
||||
[17, 33, 2999, 3000],
|
||||
[8, 500, 3999]
|
||||
]),
|
||||
[1, 8, 17, 19, 33, 500, 1999, 2999, 3000, 3999]
|
||||
);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function mergeLists(lists) {
|
||||
@ -55,12 +108,7 @@ function mergeLists(lists) {
|
||||
}
|
||||
```
|
||||
|
||||
</div>
|
||||
</section>
|
||||
|
||||
## Solution
|
||||
|
||||
<section id='solution'>
|
||||
# --solutions--
|
||||
|
||||
```js
|
||||
function mergeLists(lists) {
|
||||
@ -89,5 +137,3 @@ function mergeLists(lists) {
|
||||
return result;
|
||||
}
|
||||
```
|
||||
|
||||
</section>
|
||||
|
Reference in New Issue
Block a user