FastPrepHow Many Sentences?
Problems/How Many Sentences?

How Many Sentences?

Chubb logoChubb● MediumINTERNOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: A community member reported that this exact exercise appeared in a Chubb online assessment on September 8, 2026. The report did not include a separate copy of the prompt. So this version reuses a matching exercise that we had already checked and run. Our version is about 100% the same as the reported exercise. The original Chubb wording was not available.

Special thanks: 🌷 A special thank you to our lovely, amazing frenz who shared that this question appeared again on September 8, 2026! ദ്ദി ˉ͈̀꒳ˉ͈́ )✧ 🩵

Words are anagrams when their characters can be rearranged to match. For each sentence, replace every word independently with any anagram present in wordSet. Return the number of sentences that can be formed.

Function

countSentences(wordSet: String[], sentences: String[]) → long[]

Examples

Example 1

wordSet = ["listen","silent","it","is"]sentences = ["listen it is silent"]return = [4]

Each occurrence of the listen/silent anagram group has two choices, so the product is four.

Constraints

  • 1 <= wordSet.length, sentences.length <= 1000
  • Inputs contain lowercase English words separated by single spaces.
  • Each answer fits in a signed 64-bit integer.

More Chubb Online Assessment questions

  • Count Pairs with K Divisible Values in the IntervalOA · Seen Oct 2026
  • Index of the Maximum After Left RotationsOA · Seen Oct 2026
  • Maximize Revenue from Decreasing InventoryOA · Seen Oct 2026
  • Minimize the Maximum Array ElementOA · Seen Oct 2026
  • Minimum Distinct Prefix CostOA · Seen Oct 2026
  • Flat JSON Value DifferencesOA · Seen Sep 2026
  • Maximum Student-Teacher DistanceOA · Seen Sep 2026
  • Minimum Cost to Reach a Target WeightOA · Seen Sep 2026
  • Minimum Last-Element RelocationsOA · Seen Sep 2026
  • Most Visited Sprint MarkerOA · Seen Sep 2026

Similar questions at other companies

  • Count One-Swap Number PairsCapital One · OA
  • Perfect SubstringsVisa · OA
  • Cheating CodemakerJane Street · OA
  • Count Equal-Frequency SubsequencesExpedia · OA
  • How Many Sentences?Atlassian · OA
  • Count Phrases Formed by Anagram ReplacementWells Fargo · OA
  • Ransom NoteThe Walt Disney Company · OA · PHONE SCREEN
  • Minimum Deletions to Make Every Letter Count EvenMarshall Wace · OA
  • Apply Operations to Make a String EmptyFlexport · PHONE SCREEN
  • Markov Transition Counts and ProbabilitiesRetool · ONSITE INTERVIEW
See Chubb hiring insights
Saved
class Solution {
    public long[] countSentences(String[] wordSet, String[] sentences) {
      // Write your code here.
    }

}
Checking account…