討論串[閒聊] 每日leetcode
共 1554 篇文章
內容預覽:
求救一下. 照著溫莎思路寫了一下. 但一直過不了. 想問一下可能問題在哪. py code:. class Solution:. def exist(self, board: List[List[str]], word: str) -> bool:. m = len(board[0]). n = l
(還有827個字)
內容預覽:
https://leetcode.com/problems/word-search/description. 79. Word Search. 給你一個包含字母字元的matrix,求出是否可以找到目標字串word。. 思路:. 1.遍歷矩陣,如果board[i][j] = word[0] 則從這個點
(還有1224個字)
內容預覽:
22. Generate Parentheses. 有n組括號,寫一個function,可以產生所有括號的組合. 思路:. 當你放了一個左括號才能再放一個右括號. 所以設兩個變數L、R : L是左括號剩下的數量、R是右括號剩下的數量. 一開始L=n、R=0. 每次放了一個左括號就將L-1、R+1.
(還有498個字)
內容預覽:
Code:. (define (length-of-last-word s). (let* ((trimmed (string-trim s)). (words (string-split trimmed)). (last-word (last words))). (string-length la
(還有186個字)