chore(learn): Applied MDX format to Chinese curriculum files (#40462)
This commit is contained in:
@ -1,65 +1,33 @@
|
||||
---
|
||||
id: 594d8d0ab97724821379b1e6
|
||||
title: 平均值模式
|
||||
challengeType: 5
|
||||
videoUrl: ''
|
||||
title: 平均值模式
|
||||
---
|
||||
|
||||
## Description
|
||||
<section id="description"><p>编写程序以查找集合的<a href="https://en.wikipedia.org/wiki/Mode (statistics)" title="wp:模式(统计)">模式</a>值。 </p><p>可以忽略集合为空的情况。必须小心处理模式不唯一的情况。 </p><p>如果不适合或不可能支持常规集合,请尽可能使用向量(数组)。如果不适合或不可能支持未指定的值类型,请使用整数。 </p></section>
|
||||
# --description--
|
||||
|
||||
## Instructions
|
||||
<section id="instructions">
|
||||
</section>
|
||||
<p>编写程序以查找集合的<a href='https://en.wikipedia.org/wiki/Mode (statistics)' title='wp:模式(统计)'>模式</a>值。 </p><p>可以忽略集合为空的情况。必须小心处理模式不唯一的情况。 </p><p>如果不适合或不可能支持常规集合,请尽可能使用向量(数组)。如果不适合或不可能支持未指定的值类型,请使用整数。 </p>
|
||||
|
||||
## Tests
|
||||
<section id='tests'>
|
||||
# --hints--
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>mode</code>是一种功能。
|
||||
testString: assert(typeof mode === 'function');
|
||||
- text: '<code>mode([1, 3, 6, 6, 6, 6, 7, 7, 12, 12, 17])</code>应该相等<code>[6]</code>'
|
||||
testString: assert.deepEqual(mode(arr1), [6]);
|
||||
- text: '<code>mode([1, 2, 4, 4, 1])</code>应该等于<code>[1, 4]</code> 。'
|
||||
testString: assert.deepEqual(mode(arr2).sort(), [1, 4]);
|
||||
|
||||
```
|
||||
|
||||
</section>
|
||||
|
||||
## Challenge Seed
|
||||
<section id='challengeSeed'>
|
||||
|
||||
<div id='js-seed'>
|
||||
`mode`是一种功能。
|
||||
|
||||
```js
|
||||
function mode (arr) {
|
||||
// Good luck!
|
||||
return true;
|
||||
}
|
||||
|
||||
assert(typeof mode === 'function');
|
||||
```
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
### After Test
|
||||
<div id='js-teardown'>
|
||||
`mode([1, 3, 6, 6, 6, 6, 7, 7, 12, 12, 17])`应该相等`[6]`
|
||||
|
||||
```js
|
||||
console.info('after the test');
|
||||
assert.deepEqual(mode(arr1), [6]);
|
||||
```
|
||||
|
||||
</div>
|
||||
|
||||
</section>
|
||||
|
||||
## Solution
|
||||
<section id='solution'>
|
||||
`mode([1, 2, 4, 4, 1])`应该等于`[1, 4]` 。
|
||||
|
||||
```js
|
||||
// solution required
|
||||
assert.deepEqual(mode(arr2).sort(), [1, 4]);
|
||||
```
|
||||
|
||||
/section>
|
||||
# --solutions--
|
||||
|
||||
|
Reference in New Issue
Block a user