下一個(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解決的問(wèn)題,鑒于自己對(duì)概念一知半解凤藏,翻出之前一個(gè)朋友推薦過(guò)的文章學(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...