摘要: public class Solution { public boolean isMatch(String s, String p) { int length1 = s.length(); int length2 = p.length(); if (l... 阅读全文
posted @ 2016-01-10 15:52 Weizheng_Love_Coding 阅读(89) 评论(0) 推荐(0) 编辑
摘要: public class Solution { public boolean isMatch(String s, String p) { if (p.length() == 0) { return s.length() == 0; } ... 阅读全文
posted @ 2016-01-10 15:52 Weizheng_Love_Coding 阅读(127) 评论(0) 推荐(0) 编辑
摘要: O(n)时间空间复杂度public class Solution { public int maxSubArrayLen(int[] nums, int k) { HashMap map = new HashMap(); int sum = 0; in... 阅读全文
posted @ 2016-01-05 15:31 Weizheng_Love_Coding 阅读(203) 评论(0) 推荐(0) 编辑
摘要: 感觉我的方法逻辑不够清晰public class Solution { private List result; public List generateAbbreviations(String word) { result = new ArrayList(); ... 阅读全文
posted @ 2016-01-03 23:08 Weizheng_Love_Coding 阅读(160) 评论(0) 推荐(0) 编辑
摘要: 12.7去西雅图微软on-site,等了两周终于等来了offer。看了地里很多面经,因为微软并没有签保密协议,今天来贡献一下。先说一下微软onsite体验真的很好,宾馆机票吃饭都安排的很好。一天给75刀饭补,本来以为都这样,后来谷歌onsite才知道谷歌只有30.我面的组是hololens,一共五轮... 阅读全文
posted @ 2015-12-29 15:05 Weizheng_Love_Coding 阅读(1389) 评论(0) 推荐(0) 编辑
摘要: 经典动态规划public class Solution { public int coinChange(int[] coins, int amount) { int[] record = new int[amount + 1]; record[0] = 1; ... 阅读全文
posted @ 2015-12-29 14:21 Weizheng_Love_Coding 阅读(172) 评论(0) 推荐(0) 编辑
摘要: MS面试最后一轮就跪在number of island 1 了,痛心啊。bfs虽然能过lc,但是面试的时候得写出union find来才可以啊。public class Solution { private int[] array; private int[][] grid; pr... 阅读全文
posted @ 2015-12-15 07:04 Weizheng_Love_Coding 阅读(216) 评论(0) 推荐(0) 编辑
摘要: 对每个房子bfs,找出每个房子到所有空地的距离。用一个record二维数组来记录每个空地上所有房子到该空地的距离和。同时用另一个二维数组记录每个空地能被几个房子访问到,来保证所有房子都可以到达的了该空地。public class Solution { public int shortestDi... 阅读全文
posted @ 2015-12-14 14:02 Weizheng_Love_Coding 阅读(507) 评论(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) 编辑