摘要: class Solution { public String convertToTitle(int n) { if (n 0) { result.insert(0, (char)('A' + n % 26)); n /= 26; } return result.toString(); ... 阅读全文
posted @ 2017-09-03 16:42 keepshuatishuati 阅读(102) 评论(0) 推荐(0) 编辑
摘要: Notes: For sorted array, there are two properties we can use: 1. All duplicates are stay togethers (First solution) 2. Ascending order (Second solutio 阅读全文
posted @ 2017-09-03 16:37 keepshuatishuati 阅读(96) 评论(0) 推荐(0) 编辑
摘要: Notes: 1. Still need to pay attention that return start since start represents current index to place next int. 2. define start outside of loop. 阅读全文
posted @ 2017-09-03 16:28 keepshuatishuati 阅读(77) 评论(0) 推荐(0) 编辑
摘要: /** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */ class Solution { pub... 阅读全文
posted @ 2017-09-03 16:23 keepshuatishuati 阅读(80) 评论(0) 推荐(0) 编辑
摘要: Note: 1. Very smart way of calculating how many difference from bits: https://en.wikipedia.org/wiki/Hamming_distance#Algorithm_example 2. Another way 阅读全文
posted @ 2017-09-03 16:15 keepshuatishuati 阅读(101) 评论(0) 推荐(0) 编辑
摘要: Note: 1. Remember to intial (0, -1) since this kind of problems need a starting point. 阅读全文
posted @ 2017-09-03 16:02 keepshuatishuati 阅读(81) 评论(0) 推荐(0) 编辑
摘要: Note: 1. The sum array need to be very clear that 0th is 0. So the sum[i] means from 0 to i - 1 sum. 阅读全文
posted @ 2017-09-03 13:12 keepshuatishuati 阅读(73) 评论(0) 推荐(0) 编辑
摘要: public class Codec { private long id; private Map urlMap; private final String elements = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; public Codec() { ... 阅读全文
posted @ 2017-09-03 12:51 keepshuatishuati 阅读(96) 评论(0) 推荐(0) 编辑
摘要: /** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */ class Solution { pri... 阅读全文
posted @ 2017-09-03 07:29 keepshuatishuati 阅读(71) 评论(0) 推荐(0) 编辑
摘要: The largest number could be n of walls. 阅读全文
posted @ 2017-09-03 07:16 keepshuatishuati 阅读(146) 评论(0) 推荐(0) 编辑
摘要: /** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */ class Solution { pub... 阅读全文
posted @ 2017-09-03 06:31 keepshuatishuati 阅读(79) 评论(0) 推荐(0) 编辑