feat(curriculum): restore seed + solution to Chinese (#40683)
* feat(tools): add seed/solution restore script * chore(curriculum): remove empty sections' markers * chore(curriculum): add seed + solution to Chinese * chore: remove old formatter * fix: update getChallenges parse translated challenges separately, without reference to the source * chore(curriculum): add dashedName to English * chore(curriculum): add dashedName to Chinese * refactor: remove unused challenge property 'name' * fix: relax dashedName requirement * fix: stray tag Remove stray `pre` tag from challenge file. Signed-off-by: nhcarrigan <nhcarrigan@gmail.com> Co-authored-by: nhcarrigan <nhcarrigan@gmail.com>
This commit is contained in:
committed by
GitHub
parent
0095583028
commit
ee1e8abd87
@ -3,6 +3,7 @@ id: 594dc6c729e5700999302b45
|
||||
title: 平衡括号
|
||||
challengeType: 5
|
||||
videoUrl: ''
|
||||
dashedName: balanced-brackets
|
||||
---
|
||||
|
||||
# --description--
|
||||
@ -125,5 +126,53 @@ assert(!isBalanced(testCases[16]));
|
||||
assert(isBalanced(testCases[17]));
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
## --after-user-code--
|
||||
|
||||
```js
|
||||
const testCases = [
|
||||
'[]',
|
||||
']][[[][][][]][',
|
||||
'[][[[[][][[[]]]]]]',
|
||||
'][',
|
||||
'[[[]]]][[]',
|
||||
'][[]',
|
||||
'][[][]][[[]]',
|
||||
'[[][]]][',
|
||||
'[[[]]][[]]]][][[',
|
||||
'[]][[]]][[[[][]]',
|
||||
'][]][[][',
|
||||
'[[]][[][]]',
|
||||
'[[]]',
|
||||
']][]][[]][[[',
|
||||
'][]][][[',
|
||||
'][][',
|
||||
'[]]]',
|
||||
''
|
||||
];
|
||||
```
|
||||
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function isBalanced(str) {
|
||||
|
||||
return true;
|
||||
}
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
||||
```js
|
||||
function isBalanced(str) {
|
||||
if (str === '') return true;
|
||||
let a = str;
|
||||
let b;
|
||||
do {
|
||||
b = a;
|
||||
a = a.replace(/\[\]/g, '');
|
||||
} while (a !== b);
|
||||
return !a;
|
||||
}
|
||||
```
|
||||
|
Reference in New Issue
Block a user