FastPrepEight-Direction Word Search
Problems/Eight-Direction Word Search

Eight-Direction Word Search

Motive logoMotive● MediumFULLTIMEONSITE INTERVIEW

Updated Sep 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: A first-hand Motive report describes word search with eight-direction movement. The no-cell-reuse convention is a bounded standard practice assumption; core match is about 90%.

Given a rectangular grid of characters encoded as equal-length strings and a word, return whether the word can be formed from sequentially adjacent cells. Each step may move horizontally, vertically, or diagonally, and one cell cannot be reused within a path.

Function

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

Examples

Example 1

board = ["ABCE","SFCS","ADEE"]word = "ABCCED"return = true
board
01230ABCE1SFCS2ADEE

Example 2

board = ["AB","CD"]word = "AD"return = true
board
010AB1CD

The diagonal move is allowed.

Constraints

  • 1 <= board.length, board[i].length <= 50.
  • 1 <= word.length <= 50.
  • Board cells and the word contain English letters.

More Motive Onsite Interview questions

  • Group AnagramsPHONE SCREEN · ONSITE INTERVIEW · Seen Jan 2026
  • Longest Equal-Zero-One SubarrayPHONE SCREEN · ONSITE INTERVIEW · Seen Jan 2026
  • Maximum Weighted Sum After Left RotationsONSITE INTERVIEW · Seen Jan 2026
  • Valid Parenthesis StringPHONE SCREEN · ONSITE INTERVIEW · Seen Jan 2026
  • Best Time to Buy and Sell StockONSITE INTERVIEW · Seen Dec 2025
  • Target Triplet SumONSITE INTERVIEW · Seen Dec 2025
  • Validate IP AddressONSITE INTERVIEW · Seen Dec 2025
  • Generate Palindromic PermutationsONSITE INTERVIEW · Seen Dec 2025
  • Minimum Swaps to Group Circular OnesONSITE INTERVIEW · Seen Dec 2025
  • Staircase Search In A Sorted MatrixONSITE INTERVIEW · Seen Dec 2025

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
  • Cats, Rabbits, and Snails Board GameAsana · ONSITE INTERVIEW
  • Matrix Flower-House Planting PlansGoogle · ONSITE INTERVIEWGoogle interview questions
  • Boggle Word FinderBloomberg LP · ONSITE INTERVIEWBloomberg LP interview questions
  • Find a Word in a Letter GridAdobe · PHONE SCREENAdobe interview questions
  • Generate All Permutations of a NumberFleetx · ONSITE INTERVIEW
  • Assign Escalations to TeamsAmazon · ONSITE INTERVIEW
  • Spiral MatrixAthenahealth · ONSITE INTERVIEW
All Motive interview questionsSee Motive hiring insights
Saved
class Solution {
    public boolean wordExistsEightDirections(String[] board, String word) {
      // write your code here
    }
}
Checking account…