status
Published
date
Nov 26, 2023
slug
樹形DP_隨筆
tags
程式
C++
category
程式
type
Post
password
icon
本文目錄
 

樹形 DP

 

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

 
NeetCode題單 隨筆區間DP 隨筆
Loading...