Answer: Oracle OA Question 2024 May | Backtracking | on-campus

Answer · Posted Jun 2026

Solution: Word Search — DFS Backtracking Approach We use DFS with Backtracking. For each cell in the grid, we attempt to start building the word from that cell. At each step: If the current character does not match the expected character in the word, we immediately return false. We temporarily mark the cell as visited by replacing its character with '#'. We recursively explore all 4 neighbors for the next character. After exploring, we restore the cell's original character (backtrack). ...

The full answer & interview discussion are available to premium members.

Log in Create a free account