The TransCompilator

Solved LeetCode program · 868 of 1,000

#1178 · Number of Valid Words for Each Puzzle

Hard Array chunk-18.md

Original English source

Keep a shared wordmasks holding 1, 262145, 2067, 17303811, 524293, 671749, and 262165. Keep a shared puzzlemasks holding 52445203, 50479115, 1837075, 50741251, 34471957, and 63176769. Keep a shared firstbits holding 1, 1, 1, 1, 1, and 64. Keep a shared counts as an empty list of whole numbers. Keep a shared count of 0.
To judge from puzzle (a whole number) with word (a whole number). If word is more than 6, Place count into counts, return. The pmask is item puzzle of puzzlemasks. The pfirst is item puzzle of firstbits. The wmask is item word of wordmasks. The firstok is bitwise and of wmask and pfirst. The subset is bitwise and of wmask and pmask. If firstok is not 0 and subset is wmask, add 1 to count. Judge from puzzle with word plus 1.

For every puzzle from 0 to 5.
Set count to 0. Judge from puzzle with 0.

For each entry in counts, show entry.

Open in Playground Browse all 1,000 problems

Expected stdout

1
1
3
2
4
0