---
# System prepended metadata

title: 圖練習題 (Graph)
tags: [Graph, Leetcode]

---

# 圖練習題 (Graph)

## 鄰接矩陣 (Adjacent Matrix)

| 題號 | 題目名稱| 難度 | 備註 | 題解 |
| ---- | ------------------------------------------------------------------------ | -------------------------------- |:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:| ----------------------------------------------------------- |
|997|[Find the town judge 找到小鎮上的法官](https://leetcode.com/problems/find-the-town-judge/description/)|<font color=DarkGreen>Easy</font>||[找到小鎮上的法官題解](https://hackmd.io/@paxton0222/ByWqbDSgh)|
|695|[Max area of island 最大島嶼面積](https://leetcode.com/problems/max-area-of-island/description/)|<font color=Orange>Meduim</font>||[最大島嶼面積題解](https://hackmd.io/@paxton0222/SyjOd6ce3)|
|1267|[Count servers that communicate 伺服器通信總數](https://leetcode.com/problems/count-servers-that-communicate/description/)|<font color=Orange>Meduim</font>|Only two directionals DFS||
|1791|[Find center of star graph 找到星型圖的中心點](https://leetcode.com/problems/find-center-of-star-graph/description/)|<font color=DarkGreen>Easy</font>||[找到星型圖的中心點](https://hackmd.io/@paxton0222/SJq12PSl2)|
|329|[Longest increasing path in a matrix 矩陣中的最長路徑](https://leetcode.com/problems/longest-increasing-path-in-a-matrix/description/)|<font color=Red>Hard</font>||[矩陣中的最長路徑題解](https://hackmd.io/@paxton0222/ByHW2wxb2)|
|1260|[Shift 2D Grid 移動2D矩陣](https://leetcode.com/problems/shift-2d-grid/description/)|<font color=DarkGreen>Easy</font>||[移動2D矩陣題解](https://hackmd.io/@paxton0222/B1422LCW3)|
|200|[Number of Islands](https://leetcode.com/problems/number-of-islands/description/?envType=study-plan-v2&envId=top-interview-150)|<font color=Orange>Meduim</font>||[Number of Islands 題解](https://hackmd.io/@paxton0222/r1LWf4z5h)|
|1275|[Find winner on a tic tac toe game 找到圈叉遊戲的勝利者](https://leetcode.com/problems/find-winner-on-a-tic-tac-toe-game/description/)|<font color=DarkGreen>Easy</font>||[找到圈叉遊戲的勝利者題解](https://hackmd.io/@paxton0222/Hy_94hR-3)|
|130|[Surrounded Regions](https://leetcode.com/problems/surrounded-regions/description/?envType=study-plan-v2&envId=top-interview-150)|<font color=Orange>Meduim</font>||[Surrounded Regions題解](https://hackmd.io/@paxton0222/S1i99Lf53)|
|909|[Snakes and Ladders](https://leetcode.com/problems/snakes-and-ladders/description/?envType=study-plan-v2&envId=top-interview-150)|<font color=Orange>Meduim</font>||[Snakes and Ladders 題解](https://hackmd.io/@paxton0222/B1OjXTQ93)|


## 鄰接列表 (Adjacent List)
| 題號 | 題目名稱                                                                                                     | 難度 |                         備註                          | 題解 |
| ---- | ------------------------------------------------------------------------------------------------------------ | ---- |:-----------------------------------------------------:| ---- |
| 133  | [Clone Graph 複製圖](https://leetcode.com/problems/clone-graph/description/)|<font color=Orange>Meduim</font> |      | [複製圖題解](https://hackmd.io/@paxton0222/BJlmyjLg3) |      |
|841|[Keys and rooms 鑰匙和房間](https://leetcode.com/problems/keys-and-rooms/description/)|<font color=Orange>Meduim</font>||[鑰匙和房間題解](https://hackmd.io/@paxton0222/SkLeTSPe2)|
|1615|[Maximal network rank 最大網路](https://leetcode.com/problems/maximal-network-rank/description/)|<font color=Orange>Meduim</font>||[最大網路題解](https://hackmd.io/@paxton0222/B1XZJ8Plh)|


## 拓墣排序 (Toplological Sort)
| 題號 | 題目名稱| 難度 | 備註 | 題解 |
| ---- | ------------------------------------------------------------------------ | -------------------------------- |:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:| ----------------------------------------------------------- |
|207|[Course Schedule 課程路線](https://leetcode.com/problems/course-schedule/description/)|<font color=Orange>Meduim</font>||[課程路線題解](https://hackmd.io/@paxton0222/ByCEGyve2)|
|210|[Course schedule II 課程路線二](https://leetcode.com/problems/course-schedule-ii/description/)|<font color=Orange>Meduim</font>||[課程路線二題解](https://hackmd.io/@paxton0222/H19rG7vg2)|
|1557|[Minimum number of vertices to reach all nodes 最少頂點可以遍歷所有節點](https://leetcode.com/problems/minimum-number-of-vertices-to-reach-all-nodes/description/)|<font color=Orange>Medium</font>||[最少頂點可以遍歷所有節點題解](https://hackmd.io/@paxton0222/HyRTqu0e2)|

## 二分圖

| 題號 | 題目名稱| 難度 | 備註 | 題解 |
| ---- | ------------------------------------------------------------------------ | -------------------------------- |:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:| ----------------------------------------------------------- |
|785|[判斷二分圖](https://leetcode.com/problems/is-graph-bipartite/description/)|<font color=Orange>Medium</font>|染色法|[二分圖題解](https://hackmd.io/@paxton0222/ryu2gPKxn)|

## 樹的最小高度 (MHT)

| 題號 | 題目名稱| 難度 | 備註 | 題解 |
| ---- | ------------------------------------------------------------------------ | -------------------------------- |:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:| ----------------------------------------------------------- |
|310|[Minimum height trees 樹的最小高度](https://leetcode.com/problems/minimum-height-trees/description/)|<font color=Orange>Medium</font>|尚未解決|[樹的最小高度](https://hackmd.io/@paxton0222/Byj3dFAg3)|

## 最小生成樹 (MST)

| 題號 | 題目名稱| 難度 | 備註 | 題解 |
| ---- | ------------------------------------------------------------------------ | -------------------------------- |:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:| ----------------------------------------------------------- |
|1584|[Min cost to connect to all points 連接所有點的最少花費](https://leetcode.com/problems/min-cost-to-connect-all-points/description/)|<font color=Orange>Medium</font>||[連接所有點的最少花費題解](https://hackmd.io/@paxton0222/BkbAH7eW2)|

## 並查集(Union Find)

| 題號 | 題目名稱| 難度 | 備註 | 題解 |
| ---- | ------------------------------------------------------------------------ | -------------------------------- |:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:| ----------------------------------------------------------- |
|1971|[Find if path exists in graph 尋找路徑是否存在圖中](https://leetcode.com/problems/find-if-path-exists-in-graph/description/)|<font color=DarkGreen>Easy</font>||[尋找路徑是否存在於圖中題解](https://hackmd.io/@paxton0222/BJsYfeul3)||
|128|[Longest Consecutive Sequence](https://leetcode.com/problems/longest-consecutive-sequence/)|<font color=Orange>Medium</font>||[Longest Consecutive Sequence 題解](https://hackmd.io/@paxton0222/B1QOrFyca)||
|399|[Evaluate Division](https://leetcode.com/problems/evaluate-division/)|<font color=Orange>Medium</font>||[Evaluate Division 題解](https://hackmd.io/@paxton0222/ryl2Tik5a)||
|547|[Number of Provinces 省份數量](https://leetcode.com/problems/number-of-provinces/description/)|<font color=Orange>Meduim</font>||[省份數量題解](https://hackmd.io/@paxton0222/By6Qt1uen)|