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

@ -5,52 +5,74 @@ challengeType: 5
forumTopicId: 385277
---
## Description
<section id='description'>
The <a href="https://en.wikipedia.org/wiki/Look and say sequence" target="_blank">Look and say sequence</a> is a recursively defined sequence of numbers.
# --description--
The [Look and say sequence](<https://en.wikipedia.org/wiki/Look and say sequence>) is a recursively defined sequence of numbers.
Sequence Definition
<ul><li>Take a decimal number</li>
<li><span>Look</span> at the number, visually grouping consecutive runs of the same digit.</li>
<li><span>Say</span> the number, from left to right, group by group; as how many of that digit there are - followed by the digit grouped.</li></ul><span> This becomes the next number of the sequence.</span>
<span>An example:</span>
An example:
<ul><li>Starting with the number 1, you have <span>one</span> 1 which produces 11</li>
<li>Starting with 11, you have <span>two</span> 1's. I.E.: 21</li>
<li>Starting with 21, you have <span>one</span> 2, then <span>one</span> 1. I.E.: (12)(11) which becomes 1211</li>
<li>Starting with 1211, you have <span>one</span> 1, <span>one</span> 2, then <span>two</span> 1's. I.E.: (11)(12)(21) which becomes 111221</li></ul>
</section>
## Instructions
<section id='instructions'>
# --instructions--
Write a function that accepts a string as a parameter, processes it, and returns the resultant string.
</section>
## Tests
<section id='tests'>
# --hints--
``` yml
tests:
- text: <code>lookAndSay</code> should be a function.
testString: assert(typeof lookAndSay == 'function');
- text: <code>lookAndSay("1")</code> should return a string.
testString: assert(typeof lookAndSay("1") == 'string');
- text: <code>lookAndSay("1")</code> should return <code>"11"</code>.
testString: assert.equal(lookAndSay("1"), "11");
- text: <code>lookAndSay("11")</code> should return <code>"21"</code>.
testString: assert.equal(lookAndSay("11"), "21");
- text: <code>lookAndSay("21")</code> should return <code>"1211"</code>.
testString: assert.equal(lookAndSay("21"), "1211");
- text: <code>lookAndSay("1211")</code> should return <code>"111221"</code>.
testString: assert.equal(lookAndSay("1211"), "111221");
- text: <code>lookAndSay("3542")</code> should return <code>"13151412"</code>.
testString: assert.equal(lookAndSay("3542"), "13151412");
`lookAndSay` should be a function.
```js
assert(typeof lookAndSay == 'function');
```
</section>
`lookAndSay("1")` should return a string.
## Challenge Seed
<section id='challengeSeed'>
```js
assert(typeof lookAndSay('1') == 'string');
```
<div id='js-seed'>
`lookAndSay("1")` should return `"11"`.
```js
assert.equal(lookAndSay('1'), '11');
```
`lookAndSay("11")` should return `"21"`.
```js
assert.equal(lookAndSay('11'), '21');
```
`lookAndSay("21")` should return `"1211"`.
```js
assert.equal(lookAndSay('21'), '1211');
```
`lookAndSay("1211")` should return `"111221"`.
```js
assert.equal(lookAndSay('1211'), '111221');
```
`lookAndSay("3542")` should return `"13151412"`.
```js
assert.equal(lookAndSay('3542'), '13151412');
```
# --seed--
## --seed-contents--
```js
function lookAndSay(str) {
@ -58,12 +80,7 @@ function lookAndSay(str) {
}
```
</div>
</section>
## Solution
<section id='solution'>
# --solutions--
```js
function lookAndSay(str) {
@ -72,5 +89,3 @@ function lookAndSay(str) {
});
}
```
</section>