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.
More Google problems
- Deduplicate Logs: Keep FirstONSITE INTERVIEW · Seen Jul 2026
- Deduplicate Logs: Keep LatestONSITE INTERVIEW · Seen Jul 2026
- Find a Template Across Binary-Tree LeavesONSITE INTERVIEW · Seen Jul 2026
- Maximum Programmer-Problem MatchingONSITE INTERVIEW · Seen Jul 2026
- Minimum Direction ViolationsONSITE INTERVIEW · Seen Jul 2026
- Stream Latest Log VersionsONSITE INTERVIEW · Seen Jul 2026
- Stream Unique Logs in Timestamp OrderONSITE INTERVIEW · Seen Jul 2026
- Top-K IP Addresses from File RecordsONSITE INTERVIEW · Seen Jul 2026