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,50 +5,75 @@ challengeType: 5
forumTopicId: 385271
---
## Description
<section id='description'>
The <b>longest common subsequence</b> (or <a href="http://en.wikipedia.org/wiki/Longest_common_subsequence_problem" target="_blank"><b>LCS</b></a>) of groups A and B is the longest group of elements from A and B that are common between the two groups and in the same order in each group. For example, the sequences "1234" and "1224533324" have an LCS of "1234":
<b><u>1234</u></b>
<b><u>12</u></b>245<b><u>3</u></b>332<b><u>4</u></b>
# --description--
The **longest common subsequence** (or [**LCS**](http://en.wikipedia.org/wiki/Longest_common_subsequence_problem)) of groups A and B is the longest group of elements from A and B that are common between the two groups and in the same order in each group. For example, the sequences "1234" and "1224533324" have an LCS of "1234":
***1234***
***12***245***3***332***4***
For a string example, consider the sequences "thisisatest" and "testing123testing". An LCS would be "tsitest":
<b><u>t</u></b>hi<b><u>si</u></b>sa<b><u>test</u></b>
<b><u>t</u></b>e<b><u>s</u></b>t<b><u>i</u></b>ng123<b><u>test</u></b>ing.
***t***hi***si***sa***test***
***t***e***s***t***i***ng123***test***ing.
Your code only needs to deal with strings.
For more information on this problem please see <a href="https://en.wikipedia.org/wiki/Longest_common_subsequence_problem" target="_black">Wikipedia</a>.
</section>
## Instructions
<section id='instructions'>
For more information on this problem please see [Wikipedia](https://en.wikipedia.org/wiki/Longest_common_subsequence_problem).
# --instructions--
Write a case-sensitive function that returns the LCS of two strings. You don't need to show multiple LCS's.
</section>
## Tests
<section id='tests'>
# --hints--
``` yml
tests:
- text: <code>lcs</code> should be a function.
testString: assert(typeof lcs == 'function');
- text: <code>lcs("thisisatest", "testing123testing")</code> should return a string.
testString: assert(typeof lcs("thisisatest", "testing123testing") == 'string');
- text: <code>lcs("thisisatest", "testing123testing")</code> should return <code>"tsitest"</code>.
testString: assert.equal(lcs("thisisatest", "testing123testing"), "tsitest");
- text: <code>lcs("ABCDGH", "AEDFHR")</code> should return <code>"ADH"</code>.
testString: assert.equal(lcs("ABCDGH", "AEDFHR"), "ADH");
- text: <code>lcs("AGGTAB", "GXTXAYB")</code> should return <code>"GTAB"</code>.
testString: assert.equal(lcs("AGGTAB", "GXTXAYB"), "GTAB");
- text: <code>lcs("BDACDB", "BDCB")</code> should return <code>"BDCB"</code>.
testString: assert.equal(lcs("BDACDB", "BDCB"), "BDCB");
- text: <code>lcs("ABAZDC", "BACBAD")</code> should return <code>"ABAD"</code>.
testString: assert.equal(lcs("ABAZDC", "BACBAD"), "ABAD");
`lcs` should be a function.
```js
assert(typeof lcs == 'function');
```
</section>
`lcs("thisisatest", "testing123testing")` should return a string.
## Challenge Seed
<section id='challengeSeed'>
```js
assert(typeof lcs('thisisatest', 'testing123testing') == 'string');
```
<div id='js-seed'>
`lcs("thisisatest", "testing123testing")` should return `"tsitest"`.
```js
assert.equal(lcs('thisisatest', 'testing123testing'), 'tsitest');
```
`lcs("ABCDGH", "AEDFHR")` should return `"ADH"`.
```js
assert.equal(lcs('ABCDGH', 'AEDFHR'), 'ADH');
```
`lcs("AGGTAB", "GXTXAYB")` should return `"GTAB"`.
```js
assert.equal(lcs('AGGTAB', 'GXTXAYB'), 'GTAB');
```
`lcs("BDACDB", "BDCB")` should return `"BDCB"`.
```js
assert.equal(lcs('BDACDB', 'BDCB'), 'BDCB');
```
`lcs("ABAZDC", "BACBAD")` should return `"ABAD"`.
```js
assert.equal(lcs('ABAZDC', 'BACBAD'), 'ABAD');
```
# --seed--
## --seed-contents--
```js
function lcs(a, b) {
@ -56,12 +81,7 @@ function lcs(a, b) {
}
```
</div>
</section>
## Solution
<section id='solution'>
# --solutions--
```js
function lcs(a, b) {
@ -79,5 +99,3 @@ function lcs(a, b) {
}
}
```
</section>