FastPrepCount Element Symbol Decompositions
Problems/Count Element Symbol Decompositions

Count Element Symbol Decompositions

Google logoGoogle● MediumFULLTIMEPHONE SCREEN
QuestionFunctionExamples

Problem 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) → int

Examples

Example 1

symbols = ["P", "H", "Y", "S", "I", "C", "Si", "Cs"]word = "Physics"return = 4

The 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

  • Apartment Housemate PreferencesPHONE SCREEN · Seen Nov 2026
  • Price at Query TimestampsPHONE SCREEN · Seen Nov 2026
  • 0/1 Knapsack with Weight and Volume LimitsONSITE INTERVIEW · Seen Nov 2026
All Google interview questionsSee Google hiring insights
Saved
class Solution {
    public int countElementSymbolDecompositions(String[] symbols, String word) {
      // Write your code here.
    }
}
Checking account…