06 2024 档案
[atcoder 358] 【动态规划】
摘要:dp[i][j] 表示前i个和为j的个数。那么就有递推式dp[i][j] += dp[i][j-x] * c(j,j-x); 其中x满足从0到c[i],并且x满足<=j 组合数递推公式c(n,k) = c(n,k-1) + c(n,k); import java.io.BufferedReader;
【leetcode 1510 石子游戏】【记忆化搜索】
摘要:存在和对于一切的语言 import java.util.Arrays; class Solution { public boolean winnerSquareGame(int n) { dp = new Boolean[n + 1]; dp2 = new Boolean[n + 1]; Array
[leetcode 30 串联所有单词的子串 10ms]
摘要:算法复杂度 o(1): 复杂最坏复杂度 是 o(s.length) 和 o(m*total)的最大值 码代码速度要变快,变量,算法要先想清楚 import java.util.*; class Solution { public List<Integer> findSubstring(String
[leetcode 3171] 解法列表
摘要:线段树解法 + 二分 class Solution { public int minimumDifference(int[] nums, int k) { this.nums = nums; this.n = nums.length; return check(k); } public static
[leetcode 第 400 场周赛]题解
摘要:第一题: class Solution { public int minimumChairs(String s) { int x = 0; int ans = 0; for (int i = 0; i < s.length(); i++) { if (s.charAt(i) == 'E') { x-