FastPrepCheck Each Word in a Character Grid
Problems/Check Each Word in a Character Grid

Check Each Word in a Character Grid

Zillow logoZillow● HardFULLTIMEONSITE INTERVIEW

Updated Dec 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Asked at Zillow in 2018, reported by a candidate for a Software Engineer role in Seattle, Washington, who did not get an offer. The candidate describes a four-hour interview day in which four interviewers met them one after another; every session was long and mostly technical, with a few behavioral questions mixed in. The task was to take a grid of characters and a list of words and decide, for every word, whether it appears in the grid. The report does not say which of the four sessions asked it; since all four sessions were one four-hour loop, we list it as an onsite interview.

The report does not say how a word is traced through the grid or what form the answer takes; those readings are ours. Here a word is spelled along a path of cells that moves up, down, left or right one cell at a time, and no cell is used twice within one word. The function checkWords gets the grid board and the array words and returns one true or false per word, in the order of words. The letters are lowercase English letters, no word appears twice, and the limits are ours as well: 1 to 12 rows and columns, and 1 to 1,000 words of 1 to 10 letters.

Our version is about 80% the same as the reported question.

The grid board has m rows and n columns, and each cell holds one lowercase letter. You also get an array words of different words. For each word, decide whether it appears in the grid.

A word appears in the grid when the letters along some path of cells, read in order, spell it. The path may begin anywhere, and every step moves up, down, left or right by one cell. Within one word, a path may not visit the same cell twice. Each word is checked on its own, so two different words may use the same cells.

Return a boolean array answer of the same length as words, where answer[i] is true if words[i] appears in the grid and false if it cannot.

Function

checkWords(board: char[][], words: String[]) → boolean[]

Examples

Example 1

board = [["c","a","t","s"],["o","r","e","d"],["w","a","l","k"]]words = ["care","rare","cow","stew"]return = [true,false,true,false]
board
01230cats1ored2walk

"care" follows the cells (0, 0), (0, 1), (1, 1), (1, 2): right, down, right. "rare" starts at (1, 1), the only r, and both a cells beside it lead back only to (1, 1), which this word has already used, so it is false. "cow" goes straight down the first column from (0, 0), using (0, 0) again; that is fine because each word is checked on its own. For "stew", the path (0, 3), (0, 2), (1, 2) works, but no w touches (1, 2), so it is false.

Example 2

board = [["a","b"],["c","d"]]words = ["abdc","acdb","ad"]return = [true,true,false]
board
010ab1cd

"abdc" goes right, down, left and "acdb" goes down, right, up, so both are true. In "ad", the letters a and d touch only diagonally, and a diagonal step is not allowed, so "ad" is false.

Example 3

board = [["z"]]words = ["z","zz"]return = [true,false]
board
00z

The board has one cell. "z" uses it once and is true; "zz" would need that cell twice, so it is false.

Constraints

  • m == board.length
  • n == board[i].length
  • 1 <= m, n <= 12
  • board[i][j] is a lowercase English letter.
  • 1 <= words.length <= 1000
  • 1 <= words[i].length <= 10
  • words[i] consists of lowercase English letters.
  • No word appears twice in words.

More Zillow Onsite Interview questions

  • Valid ParenthesesPHONE SCREEN · ONSITE INTERVIEW · Seen Jul 2025
  • Build a Hash TablePHONE SCREEN · ONSITE INTERVIEW · Seen Feb 2023
  • Spiral MatrixPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2022
  • First Subarray with the Largest SumOA · ONSITE INTERVIEW · Seen Aug 2021
  • Count Duplicate CharactersONSITE INTERVIEW · Seen Oct 2020
  • Symmetric TreeONSITE INTERVIEW · Seen Oct 2020
  • Decision Tree Classifier from ScratchONSITE INTERVIEW · Seen Nov 2019
  • Uniform to Normal NumbersONSITE INTERVIEW · Seen Nov 2019
  • Find Median from Data StreamPHONE SCREEN · ONSITE INTERVIEW · Seen Jul 2018
  • Is SubstringONSITE INTERVIEW · Seen Nov 2017

Similar questions at other companies

  • Boggle Word FinderBloomberg LP · ONSITE INTERVIEWBloomberg LP interview questions
  • Word Search IIAmazon · ONSITE INTERVIEW
  • Word Search IIKotak Mahindra Bank · ONSITE INTERVIEWKotak Mahindra Bank interview questions
  • Enumerate Character Paths to a MarkerTesla · ONSITE INTERVIEWTesla interview questions
  • Trace a Word Through a Letter GridExpedia · ONSITE INTERVIEWExpedia interview questions
  • Word Search with Eight-Direction AdjacencyMicrosoft · ONSITE INTERVIEWMicrosoft interview questions
  • Word Search IIApple · PHONE SCREENApple interview questions
  • Find a Word in a Letter GridAdobe · PHONE SCREENAdobe interview questions
  • All Balanced Strings from Minimum Parenthesis InsertionsRubrik · ONSITE INTERVIEWRubrik interview questions
  • Longest Increasing Path in a MatrixNew Relic · PHONE SCREEN · ONSITE INTERVIEW
All Zillow interview questionsSee Zillow hiring insights
Saved
class Solution {
    public boolean[] checkWords(char[][] board, String[] words) {
        // Write your code here.
    }
}
Checking account…