Redian新闻
>
Leetcode online judge的word search是不是用dp?
avatar
Leetcode online judge的word search是不是用dp?# JobHunting - 待字闺中
S*e
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.
avatar
s*k
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.

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。