Word Search
Updated
Problem statement
Given a rectangular character grid board and a string word, return true if word can be formed by a path through the grid. Otherwise, return false.
A path may move horizontally or vertically between adjacent cells. The same grid cell cannot be used more than once in one path.
Function
wordExists(board: char[][], word: String) → booleanExamples
Example 1
board = [["A","B","C","E"],["S","F","C","S"],["A","D","E","E"]]word = "ABCCED"return = trueThe path uses the top-row cells A, B, and C, then continues down to C, left to E, and left to D.
Example 2
board = [["A","B","C","E"],["S","F","C","S"],["A","D","E","E"]]word = "ABCB"return = falseThe only adjacent B that could finish the word is the cell already used after the starting A, and a cell cannot be reused.
Example 3
board = [["A"]]word = "A"return = trueThe single grid cell forms the complete word.
Constraints
1 <= board.length <= 61 <= board[i].length <= 6- Every row of
boardhas the same length. 1 <= word.length <= 15boardandwordcontain only uppercase and lowercase English letters.
More Bloomberg LP Phone Screen questions
- N-ary Index-Path Encoder and DecoderPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Trapping Rain WaterPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Fewest Coins CombinationPHONE SCREEN · Seen Nov 2026
- Recommend Films from Viewers Who Watched Everything You DidPHONE SCREEN · Seen Nov 2026
- Track New Values in Sorted OrderPHONE SCREEN · Seen Nov 2026
- Design Browser HistoryPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
- Mutable Stock Price Top KPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
- Sparse Vector and Matrix OperationsPHONE SCREEN · Seen Oct 2026
- Add Two Numbers IIPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
- Decode StringPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
Similar questions at other companies
- Word SearchAmazon · ONSITE INTERVIEW
- Word SearchMicrosoft · ONSITE INTERVIEWMicrosoft interview questions
- Enumerate Character Paths to a MarkerTesla · ONSITE INTERVIEWTesla interview questions
- Word SearchCognitiv · PHONE SCREEN
- Find a Word in a Letter GridAdobe · PHONE SCREENAdobe interview questions
- Word SearchWhatNot · PHONE SCREENWhatNot interview questions
- Trace a Word Through a Letter GridExpedia · ONSITE INTERVIEWExpedia interview questions
- Rat in a Maze: All Simple PathsPeopleStrong · OAPeopleStrong interview questions
- Find a Word in a Letter GridMeta · ONSITE INTERVIEWMeta interview questions
- Find a Word Path Moving Right or DownIntuit · OAIntuit interview questions
Interview reports that mention this question
- Bloomberg SWE Intern Interview Questions: 68 Questions
- Bloomberg Experienced SWE Interviews: 167 Questions (Part 1 of 2)
- Bloomberg SWE Phone Screen and Onsite: 1 Experience
- Bloomberg New Grad Question Bank: 161 Questions (Part 1 of 2)
- Bloomberg New Grad Screens: 30 Experiences (Part 4 of 5)
- Bloomberg New Grad SWE Offer Loops: 14 Experiences (Part 2 of 5)