Grokking LinkedIn Coding Interview
Ask Author
Back to course home

0% completed

Vote For New Content
Arturo Calderón
How is this a backtracking solution and not just a restricted DFS?

Arturo Calderón

Nov 13, 2023

Marking the current cell (see line 10 of the solution) does nothing, as it is never checked, nor does it change the result if omitted.

Are we really solving this with backtracking?

0

0

Comments
Comments
Shubham Vora
Shubham Voraa year ago

marking the current cell matters, when we check the below condition. It won't use the character at position at board[i][j] as it is already visited.

 board[i][j] != word.charAt(k)

On this page