Problem · String
Count Element Symbol Decompositions
Learn this problemProblem statement
Given a collection of chemical element symbols symbols and a word word, return the number of ways to split the entire word into a sequence of the supplied symbols.
Symbol matching is case-insensitive.
Function
countElementSymbolDecompositions(symbols: String[], word: String) → intExamples
Example 1
symbols = ["P", "H", "Y", "S", "I", "C", "Si", "Cs"]word = "Physics"return = 4The four decompositions are P-H-Y-Si-C-S, P-H-Y-Si-Cs, P-H-Y-S-I-C-S, and P-H-Y-S-I-Cs.