摘要: 这道题目一直不会做,因为要考虑的corner case 太多。 1. divisor equals 0. 2. dividend equals 0. 3. Is the result negative? 4. when dividend equals Integer.MIN_VALUE and di 阅读全文
posted @ 2016-12-27 12:24 Gryffin 阅读(234) 评论(0) 推荐(0) 编辑
摘要: StringBuilder.charAt(int index); StringBuilder.deleteCharAt(int index); StringBuilder.setCharAt(int index); String.indexOf(String str, int fromIndex); 阅读全文
posted @ 2016-12-27 11:18 Gryffin 阅读(119) 评论(0) 推荐(0) 编辑
摘要: public class Solution { public int threeSumClosest(int[] nums, int target) { Arrays.sort(nums); int length = nums.length; int rr = Integer.MAX_VALUE; int result = ... 阅读全文
posted @ 2016-12-27 11:04 Gryffin 阅读(110) 评论(0) 推荐(0) 编辑
摘要: 如果某一个字母代表的数字大于上一个字母代表的数字小,那么加上这个数字,否则,减去两倍的前一个数字,然后加上这一位数字。 阅读全文
posted @ 2016-12-27 10:28 Gryffin 阅读(120) 评论(0) 推荐(0) 编辑
摘要: 关于罗马数字: I: 1V: 5X: 10L: 50C: 100D: 500M: 1000字母可以重复,但不超过三次,当需要超过三次时,用与下一位的组合表示:I: 1, II: 2, III: 3, IV: 4C: 100, CC: 200, CCC: 300, CD: 400 提取每一位digit 阅读全文
posted @ 2016-12-27 08:46 Gryffin 阅读(143) 评论(0) 推荐(0) 编辑