摘要: 方法一:暴力搜索 class Solution { private int res = 0; public int pathSum(TreeNode root, int sum) { order(root,sum); return res; } public void order(TreeNode 阅读全文
posted @ 2020-07-16 20:09 Sexyomaru 阅读(132) 评论(0) 推荐(0) 编辑
摘要: 判断二分图,使用染色法 方法一:BFS public boolean isBipartite(int[][] graph) { int n = graph.length; int[] color = new int[n]; // 染色数组 0表示为染色, 1 -1为不同色 for(int i = 0 阅读全文
posted @ 2020-07-16 15:07 Sexyomaru 阅读(128) 评论(0) 推荐(0) 编辑