2017年8月31日
摘要: Union Find 集合合并,查找元素在集合里面 数组实现 int[] pre; public int find(int x) { int r = x; while (r != pre[r]) { r = pre[r]; } int i = x, j; while (pre[i] != r) { 阅读全文
posted @ 2017-08-31 11:51 wheleetcode 阅读(241) 评论(0) 推荐(0)
摘要: 动态规划空间优化 滚动数组 1 House Robber public long houseRobber(int[] a) { if (a == null || a.length == 0) { return 0; } if (a.length == 1) { return a[0]; } if ( 阅读全文
posted @ 2017-08-31 09:32 wheleetcode 阅读(187) 评论(0) 推荐(0)