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,55 +5,79 @@ challengeType: 5
|
||||
forumTopicId: 302241
|
||||
---
|
||||
|
||||
## Description
|
||||
# --description--
|
||||
|
||||
<section id='description'>
|
||||
A **CUSIP** is a nine-character alphanumeric code that identifies a North American financial security for the purposes of facilitating clearing and settlement of trades. The CUSIP was adopted as an American National Standard under Accredited Standards X9.6.
|
||||
|
||||
A <b>CUSIP</b> is a nine-character alphanumeric code that identifies a North American financial security for the purposes of facilitating clearing and settlement of trades. The CUSIP was adopted as an American National Standard under Accredited Standards X9.6.
|
||||
# --instructions--
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
|
||||
<section id='instructions'>
|
||||
Write a function that takes a string as a parameter and checks if the string is valid CUSIP.
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
# --hints--
|
||||
|
||||
<section id='tests'>
|
||||
`isCusip` should be a function.
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>isCusip</code> should be a function.
|
||||
testString: assert(typeof isCusip == 'function');
|
||||
- text: <code>isCusip("037833100")</code> should return a boolean.
|
||||
testString: assert(typeof isCusip("037833100") == 'boolean');
|
||||
- text: <code>isCusip("037833100")</code> should return <code>true</code>.
|
||||
testString: assert.equal(isCusip("037833100"), true);
|
||||
- text: <code>isCusip("17275R102")</code> should return <code>true</code>.
|
||||
testString: assert.equal(isCusip("17275R102"), true);
|
||||
- text: <code>isCusip("38259P50a")</code> should return <code>false</code>.
|
||||
testString: assert.equal(isCusip("38259P50a"), false);
|
||||
- text: <code>isCusip("38259P508")</code> should return <code>true</code>.
|
||||
testString: assert.equal(isCusip("38259P508"), true);
|
||||
- text: <code>isCusip("38259P50#")</code> should return <code>false</code>.
|
||||
testString: assert.equal(isCusip("38259P50#"), false);
|
||||
- text: <code>isCusip("68389X105")</code> should return <code>true</code>.
|
||||
testString: assert.equal(isCusip("68389X105"), true);
|
||||
- text: <code>isCusip("68389X106")</code> should return <code>false</code>.
|
||||
testString: assert.equal(isCusip("68389X106"), false);
|
||||
- text: <code>isCusip("5949181")</code> should return <code>false</code>.
|
||||
testString: assert.equal(isCusip("5949181"), false);
|
||||
```js
|
||||
assert(typeof isCusip == 'function');
|
||||
```
|
||||
|
||||
</section>
|
||||
`isCusip("037833100")` should return a boolean.
|
||||
|
||||
## Challenge Seed
|
||||
```js
|
||||
assert(typeof isCusip('037833100') == 'boolean');
|
||||
```
|
||||
|
||||
<section id='challengeSeed'>
|
||||
`isCusip("037833100")` should return `true`.
|
||||
|
||||
<div id='js-seed'>
|
||||
```js
|
||||
assert.equal(isCusip('037833100'), true);
|
||||
```
|
||||
|
||||
`isCusip("17275R102")` should return `true`.
|
||||
|
||||
```js
|
||||
assert.equal(isCusip('17275R102'), true);
|
||||
```
|
||||
|
||||
`isCusip("38259P50a")` should return `false`.
|
||||
|
||||
```js
|
||||
assert.equal(isCusip('38259P50a'), false);
|
||||
```
|
||||
|
||||
`isCusip("38259P508")` should return `true`.
|
||||
|
||||
```js
|
||||
assert.equal(isCusip('38259P508'), true);
|
||||
```
|
||||
|
||||
`isCusip("38259P50#")` should return `false`.
|
||||
|
||||
```js
|
||||
assert.equal(isCusip('38259P50#'), false);
|
||||
```
|
||||
|
||||
`isCusip("68389X105")` should return `true`.
|
||||
|
||||
```js
|
||||
assert.equal(isCusip('68389X105'), true);
|
||||
```
|
||||
|
||||
`isCusip("68389X106")` should return `false`.
|
||||
|
||||
```js
|
||||
assert.equal(isCusip('68389X106'), false);
|
||||
```
|
||||
|
||||
`isCusip("5949181")` should return `false`.
|
||||
|
||||
```js
|
||||
assert.equal(isCusip('5949181'), false);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function isCusip(s) {
|
||||
@ -61,12 +85,7 @@ function isCusip(s) {
|
||||
}
|
||||
```
|
||||
|
||||
</div>
|
||||
</section>
|
||||
|
||||
## Solution
|
||||
|
||||
<section id='solution'>
|
||||
# --solutions--
|
||||
|
||||
```js
|
||||
function isCusip(s) {
|
||||
@ -96,5 +115,3 @@ function isCusip(s) {
|
||||
return s.charCodeAt(8) - 48 == (10 - (sum % 10)) % 10;
|
||||
}
|
||||
```
|
||||
|
||||
</section>
|
||||
|
Reference in New Issue
Block a user