Graph
DFS
Avoid backtracker repetition
1059. All Paths from Source Lead to Destination
BFS
With steps
- Add a for loop within the while loop
490. The Maze
1245. Tree Diameter
Dijkstra's algorithm
- Need to place in visited after the element pop out of the heap, since there might exist multiple length with the same coordinate
505. The Maze II
2976. Minimum Cost to Convert String I
1334. Find the City With the Smallest Number of Neighbors at a Threshold Distance
Map
Topological sort
Union find
- Research about time complexity for union find
947. Most Stones Removed with Same Row or Column
Prim algorithm
- Min overall distance between edges
743. Network Delay Time
Floyd-Warshall Algorithm
File | confidence | date | difficulty | note |
---|---|---|---|---|
733. Flood Fill | 🟢 | - | - | - |
542. 01 Matrix | 🟢 | February 20, 2024 | - | Can turn all non zero entries into -1 first |
994. Rotting Oranges | 🟢 | March 02, 2024 | medium | - |
207. Course Schedule | 🟢 | March 02, 2024 | - | - |
200. Number of Islands | 🟢 | March 02, 2024 | - | - |
79. Word Search | 🟢 | March 08, 2024 | - | - |
399. Evaluate Division | 🟢 | March 08, 2024 | - | - |
210. Course Schedule II | 🟢 | March 08, 2024 | - | - |
2050. Parallel Courses III | 🟢 | March 09, 2024 | - | - |
684. Redundant Connection | 🟢 | March 19, 2024 | - | - |
417. Pacific Atlantic Water Flow | 🟢 | March 19, 2024 | - | - |
778. Swim in Rising Water | 🟢 | April 03, 2024 | hard | - |
329. Longest Increasing Path in a Matrix | 🟢 | October 18, 2024 | medium | memorise the max for each node i dp |
323. Number of Connected Components in an Undirected Graph | 🟢 | October 18, 2024 | medium | - |
743. Network Delay Time | 🟢 | November 10, 2024 | medium | - |
261. Graph Valid Tree | 🟢 | November 10, 2024 | - | - |
1293. Shortest Path in a Grid with Obstacles Elimination | 🟢 | November 10, 2024 | hard | - |