梓旭的藏書閣
Home
Search
Archive
About
Zixu
Article
228
Category
5
Tags
25
About
Archive
Search
Category
Tags
Lazy loaded image
程式
樹形DP 隨筆
Post on: Nov 26, 2023
Last edited: Feb 28, 2025
Views
0   Words   Reading Time ≈  0  mins 
程式
C++
status
date
slug
tags
category
type
password
icon
本文目錄
樹形 DPLeetCode 543. Diameter of Binary TreeLeetCode 687. Longest Univalue PathLeetCode 124. Binary Tree Maximum Path SumLeetCode 2246. Longest Path With Different Adjacent CharactersLeetCode 1372. Longest ZigZag Path in a Binary TreeLeetCode
 

樹形 DP

Ref
 

LeetCode 543. Diameter of Binary Tree

  • 通過 Root Node 的最長直徑 ⇒ 左子樹高度 + 右子樹高度

LeetCode 687. Longest Univalue Path

  • 轉化為求 BST 直徑的題目,在判斷式加上限制

LeetCode 124. Binary Tree Maximum Path Sum

LeetCode 2246. Longest Path With Different Adjacent Characters

  • 非 BST ⇒ 用 Graph 來儲存樹的資訊

LeetCode 1372. Longest ZigZag Path in a Binary Tree

LeetCode

 
  • Author:Zixu
  • URL:https://zixu.eu.org/article/樹形DP_隨筆
  • Copyright:All articles in this blog, except for special statements, adopt BY-NC-SA agreement. Please indicate the source!
Relate Posts
AP325 隨筆
Lazy loaded image
登入頁面實作
Lazy loaded image
Java Web 入門課
Lazy loaded image
Spring 入門課
Lazy loaded image
Java 入門課
Lazy loaded image
Javassist 入門課
Lazy loaded image
NeetCode題單 隨筆區間DP 隨筆
Loading...
Catalog
0%
樹形 DPLeetCode 543. Diameter of Binary TreeLeetCode 687. Longest Univalue PathLeetCode 124. Binary Tree Maximum Path SumLeetCode 2246. Longest Path With Different Adjacent CharactersLeetCode 1372. Longest ZigZag Path in a Binary TreeLeetCode
Zixu
Zixu
Welcome to my webstie.
Article
228
Category
5
Tags
25
Analytics
Post Count:
228
pv:
uv:
Latest posts
Golgi
Golgi
Nov 16, 2025
クラスの完璧すぎる女の子の弱点を暴きたい
クラスの完璧すぎる女の子の弱点を暴きたい
Nov 13, 2025
JPS 學習筆記
JPS 學習筆記
Nov 9, 2025
東、週刊連載被腰斬啦
東、週刊連載被腰斬啦
Oct 19, 2025
碧藍之海
碧藍之海
Sep 26, 2025
還好我退了 新訓篇
還好我退了 新訓篇
Sep 25, 2025
Catalog
0%
樹形 DPLeetCode 543. Diameter of Binary TreeLeetCode 687. Longest Univalue PathLeetCode 124. Binary Tree Maximum Path SumLeetCode 2246. Longest Path With Different Adjacent CharactersLeetCode 1372. Longest ZigZag Path in a Binary TreeLeetCode
2021-2025Zixu.

梓旭的藏書閣 | Welcome to my webstie.

Powered byNotionNext 4.9.2.