摘要: 本题是一个很经典的图论问题,可以简化为判断有向图是否有环。 class Solution { private Map<Integer, List<Integer>> graph= new HashMap<>(); private int[] visited; public boolean canFi 阅读全文
posted @ 2020-06-02 22:19 yawenw 阅读(127) 评论(0) 推荐(0) 编辑
摘要: 4种解法 1.pop count public class Solution { public int[] countBits(int num) { int[] ans = new int[num + 1]; for (int i = 0; i <= num; ++i) ans[i] = popco 阅读全文
posted @ 2020-06-02 20:05 yawenw 阅读(147) 评论(0) 推荐(0) 编辑