<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Dp-on-Trees on</title><link>https://h30306.github.io/blog/tags/dp-on-trees/</link><description>Recent content in Dp-on-Trees on</description><generator>Hugo -- gohugo.io</generator><language>en</language><managingEditor>hwork0511@gmail.com (Wei Yi Chung)</managingEditor><webMaster>hwork0511@gmail.com (Wei Yi Chung)</webMaster><copyright>© 2026 Wei Yi Chung</copyright><lastBuildDate>Sat, 31 Oct 2026 00:00:00 +0000</lastBuildDate><atom:link href="https://h30306.github.io/blog/tags/dp-on-trees/index.xml" rel="self" type="application/rss+xml"/><item><title>LeetCode 834: Sum of Distances in Tree</title><link>https://h30306.github.io/blog/leetcode/leetcode-834/</link><pubDate>Sat, 31 Oct 2026 00:00:00 +0000</pubDate><author>hwork0511@gmail.com (Wei Yi Chung)</author><guid>https://h30306.github.io/blog/leetcode/leetcode-834/</guid><description>LeetCode 834 note: rerooting DP: compute subtree sizes and ans[0] with root 0, then push ans[child] = ans[parent] - size + (n - size) to every node</description><media:content xmlns:media="http://search.yahoo.com/mrss/" url="https://h30306.github.io/blog/leetcode/leetcode-834/featured.png"/></item><item><title>LeetCode 968: Binary Tree Cameras</title><link>https://h30306.github.io/blog/leetcode/leetcode-968/</link><pubDate>Fri, 30 Oct 2026 00:00:00 +0000</pubDate><author>hwork0511@gmail.com (Wei Yi Chung)</author><guid>https://h30306.github.io/blog/leetcode/leetcode-968/</guid><description>LeetCode 968 note: post-order greedy with three states per node: has a camera, covered, not covered; place a camera only when a child is uncovered, and add one if the root is left uncovered</description><media:content xmlns:media="http://search.yahoo.com/mrss/" url="https://h30306.github.io/blog/leetcode/leetcode-968/featured.png"/></item><item><title>LeetCode 124: Binary Tree Maximum Path Sum</title><link>https://h30306.github.io/blog/leetcode/leetcode-124/</link><pubDate>Sat, 24 Oct 2026 00:00:00 +0000</pubDate><author>hwork0511@gmail.com (Wei Yi Chung)</author><guid>https://h30306.github.io/blog/leetcode/leetcode-124/</guid><description>LeetCode 124 note: DFS returns the best downward chain and updates the answer with left chain + node + right chain at every node; drop negative chains</description><media:content xmlns:media="http://search.yahoo.com/mrss/" url="https://h30306.github.io/blog/leetcode/leetcode-124/featured.png"/></item><item><title>LeetCode 1372: Longest ZigZag Path in a Binary Tree</title><link>https://h30306.github.io/blog/leetcode/leetcode-1372/</link><pubDate>Sat, 24 Oct 2026 00:00:00 +0000</pubDate><author>hwork0511@gmail.com (Wei Yi Chung)</author><guid>https://h30306.github.io/blog/leetcode/leetcode-1372/</guid><description>LeetCode 1372 note: each node returns two values, the longest zigzag starting left and starting right; going left extends the left child&amp;rsquo;s start-right value</description><media:content xmlns:media="http://search.yahoo.com/mrss/" url="https://h30306.github.io/blog/leetcode/leetcode-1372/featured.png"/></item><item><title>LeetCode 687: Longest Univalue Path</title><link>https://h30306.github.io/blog/leetcode/leetcode-687/</link><pubDate>Sat, 24 Oct 2026 00:00:00 +0000</pubDate><author>hwork0511@gmail.com (Wei Yi Chung)</author><guid>https://h30306.github.io/blog/leetcode/leetcode-687/</guid><description>LeetCode 687 note: DFS returns the longest same-value downward chain in edges, and each node updates the answer with left + right</description><media:content xmlns:media="http://search.yahoo.com/mrss/" url="https://h30306.github.io/blog/leetcode/leetcode-687/featured.png"/></item><item><title>LeetCode 563: Binary Tree Tilt</title><link>https://h30306.github.io/blog/leetcode/leetcode-563/</link><pubDate>Sat, 27 Aug 2022 00:00:00 +0000</pubDate><author>hwork0511@gmail.com (Wei Yi Chung)</author><guid>https://h30306.github.io/blog/leetcode/leetcode-563/</guid><description>LeetCode 563 note: return subtree sums in post-order; each node&amp;rsquo;s tilt is the difference of its subtree sums, added to the answer</description><media:content xmlns:media="http://search.yahoo.com/mrss/" url="https://h30306.github.io/blog/leetcode/leetcode-563/featured.png"/></item><item><title>LeetCode 543: Diameter of Binary Tree</title><link>https://h30306.github.io/blog/leetcode/leetcode-543/</link><pubDate>Thu, 25 Aug 2022 00:00:00 +0000</pubDate><author>hwork0511@gmail.com (Wei Yi Chung)</author><guid>https://h30306.github.io/blog/leetcode/leetcode-543/</guid><description>LeetCode 543 note: the diameter may skip the root; return heights in post-order while updating the answer with left + right height at every node, counting edges</description><media:content xmlns:media="http://search.yahoo.com/mrss/" url="https://h30306.github.io/blog/leetcode/leetcode-543/featured.png"/></item></channel></rss>