摘要: 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 阅读全文
posted @ 2022-04-14 11:43 阳光明媚的菲越 阅读(13) 评论(0) 推荐(0) 编辑
摘要: 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 阅读全文
posted @ 2022-04-14 05:29 阳光明媚的菲越 阅读(18) 评论(0) 推荐(0) 编辑
摘要: 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 阅读全文
posted @ 2022-04-14 05:11 阳光明媚的菲越 阅读(14) 评论(0) 推荐(0) 编辑
摘要: PreOrder: class Solution { double min = Integer.MAX_VALUE; int val; public int closestValue(TreeNode root, double target) { preOrder(root, target); re 阅读全文
posted @ 2022-04-14 02:47 阳光明媚的菲越 阅读(10) 评论(0) 推荐(0) 编辑
摘要: This is a merge interval's variety: class Solution { public String addBoldTag(String s, String[] words) { List<int[]> intervals = new ArrayList<>(); f 阅读全文
posted @ 2022-04-14 02:29 阳光明媚的菲越 阅读(20) 评论(0) 推荐(0) 编辑