06 2022 档案
摘要:leetcode 每日一题 515. 在每个树行中找最大值 /** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeN
阅读全文
摘要:leetcode 每日一题 513. 找树左下角的值 /** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode
阅读全文
摘要:leetcode 每日一题 1108. IP 地址无效化 1. replaceAll 字符串替换,支持正则表达式 class Solution { public String defangIPaddr(String address) { return address.replaceAll("\\."
阅读全文
摘要:leetcode 每日一题 1089. 复写零 func duplicateZeros(arr []int) { for i := 0; i < len(arr); i++ { if arr[i] != 0 { continue } for j := len(arr) - 2 ; j > i ; j
阅读全文
摘要:leetcode 每日一题 926. 将字符串翻转到单调递增 func minFlipsMonoIncr(s string) int { var dp0,dp1 int for _,data := range s { i := int(data) dp1 = min(dp0,dp1) + ('1'
阅读全文
摘要:leetcode 每日一题 1051. 高度检查器 import ( "sort" ) func heightChecker(heights []int) int { var num = 0 src := heights dst := make([]int, len(src)) copy(dst,
阅读全文
摘要:leetcode 每日一题 1037. 有效的回旋镖 百度搜了个两点一线方程公式,然后把3个点带入计算,一直出错,后来发现公式错误,用go语言自己写了个简单的判断 func isBoomerang(points [][]int) bool { ax,ay := points[0][0],points
阅读全文
摘要:leetcode 每日一题 464. 我能赢吗 class Solution { Map<Integer, Boolean> memo = new HashMap<Integer, Boolean>(); public boolean canIWin(int maxChoosableInteger,
阅读全文
摘要:leetcode 每日一题 450. 删除二叉搜索树中的节点 class Solution { public TreeNode deleteNode(TreeNode root, int key) { if(root == null){ return null; } if(key == root.v
阅读全文
摘要:leetcode 每日一题 473. 火柴拼正方形 class Solution { int ave = 0; int num = 4; public boolean makesquare(int[] matchsticks) { int sum = 0; for (int matchstick :
阅读全文