Dynamic Programming

Правка en2, от 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?

Теги #dp, #graph

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский rahul_1234 2017-05-08 22:43:15 115 Tiny change: ' helpful?_\n__' -> ' helpful?_'
en1 Английский rahul_1234 2017-05-08 22:38:18 483 Initial revision (published)