Dynamic Programming

Revision en2, by rahul_1234, 2017-05-08 22:43:15

Given a 2D board and a word, find if the word exists in the grid.

The word can be constructed from letters of sequentially adjacent cell, where "adjacent" cells are those horizontally or vertically neighboring. The cell itself does not count as an adjacent cell. The same letter cell may be used more than once.

1). Grid: ab

Word = abab

return 0

2). Grid

[ ["ABCE"],

["SFCS"],

["ADEE"] ]

Word = "ABCCED"

return 1

I cannot get a proper solution to this which handle all cases so if someone can help, it would be very helpful?

Tags #dp, #graph

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English rahul_1234 2017-05-08 22:43:15 115 Tiny change: ' helpful?_\n__' -> ' helpful?_'
en1 English rahul_1234 2017-05-08 22:38:18 483 Initial revision (published)