![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
#BFS/DFS
Shlyan
这个作者很懒,什么都没留下…
展开
-
[Leetcode][BFS/DFS]785. Is Graph Bipartite?
Problems: https://leetcode.com/problems/is-graph-bipartite/ Solution1: DFS 将相邻的点标上不同的颜色,判断依据为相邻两个node不可以颜色相同 利用stack存储邻接node class Solution { public boolean isBipartite(int[][] graph) { in...原创 2019-10-06 08:46:51 · 133 阅读 · 0 评论 -
[Leetcode] 79. Word Search
Problems: https://leetcode.com/problems/word-search/ Solution: DFS class Solution { public boolean exist(char[][] board, String word) { if(board == null) { return false; ...原创 2019-10-11 05:50:39 · 87 阅读 · 0 评论 -
[Leetcode] 269. Alien Dictionary
Problems: https://leetcode.com/problems/alien-dictionary/ Solution: Topological Sort 建立拓扑图并寻找所有字符的入度(buildGraph),再寻找入度为0的字符取出,邻接字符入度减一(bfs) class Solution { public String alienOrder(String[] words...原创 2019-10-11 08:41:18 · 256 阅读 · 0 评论