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,44 +1,52 @@
---
title: Babbage problem
id: 594db4d0dedb4c06a2a4cefd
title: Babbage problem
challengeType: 5
forumTopicId: 302229
---
## Description
<section id='description'>
<a href="https://en.wikipedia.org/wiki/Charles_Babbage" title="wp: Charles_Babbage" target='_blank'>Charles Babbage</a>, looking ahead to the sorts of problems his Analytical Engine would be able to solve, gave this example:
# --description--
[Charles Babbage](https://en.wikipedia.org/wiki/Charles_Babbage "wp: Charles_Babbage"), looking ahead to the sorts of problems his Analytical Engine would be able to solve, gave this example:
<blockquote>
What is the smallest positive integer whose square ends in the digits 269,696?
<footer style="margin-left: 2em;">Babbage, letter to Lord Bowden, 1837; see Hollingdale and Tootill, <i>Electronic Computers</i>, second edition, 1970, p. 125.</footer>
<footer style='margin-left: 2em;'>Babbage, letter to Lord Bowden, 1837; see Hollingdale and Tootill, <i>Electronic Computers</i>, second edition, 1970, p. 125.</footer>
</blockquote>
He thought the answer might be 99,736, whose square is 9,947,269,696; but he couldn't be certain.
The task is to find out if Babbage had the right answer.
</section>
## Instructions
<section id='instructions'>
# --instructions--
Implement a function to return the lowest integer that satisfies the Babbage problem. If Babbage was right, return Babbage's number.
</section>
## Tests
<section id='tests'>
# --hints--
```yml
tests:
- text: <code>babbage</code> should be a function.
testString: assert(typeof babbage === 'function');
- text: <code>babbage(99736, 269696)</code> should not return 99736 (there is a smaller answer).
testString: assert.equal(babbage(babbageAns, endDigits), answer);
`babbage` should be a function.
```js
assert(typeof babbage === 'function');
```
</section>
`babbage(99736, 269696)` should not return 99736 (there is a smaller answer).
## Challenge Seed
<section id='challengeSeed'>
```js
assert.equal(babbage(babbageAns, endDigits), answer);
```
<div id='js-seed'>
# --seed--
## --after-user-code--
```js
const babbageAns = 99736;
const endDigits = 269696;
const answer = 25264;
```
## --seed-contents--
```js
function babbage(babbageNum, endDigits) {
@ -47,25 +55,7 @@ function babbage(babbageNum, endDigits) {
}
```
</div>
### After Test
<div id='js-teardown'>
```js
const babbageAns = 99736;
const endDigits = 269696;
const answer = 25264;
```
</div>
</section>
## Solution
<section id='solution'>
# --solutions--
```js
function babbage(babbageAns, endDigits) {
@ -84,7 +74,4 @@ function babbage(babbageAns, endDigits) {
return answer;
}
```
</section>