← 返回 bloomberg 的题目列表Word Search
类型:online_judge
bloomberg
Given a 2D grid of characters and a word, determine if the word exists in the grid. The word can be constructed from letters of sequentially adjacent cells, where 'adjacent' cells are horizontally or vertically neighboring. The same letter cell may not be used more than once. The grid contains only lowercase letters, and its size can reach 200 characters. Design an algorithm to efficiently check the existence.
Example
Input
3 4
a b c e
s f c s
a d e e
abcced