Count Words Formable from Letters
Updated
Problem statement
Split text into maximal English-letter words, ignoring punctuation. Count how many words can be formed from the case-insensitive letter multiset letters, using each supplied occurrence at most once per word.
Function
countFormableWords(text: String, letters: String) → intExamples
Example 1
text = "Hello, hole! world."letters = "helloo"return = 2Hello and hole are formable; world requires unavailable letters.
Example 2
text = "Cat dog"letters = "tac"return = 1Cat is formable case-insensitively, while dog is not.
Constraints
0 <= text.length,letters.length <= 100000
More ZipRecruiter Online Assessment questions
- Four-Level Banking System with Scheduled PaymentsOA · Seen Oct 2026
- Count Three-Digit Numbers with Distinct DigitsOA · Seen Oct 2024
- Longest Frequency-Bounded SubarrayOA · Seen Oct 2024
- Minimum Changes to Draw a YOA · Seen Oct 2024
- Apply Binary State OperationsOA · Seen Sep 2024
- Simulate Orchard Rot SpreadOA · Seen Sep 2024
- Compare Odd- and Even-Index SumsOA · Seen Sep 2024
- Coordinate Removals with Column GravityOA · Seen Sep 2024
- Lexicographically Smallest End ReversalOA · Seen Sep 2024
- Recursively Expanded Shell Command CountsOA · Seen Sep 2024
Similar questions at other companies
- Perfect SubstringAXQ Capital · OA
- Count Suffix Word PairsTikTok · OATikTok interview questions
- Password Clues and the Next CommandOpenAI · OAOpenAI interview questions
- Decode Words with Anagram KeysCresta · OACresta interview questions
- Count One-Swap Number PairsCapital One · OACapital One interview questions
- Parcel Event TrackingAirbnb · OAAirbnb interview questions
- Maximum Valid Substring FrequencyMicrosoft · OAMicrosoft interview questions
- Longest Distinct StringSuperhuman · OASuperhuman interview questions
- Longest String ChainVisa · OAVisa interview questions
- Longest Substring Without Repeating CharactersAkuna Capital · OAAkuna Capital interview questions