PracHub
QuestionsPremiumLearningGuidesCheatsheetNEWCareers
|Home/Coding & Algorithms/Google

Check if all substrings are dictionary words

Last updated: Apr 19, 2026

Quick Overview

This question evaluates string-processing skills such as substring enumeration and membership testing against a dictionary, along with algorithmic reasoning about correctness and complexity.

  • medium
  • Google
  • Coding & Algorithms
  • Software Engineer

Check if all substrings are dictionary words

Company: Google

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Technical Screen

You are given a string `s` (letters only) and access to an English dictionary `dict` (a set of valid words). Return `true` if **every contiguous substring** of `s` with length **>= 3** is a valid dictionary word (i.e., for all `i, j` with `0 <= i <= j < n` and `j - i + 1 >= 3`, `s[i..j] ∈ dict`). Otherwise return `false`. Clarifications: - Substring means **contiguous**. - You may assume dictionary lookups are available (e.g., `dict.contains(word)`), or you can preprocess the dictionary. Example: - If `s = "cats"`, you must check `"cat"`, `"ats"`, and `"cats"` (and any other substrings of length >= 3).

Quick Answer: This question evaluates string-processing skills such as substring enumeration and membership testing against a dictionary, along with algorithmic reasoning about correctness and complexity.

Related Interview Questions

  • Compute Turnstile Crossing Times - Google (hard)
  • Simulate In-Place Cellular State Updates - Google (hard)
  • Determine Whether a Word Exists in a Graph - Google (medium)
  • Solve Shortest Paths and Rental Allocation - Google (medium)
  • Solve Two Array Optimization Problems - Google (medium)
Google logo
Google
Mar 11, 2026, 12:00 AM
Software Engineer
Technical Screen
Coding & Algorithms
31
0
Coding Console

You are given a string s (letters only) and access to an English dictionary dict (a set of valid words).

Return true if every contiguous substring of s with length >= 3 is a valid dictionary word (i.e., for all i, j with 0 <= i <= j < n and j - i + 1 >= 3, s[i..j] ∈ dict). Otherwise return false.

Clarifications:

  • Substring means contiguous .
  • You may assume dictionary lookups are available (e.g., dict.contains(word) ), or you can preprocess the dictionary.

Example:

  • If s = "cats" , you must check "cat" , "ats" , and "cats" (and any other substrings of length >= 3).

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Google•More Software Engineer•Google Software Engineer•Google Coding & Algorithms•Software Engineer Coding & Algorithms
PracHub

Master your tech interviews with 7,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • Careers
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.