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
@ -1,15 +1,14 @@
|
||||
---
|
||||
title: SEDOLs
|
||||
id: 59d9c6bc214c613ba73ff012
|
||||
title: SEDOLs
|
||||
challengeType: 5
|
||||
forumTopicId: 302305
|
||||
---
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
# --description--
|
||||
|
||||
For each number list of 6-digit [SEDOL](https://en.wikipedia.org/wiki/SEDOL "wp: SEDOL")s, calculate and append the checksum digit. That is, given the input string on the left, your function should return the corresponding string on the right:
|
||||
|
||||
For each number list of 6-digit <a href="https://en.wikipedia.org/wiki/SEDOL" title="wp: SEDOL" target="_blank">SEDOL</a>s, calculate and append the checksum digit.
|
||||
That is, given the input string on the left, your function should return the corresponding string on the right:
|
||||
<pre>
|
||||
710889 => 7108899
|
||||
B0YBKJ => B0YBKJ7
|
||||
@ -23,38 +22,44 @@ B0YBKR => B0YBKR5
|
||||
B0YBKT => B0YBKT7
|
||||
B00030 => B000300
|
||||
</pre>
|
||||
Check that each input is correctly formed, especially with respect to valid characters allowed in a SEDOL string. Your function should return <code>null</code> on an invalid input.
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
<section id='instructions'>
|
||||
Check that each input is correctly formed, especially with respect to valid characters allowed in a SEDOL string. Your function should return `null` on an invalid input.
|
||||
|
||||
</section>
|
||||
# --hints--
|
||||
|
||||
## Tests
|
||||
<section id='tests'>
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>sedol</code> should be a function.
|
||||
testString: assert(typeof sedol === 'function');
|
||||
- text: <code>sedol('a')</code> should return null.
|
||||
testString: assert(sedol('a') === null);
|
||||
- text: <code>sedol('710889')</code> should return '7108899'.
|
||||
testString: assert(sedol('710889') === '7108899');
|
||||
- text: <code>sedol('BOATER')</code> should return null.
|
||||
testString: assert(sedol('BOATER') === null);
|
||||
- text: <code>sedol('228276')</code> should return '2282765'.
|
||||
testString: assert(sedol('228276') === '2282765');
|
||||
`sedol` should be a function.
|
||||
|
||||
```js
|
||||
assert(typeof sedol === 'function');
|
||||
```
|
||||
|
||||
</section>
|
||||
`sedol('a')` should return null.
|
||||
|
||||
## Challenge Seed
|
||||
<section id='challengeSeed'>
|
||||
```js
|
||||
assert(sedol('a') === null);
|
||||
```
|
||||
|
||||
<div id='js-seed'>
|
||||
`sedol('710889')` should return '7108899'.
|
||||
|
||||
```js
|
||||
assert(sedol('710889') === '7108899');
|
||||
```
|
||||
|
||||
`sedol('BOATER')` should return null.
|
||||
|
||||
```js
|
||||
assert(sedol('BOATER') === null);
|
||||
```
|
||||
|
||||
`sedol('228276')` should return '2282765'.
|
||||
|
||||
```js
|
||||
assert(sedol('228276') === '2282765');
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function sedol(input) {
|
||||
@ -63,15 +68,7 @@ function sedol(input) {
|
||||
}
|
||||
```
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
## Solution
|
||||
<section id='solution'>
|
||||
|
||||
# --solutions--
|
||||
|
||||
```js
|
||||
function sedol(input) {
|
||||
@ -95,7 +92,4 @@ function sedolCheckDigit(char6) {
|
||||
const check = (10 - (sum % 10)) % 10;
|
||||
return check.toString();
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
</section>
|
||||
|
Reference in New Issue
Block a user