上一页 1 ··· 223 224 225 226 227 228 229 230 231 ··· 233 下一页
摘要: https://leetcode.com/problems/remove-k-digits/ // 参考了这里的 // https://discuss.leetcode.com/topic/59327/o-n-solution/3 public class Solution { public String removeKdigits(String num, int k) { ... 阅读全文
posted @ 2016-09-21 04:05 blcblc 阅读(235) 评论(0) 推荐(0)
摘要: https://leetcode.com/problems/frog-jump/ // 受以下网页启发,用递归可行 // https://discuss.leetcode.com/topic/59337/easy-version-java public class Solution { Map mp; private int[] stones; public bool... 阅读全文
posted @ 2016-09-21 03:28 blcblc 阅读(433) 评论(0) 推荐(0)
摘要: https://leetcode.com/problems/nth-digit/ public class Solution { public int findNthDigit(int n) { int k = 9; int b = 1; // 需要加上对b的限制 while (b k*b) { ... 阅读全文
posted @ 2016-09-21 02:11 blcblc 阅读(129) 评论(0) 推荐(0)
摘要: https://leetcode.com/problems/binary-watch/ // 参考 https://discuss.leetcode.com/topic/59374/simple-python-java // 非常棒的方法 public class Solution { public List readBinaryWatch(int num) { Li... 阅读全文
posted @ 2016-09-21 01:49 blcblc 阅读(181) 评论(0) 推荐(0)
摘要: https://leetcode.com/problems/elimination-game/ // 一行代码就可以,不过原理有些复杂 // https://discuss.leetcode.com/topic/58042/c-1-line-solution-with-explanation // return n == 1 ? 1 : 2 * (1 + n / 2 - lastRemaini... 阅读全文
posted @ 2016-09-21 01:21 blcblc 阅读(203) 评论(0) 推荐(0)
摘要: https://leetcode.com/problems/evaluate-division/ public class Solution { private Map mp; private class Item { public String str; public double prop; public Item(Strin... 阅读全文
posted @ 2016-09-18 23:51 blcblc 阅读(250) 评论(0) 推荐(0)
摘要: https://leetcode.com/problems/random-pick-index/ public class Solution { private Map mp; private Random rand; public Solution(int[] nums) { mp = new HashMap(); for ... 阅读全文
posted @ 2016-09-18 10:41 blcblc 阅读(225) 评论(0) 推荐(0)
摘要: https://leetcode.com/problems/integer-replacement/ // 除了首位的1,其他的1需要2次操作,0需要1次操作。 // 所以尽量把1变成0 // 所以,3直接得出结果2, // 其他的,01->-1,11->+1 public class Solution { public int integerReplacement(int inn)... 阅读全文
posted @ 2016-09-18 00:00 blcblc 阅读(211) 评论(0) 推荐(0)
摘要: https://leetcode.com/problems/rotate-function/ public class Solution { public int maxRotateFunction(int[] A) { int all = 0; int sum = 0; int ret = Integer.MIN_VALUE; ... 阅读全文
posted @ 2016-09-17 22:55 blcblc 阅读(220) 评论(0) 推荐(0)
摘要: public class Solution { public int longestSubstring(String s, int k) { // Find count of each char HashMap mp = new HashMap(); Object intObj; for (int 阅读全文
posted @ 2016-09-17 18:52 blcblc 阅读(394) 评论(0) 推荐(0)
上一页 1 ··· 223 224 225 226 227 228 229 230 231 ··· 233 下一页
点击右上角即可分享
微信分享提示