摘要:
My solution: class Solution { public int missingElement(int[] nums, int k) { int i=1; for(;i<nums.length;i++){ int diff = nums[i]-nums[i-1]-1; if(diff 阅读全文
摘要:
class TicTacToe { int n; int[] rows; int[] cols; int diag=0; int antiDiag = 0; public TicTacToe(int n) { this.n = n; rows = new int[n]; cols = new int 阅读全文
摘要:
The key to solve this problem is to find the path from root to target, and put the length to target of every node from root to target to a map. Then e 阅读全文
摘要:
PreOrder: class Solution { double min = Integer.MAX_VALUE; int val; public int closestValue(TreeNode root, double target) { preOrder(root, target); re 阅读全文
摘要:
This is a merge interval's variety: class Solution { public String addBoldTag(String s, String[] words) { List<int[]> intervals = new ArrayList<>(); f 阅读全文