Another update from ingydotnet^djgoku
This commit is contained in:
parent
91df62d461
commit
948b86eafa
7604 changed files with 108452 additions and 22726 deletions
|
|
@ -1,32 +0,0 @@
|
|||
let characters = "BO XK DQ CP NA GT RE TG QD FS JW HU VI AN OB ER FS LY PC ZM";
|
||||
let blocks = characters.split(" ").map(pair => pair.split(""));
|
||||
|
||||
function isWordPossible(word) {
|
||||
var letters = [...word.toUpperCase()];
|
||||
var length = letters.length;
|
||||
var copy = new Set(blocks);
|
||||
|
||||
for (let letter of letters) {
|
||||
for (let block of copy) {
|
||||
let index = block.indexOf(letter);
|
||||
|
||||
if (index !== -1) {
|
||||
length--;
|
||||
copy.delete(block);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return !length;
|
||||
}
|
||||
|
||||
[
|
||||
"A",
|
||||
"BARK",
|
||||
"BOOK",
|
||||
"TREAT",
|
||||
"COMMON",
|
||||
"SQUAD",
|
||||
"CONFUSE"
|
||||
].forEach(word => console.log(`${word}: ${isWordPossible(word)}`));
|
||||
Loading…
Add table
Add a link
Reference in a new issue