下一個(gè)目標(biāo)是弄清楚:Top down和Bottom up 理解:Bottom up - 是指不到最下面的葉節(jié)點(diǎn)樟氢,不會(huì)return(觸底后反彈 -...
題目地址典型的BFS了冈绊,只需要在遍歷當(dāng)前層級(jí)的時(shí)候記錄下結(jié)點(diǎn)個(gè)數(shù)和值的累加和就好了。 注意new后面的具體數(shù)據(jù)類型:List<Double> =...
最近刷關(guān)于Tree的題遇到了不少用BFS/DFS解決的問題埠啃,鑒于自己對(duì)概念一知半解死宣,翻出之前一個(gè)朋友推薦過的文章學(xué)習(xí)一下。原文地址:https:...
雙端隊(duì)列Deque「轉(zhuǎn)」 頭部尾部操作語(yǔ)句不同:https://zh.wikipedia.org/wiki/%E5%8F%8C%E7%AB%AF...
isValidBST public boolean isValidBST(TreeNode root) {return valid(root, ...
題目Given a binary search tree (BST) with duplicates, find all the mode(s)...
https://docs.python.org/3/library/csv.html 這段代碼批量給.csv文件加上headers(thanks...
For Tree 3, its each node's val is the sum(TreeNode t1 + TreeNode t2) in...
pathSum 1 Given a binary tree and a sum, determine if the tree has a roo...