摘要: 对每个房子bfs,找出每个房子到所有空地的距离。用一个record二维数组来记录每个空地上所有房子到该空地的距离和。同时用另一个二维数组记录每个空地能被几个房子访问到,来保证所有房子都可以到达的了该空地。public class Solution { public int shortestDi... 阅读全文
posted @ 2015-12-14 14:02 Weizheng_Love_Coding 阅读(512) 评论(0) 推荐(0) 编辑
摘要: 思路借鉴了https://leetcode.com/discuss/73806/15-ms-java-solutionfor "cbacdcbc", we counts each letter's index:a----2b----1,6c----0,3,5,7d----4we go from a ... 阅读全文
posted @ 2015-12-14 06:38 Weizheng_Love_Coding 阅读(280) 评论(0) 推荐(0) 编辑
摘要: public class Solution { public List summaryRanges(int[] nums) { List result = new ArrayList(); int length = nums.length; int l... 阅读全文
posted @ 2015-12-14 05:37 Weizheng_Love_Coding 阅读(115) 评论(0) 推荐(0) 编辑