S*******e 发帖数: 379 | 1 complexity O(l*n^2), l 是word的长度。
题目:
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
same letter cell may not be used more than once. | s******k 发帖数: 3716 | 2 可以这么认为。解法就是第一步把第一个字母选出来,写上1,第二步把临近1的第二个
字母选出来,写上2,第三步把临近2的第三个字母选出来,写上3。。。
最后写到n的就是。
The
【在 S*******e 的大作中提到】 : complexity O(l*n^2), l 是word的长度。 : 题目: : 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 : same letter cell may not be used more than once.
|
|