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,54 +1,41 @@
|
||||
---
|
||||
title: Vector cross product
|
||||
id: 594810f028c0303b75339ad2
|
||||
title: Vector cross product
|
||||
challengeType: 5
|
||||
forumTopicId: 302342
|
||||
---
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
# --description--
|
||||
|
||||
A vector is defined as having three dimensions as being represented by an ordered collection of three numbers: (X, Y, Z).
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
<section id='instructions'>
|
||||
# --instructions--
|
||||
|
||||
Write a function that takes two vectors (arrays) as input and computes their cross product. Your function should return <code>null</code> on invalid inputs such as vectors of different lengths.
|
||||
</section>
|
||||
Write a function that takes two vectors (arrays) as input and computes their cross product. Your function should return `null` on invalid inputs such as vectors of different lengths.
|
||||
|
||||
## Tests
|
||||
<section id='tests'>
|
||||
# --hints--
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: dotProduct should be a function.
|
||||
testString: assert.equal(typeof crossProduct, 'function');
|
||||
- text: dotProduct() should return null.
|
||||
testString: assert.equal(crossProduct(), null);
|
||||
- text: crossProduct([1, 2, 3], [4, 5, 6]) should return [-3, 6, -3].
|
||||
testString: assert.deepEqual(res12, exp12);
|
||||
|
||||
```
|
||||
|
||||
</section>
|
||||
|
||||
## Challenge Seed
|
||||
<section id='challengeSeed'>
|
||||
|
||||
<div id='js-seed'>
|
||||
dotProduct should be a function.
|
||||
|
||||
```js
|
||||
function crossProduct(a, b) {
|
||||
|
||||
}
|
||||
assert.equal(typeof crossProduct, 'function');
|
||||
```
|
||||
|
||||
</div>
|
||||
dotProduct() should return null.
|
||||
|
||||
```js
|
||||
assert.equal(crossProduct(), null);
|
||||
```
|
||||
|
||||
### After Test
|
||||
<div id='js-teardown'>
|
||||
crossProduct([1, 2, 3], [4, 5, 6]) should return [-3, 6, -3].
|
||||
|
||||
```js
|
||||
assert.deepEqual(res12, exp12);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
## --after-user-code--
|
||||
|
||||
```js
|
||||
const tv1 = [1, 2, 3];
|
||||
@ -57,13 +44,15 @@ const res12 = crossProduct(tv1, tv2);
|
||||
const exp12 = [-3, 6, -3];
|
||||
```
|
||||
|
||||
</div>
|
||||
## --seed-contents--
|
||||
|
||||
</section>
|
||||
```js
|
||||
function crossProduct(a, b) {
|
||||
|
||||
## Solution
|
||||
<section id='solution'>
|
||||
}
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
||||
```js
|
||||
function crossProduct(a, b) {
|
||||
@ -82,7 +71,4 @@ function crossProduct(a, b) {
|
||||
(a[0] * b[1]) - (a[1] * b[0])
|
||||
];
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
</section>
|
||||
|
Reference in New Issue
Block a user