freeCodeCamp/curriculum/challenges/chinese/08-coding-interview-prep/rosetta-code/abc-problem.chinese.md

2.7 KiB
Raw Blame History

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(&quot;bark&quot;)</code>应该返回true。
    testString: 'assert(canMakeWord(words[0]), "<code>canMakeWord("bark")</code> should return true.");'
  - text: <code>canMakeWord(&quot;BooK&quot;)</code>应该返回false。
    testString: 'assert(!canMakeWord(words[1]), "<code>canMakeWord("BooK")</code> should return false.");'
  - text: <code>canMakeWord(&quot;TReAT&quot;)</code>应该返回true。
    testString: 'assert(canMakeWord(words[2]), "<code>canMakeWord("TReAT")</code> should return true.");'
  - text: <code>canMakeWord(&quot;COMMON&quot;)</code>应返回false。
    testString: 'assert(!canMakeWord(words[3]), "<code>canMakeWord("COMMON")</code> should return false.");'
  - text: <code>canMakeWord(&quot;squAD&quot;)</code>应该返回true。
    testString: 'assert(canMakeWord(words[4]), "<code>canMakeWord("squAD")</code> should return true.");'
  - text: <code>canMakeWord(&quot;conFUSE&quot;)</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