FastPrepFind a Word in a Letter Grid
Problems/Find a Word in a Letter Grid

Find a Word in a Letter Grid

Adobe logoAdobe● MediumFULLTIMEINTERNPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The task: can a word be traced through a grid of letters by steps to side neighbours, without using a cell twice?

Two Adobe reports ask for it. The first is from a software intern candidate in New Delhi, India (August 2023, no offer). It names this classic grid task by its usual title. It pairs it with a power-function question and describes a tough interview. The second is from an engineer in Noida with a little over three years of experience (posted August 2022). It has this as the second of two coding questions in Round 1, after a meeting-rooms task. That report states the task in its own words with one worked example on a five-by-six grid, and the answer is true. It allows the four side moves but does not say if a cell can be reused. Its example writes the grid in small letters and the word in capitals.

The rules here are those of the named task: side moves only, and each cell at most once per path. We chose these: boards up to 6 by 6 given as strings, words of 1 to 15 letters, and uppercase letters only so matching is exact. We wrote new examples.

Our version is about 95% the same as the reported questions.

You are given a board of letters as an array of strings board: board[i] is row i, and its j-th character is the letter in column j. You are also given a word.

Return true if the word can be spelled by a path on the board, and false otherwise. A path starts on any cell and, at each step, moves to a cell that shares a side with the current one (up, down, left or right; not diagonally). The letters along the path, in order, must be exactly the letters of word. A cell may be used at most once in the same path.

Function

wordInGrid(board: String[], word: String) → boolean

Examples

Example 1

board = ["STEX","AONB","CKLM"]word = "STONE"return = true
board
01230STEX1AONB2CKLM

Start at S in the top-left corner, step right to T, down to O, right to N and up to E. Each step goes to a side neighbour and no cell is used twice, so the answer is true.

Example 2

board = ["STEX","AONB","CKLM"]word = "NOTES"return = false
board
01230STEX1AONB2CKLM

The letters can be followed as far as E: N, left to O, up to T, right to E. But the only S is in the top-left corner, which does not touch that E, and there is no other N to start from. The answer is false.

Example 3

board = ["AB","CD"]word = "ABDCA"return = false
board
010AB1CD

A, B, D, C go once around the square. The last A would have to be the top-left cell again, and a cell cannot be used twice, so the answer is false.

Constraints

  • 1 <= board.length <= 6
  • 1 <= board[i].length <= 6, and all rows have the same length
  • 1 <= word.length <= 15
  • board and word contain only uppercase English letters

More Adobe Phone Screen questions

  • Evaluate a Parenthesized Integer ExpressionPHONE SCREEN · Seen Oct 2026
  • All Elements of Two BSTs in OrderPHONE SCREEN · Seen Aug 2026
  • Rotate an Array In PlaceOA · PHONE SCREEN · Seen Aug 2026
  • Binary Tree Level-Order Traversal by LevelsPHONE SCREEN · ONSITE INTERVIEW · Seen Aug 2026
  • Count Occurrences in a Sorted ArrayPHONE SCREEN · ONSITE INTERVIEW · Seen Jul 2026
  • Count Pairs with Absolute Difference KPHONE SCREEN · Seen Jul 2026
  • Count Subsets with Sum KPHONE SCREEN · Seen Jul 2026
  • Numbers with Exactly Three DivisorsPHONE SCREEN · Seen Jul 2026
  • Sum of Even Nodes on a Path in a Numbered Binary TreePHONE SCREEN · Seen Jul 2026
  • Largest Value in Every Sliding WindowPHONE SCREEN · Seen Jul 2026

Similar questions at other companies

  • 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 SearchBloomberg LP · OA · PHONE SCREEN · ONSITE INTERVIEWBloomberg LP interview questions
  • Max Area of Island Without Changing the GridFlexport · PHONE SCREENFlexport interview questions
  • Count Islands with Eight-Direction AdjacencyAmazon · PHONE SCREEN
  • Count Islands in a Binary GridApple · PHONE SCREENApple interview questions
  • Pacific Atlantic Water FlowAnduril · PHONE SCREENAnduril interview questions
  • Report Island Areas in Discovery OrderSnap Inc. · PHONE SCREENSnap Inc. interview questions
  • Word SearchCognitiv · PHONE SCREEN

Interview reports that mention this question

  • Adobe SWE Intern Interviews: 27 Experiences (Part 2 of 4)
  • Adobe CS2 and Senior CS Interviews: 6 Experiences (Part 5 of 6)
  • Adobe SDE and Senior SWE Interviews: 9 Experiences (Part 3 of 6)

Adobe interview experiences

  • Adobe Web, QA, DevOps, ML Roles: 13 Experiences (Part 3 of 3)
  • Adobe SWE Interviews, Level Unknown: 25 Experiences (Part 2 of 3)
  • Adobe Interviews, Level Unknown: 38 Experiences (Part 1 of 3)
All Adobe interview questionsSee Adobe hiring insights
Saved
class Solution {
    public boolean wordInGrid(String[] board, String word) {
        // Write your code here.
    }
}
Checking account…