2.7 KiB
2.7 KiB
title | id | challengeType | videoUrl | localeTitle |
---|---|---|---|---|
ABC Problem | 594810f028c0303b75339acc | 5 | ABC问题 |
Description
您将获得ABC块的集合(例如,童年字母块)。每个街区有20个街区,两个字母。块的所有侧面都保证有完整的字母表。块的样本集合:
(BO)
(XK)
(DQ)
(CP)
(NA)
(GT)
(回覆)
(TG)
(QD)
(FS)
(JW)
(HU)
(VI)
(一个)
(OB)
(ER)
(FS)
(LY)
(PC)
(ZM)
要记住一些规则:
一旦使用了块上的字母,就不能再使用该块。该函数应该不区分大小写。实现一个带字符串(单词)的函数,并确定该单词是否可以与给定的块集合拼写。
Instructions
Tests
tests:
- text: <code>canMakeWord</code>是一个功能。
testString: 'assert(typeof canMakeWord === "function", "<code>canMakeWord</code> is a function.");'
- text: <code>canMakeWord</code>应该返回一个布尔值。
testString: 'assert(typeof canMakeWord("hi") === "boolean", "<code>canMakeWord</code> should return a boolean.");'
- text: <code>canMakeWord("bark")</code>应该返回true。
testString: 'assert(canMakeWord(words[0]), "<code>canMakeWord("bark")</code> should return true.");'
- text: <code>canMakeWord("BooK")</code>应该返回false。
testString: 'assert(!canMakeWord(words[1]), "<code>canMakeWord("BooK")</code> should return false.");'
- text: <code>canMakeWord("TReAT")</code>应该返回true。
testString: 'assert(canMakeWord(words[2]), "<code>canMakeWord("TReAT")</code> should return true.");'
- text: <code>canMakeWord("COMMON")</code>应返回false。
testString: 'assert(!canMakeWord(words[3]), "<code>canMakeWord("COMMON")</code> should return false.");'
- text: <code>canMakeWord("squAD")</code>应该返回true。
testString: 'assert(canMakeWord(words[4]), "<code>canMakeWord("squAD")</code> should return true.");'
- text: <code>canMakeWord("conFUSE")</code>应该返回true。
testString: 'assert(canMakeWord(words[5]), "<code>canMakeWord("conFUSE")</code> should return true.");'
Challenge Seed
function canMakeWord (word) {
// Good luck!
}
After Test
console.info('after the test');
Solution
// solution required