摘要:
class Solution { public String convertToTitle(int n) { if (n 0) { result.insert(0, (char)('A' + n % 26)); n /= 26; } return result.toString(); ... 阅读全文
摘要:
Notes: For sorted array, there are two properties we can use: 1. All duplicates are stay togethers (First solution) 2. Ascending order (Second solutio 阅读全文
摘要:
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. 阅读全文
摘要:
/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */ class Solution { pub... 阅读全文
摘要:
Note: 1. Very smart way of calculating how many difference from bits: https://en.wikipedia.org/wiki/Hamming_distance#Algorithm_example 2. Another way 阅读全文
摘要:
Note: 1. Remember to intial (0, -1) since this kind of problems need a starting point. 阅读全文
摘要:
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. 阅读全文
摘要:
public class Codec { private long id; private Map urlMap; private final String elements = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; public Codec() { ... 阅读全文
摘要:
/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */ class Solution { pri... 阅读全文
摘要:
The largest number could be n of walls. 阅读全文
摘要:
/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */ class Solution { pub... 阅读全文