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.
For example,
Given board =
word = <code>"ABCCED"</code>, -> returns <code>true</code>,
word = <code>"SEE"</code>, -> returns <code>true</code>,
word = <code>"ABCB"</code>, -> returns <code>false</code>.
原題連結(點我)
給一個二維字元數組,給一個字元串,問該二維數組是否包括該字元串。比方一個二維數組[ ABCE SFCS ADEE ]和字元串"ABCCED",這個就包括。解決問題,基本的關鍵是怎麼解決在二維數組中查找方向,怎樣來辨別哪些是走過的。
假設你認為本篇對你有收獲,請幫頂。
另外,我開通了微信公衆号--分享技術之美,我會不定期的分享一些我學習的東西.
你能夠搜尋公衆号:swalge 或者掃描下方二維碼關注我