Dsa
Backtracking
Medium
Word Search II
Given a grid of letters and a list of words, find all words from the list that can be formed by sequentially adjacent letters (horizontally or vertically) in the grid. Words may not use the same letter cell more than once. Input format: The first line contains two integers m and n, the dimensions of the grid. The next m lines contain n characters each, followed by an integer k on the next line and k words. Output format: A list of found words. Example: Input:
2 2
ab
cd
2
ab
cd
Output:
['ab', 'cd']
Key concepts
backtrackingtriesearch
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now