摘要:
1 /** 2 * Definition for a binary tree node. 3 * public class TreeNode { 4 * int val; 5 * TreeNode left; 6 * TreeNode right; 7 * TreeNode(int x) { val = x; } 8 * } 9 ... 阅读全文
摘要:
1 public class Solution { 2 public boolean canConstruct(String ransomNote, String magazine) { 3 int[] ransomNum = new int[256]; 4 int[] magNum = new int[256]; 5 for (... 阅读全文
摘要:
n-1个element加1相当于一个元素减1,那最少的move就是所有元素减去最小值之和 阅读全文
摘要:
这题参照http://blog.jobbole.com/42550/ 用的蓄水池算法,即更改ans的概率为1/(当前length) 阅读全文