• Courses
  • Tutorials
  • DSA
  • Data Science
  • Web Tech
July 21, 2022 |6.9K Views

Check if a word exists in a grid or not

Description
Discussion

Given a 2D grid of characters and a word, the task is to check if that word exists in the grid or not. A word can be matched in 4 directions at any point.


The 4 directions are Horizontally Left and Right, Vertically Up and Down. 


Examples: 
 

Input:  grid[][] = {"axmy",
                   "bgdf",
                   "xeet",
                   "raks"};
Output: Yes


Check if a word exists in a grid or not : https://www.geeksforgeeks.org/check-if-a-word-exists-in-a-grid-or-not/