Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Implement Word Search in a Grid

HardPython00:00
Practice interviewer
In session
5 left
00:00

Your question is Implement Word Search in a Grid. Start with the requirements on the right.

Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.

You need to log in / sign up to run or submit.

Problem

Given a 2D board of characters and a string word, return True if the word exists in the grid. The word can be constructed from letters of sequentially adjacent cells, where adjacent cells are horizontally or vertically neighboring. The same letter cell may not be used more than once in the word.

Constraints

  • 1 <= board.length, board[i].length <= 6
  • 1 <= word.length <= 15
  • All inputs consist of lowercase and uppercase English letters only.

Function Signature

def exist(board, word):
Your solutionPython 3
You need to log in / sign up to run or submit.
Run your code to see test output