FastPrepFind a Word in Eight Straight Directions
Problems/Find a Word in Eight Straight Directions

Find a Word in Eight Straight Directions

Intuit logoIntuit● MediumINTERNOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in an Intuit intern online assessment. The report links the well-known straight-line grid search in eight directions. We chose these parts of the interface: the input is rows of strings, the order of coordinates, and how duplicate starts work. Our version is about 98% the same as the reported question.

You are given a rectangular grid of letters and a word. Find each starting cell from which word can be read in a straight line in any of the eight directions: horizontal, vertical, or diagonal. Pick one direction and keep it for the whole word. No turns and no wrapping around the edges are allowed. Return every matching zero-based [row,column] once, sorted by row and then by column, even if several directions match from the same start.

Function

findWord(grid: String[], word: String) → int[][]

Examples

Example 1

grid = ["ABC","DEF","GHI"]word = "AEI"return = [[0,0]]
grid
0120ABC1DEF2GHI
→
return
01000

Start at the top-left cell and go down and to the right. The letters on the way spell the word, so that cell is the only start.

Example 2

grid = ["AAA","AAA"]word = "AA"return = [[0,0],[0,1],[0,2],[1,0],[1,1],[1,2]]
grid
0120AAA1AAA
→
return
01000101202310411512

Every cell holds the same letter and the word has two letters, so every cell has at least one direction that fits. Each cell is listed only once, even when several directions work. All six cells are returned.

Constraints

  • The grid is not empty and is rectangular, at most 50 by 50, and 1 <= word.length <= 20.
  • grid is an array of strings of equal length, with uppercase ASCII letters. Matching is case-sensitive.

More Intuit Online Assessment questions

  • Employee Promotion OpportunitiesOA · Seen Oct 2026
  • Next Pascal Row CoefficientOA · Seen Oct 2026
  • Parse Router LogsOA · Seen Oct 2026
  • Longest Repeated Letter Block with Adjacent SwapsOA · Seen Oct 2026
  • Maximum Square-Free DivisorOA · Seen Oct 2026
  • Two Tribes from Taller-Person CountsOA · Seen Oct 2026
  • Shortest Path from an Encoded GraphOA · Seen Sep 2026
  • Oldest and Youngest EmployeesOA · Seen Sep 2026
  • Pressure-Isolation Shutdown OrderOA · Seen Sep 2026
  • Submask Sum QueriesOA · Seen Sep 2026

Similar questions at other companies

  • Repair One Movement InstructionOpenAI · OAOpenAI interview questions
  • Count Straight-Line Word Occurrences in a GridOptiver · OAOptiver interview questions
  • Count Straight-Line Word Occurrences in a GridVisa · OAVisa interview questions
  • Count Grid Words with One TurnCapital One · OACapital One interview questions
  • Count Right-or-Down Word Paths with One TurnZipRecruiter · OAZipRecruiter interview questions
  • Flip Rows and Columns, Count ZerosNutanix · OANutanix interview questions
  • Hidden ArtifactsIMC Trading · OAIMC Trading interview questions
  • Lexicographically Smallest Grid Path with One Letter ChangeInfosys · OAInfosys interview questions
  • Balance a Chemical EquationMicrosoft · OAMicrosoft interview questions
  • Simulate a Deterministic Finite AutomatonPoint72 · OAPoint72 interview questions

Interview reports that mention this question

  • Intuit OA: What It Tests (2026)

Intuit interview experiences

  • Intuit Software Engineering Intern - Full Stack OA Format
All Intuit interview questionsSee Intuit hiring insights
Saved
class Solution {
    public int[][] findWord(String[] grid, String word) {
        // Write your code here
    }
}
Checking account…