为了能到远方,脚下的每一步都不|

fishcanfly

园龄:8年10个月粉丝:0关注:4

06 2022 档案

【5229. 拼接数组的最大分数】动态规划
摘要:class Solution { public int maximumsSplicedArray(int[] nums1, int[] nums2) { int n = nums1.length; int[] b = new int[n]; int[] c = new int[n]; dp(nums
16
0
0
【Atcoder F - Cumulative Cumulative Cumulative Sum】线段树
摘要:要特别注意下精度,long,int范围。WA了几次 import java.util.Scanner; class Main { // static long[] A2 ;//i^2*AI // static long[] A1;//i*Ai; static long[] A; //Ai; stat
32
2
0
【2310. 个位数字为 K 的整数之和】背包
摘要:import java.util.*; class Solution { public static void main(String[] args) { Solution solution = new Solution(); System.out.println(solution.minimumN
19
0
0
【2311. 小于等于 K 的最长二进制子序列】贪心
摘要:class Solution { public static void main(String[] args) { Solution solution = new Solution(); System.out.println(solution.longestSubsequence("1001010"
22
0
0
【2302. 统计得分小于 K 的子数组数目】前缀和+二分
摘要:class Solution { public static void main(String[] args) { Solution solution = new Solution(); solution.countSubarrays(new int[]{ 2,1,4,3,5 },10); } pu
17
0
0
【ATCOER、D - ±1 Operation 2】前缀和+排序二分
摘要:import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.Arrays; public class Main { public static void main(String[] args) t
31
0
0
【6094. 公司命名】枚举
摘要:import java.util.HashSet; import java.util.Set; class Solution { public long distinctNames(String[] ideas) { int[][] cnt = new int[26][26]; boolean[][
19
0
0
【926. 将字符串翻转到单调递增】动态规划
摘要:class Solution { public int minFlipsMonoIncr(String s) { int len = s.length(); int[][] dp = new int[len][2]; if (s.charAt(0) == '0') { dp[0][0] = 0; d
17
0
0
【1498. 满足条件的子序列数目】二分查找
摘要:import java.util.Arrays; class Solution { public int numSubseq(int[] nums, int target) { Arrays.sort(nums); int len = nums.length; long ans = 0l; for
20
0
0
【875. 爱吃香蕉的珂珂】二分查找
摘要:class Solution { public int minEatingSpeed(int[] piles, int h) { int ans = 0; int low = 1; int high = 1000000001; while(low<high){ int mid = ( low +hi
8
0
0
【1024. 视频拼接】贪心
摘要:class Solution { public static void main(String[] args) { Solution solution = new Solution(); int ans = solution.videoStitching(new int[][]{ {8,10},{1
114
0
0
【672. 灯泡开关 Ⅱ】状态空间缩小
摘要://只需要考虑前6位的状态,i这种状态和i+6这个状态是一样的import java.util.ArrayDeque; import java.util.Arrays; import java.util.HashSet; class Solution { public static void mai
23
2
0
【732. 我的日程安排表 III】差分数组
摘要:class MyCalendarThree { private TreeMap<Integer, Integer> cnt; public MyCalendarThree() { cnt = new TreeMap<Integer, Integer>(); } public int book(int
24
0
0
【732. 我的日程安排表 III】线段树求解
摘要:class MyCalendarThree { public static void main(String[] args) { MyCalendarThree myCalendarThree = new MyCalendarThree(); System.out.println( myCalend
23
0
0
【牛客小白月赛51 F平均题】数论,前缀和
摘要:import java.io.IOException; import java.util.Scanner; public class Main { static int MOD = 1000000007; public static void main(String[] args) throws I
22
0
0
【剑指 Offer II 118. 多余的边】并查集求回路
摘要:class Solution { int[] parent; int[] rank; public void init(int n) { parent = new int[n + 1]; rank = new int[n + 1]; for (int i = 1; i <= n; i++) { pa
21
0
0
【879. 盈利计划】 动态规划
摘要://空间可以降到2维class Solution { private int MOD= 1000000007; public int profitableSchemes(int n, int minProfit, int[] g, int[] profit) { int len = profit.l
26
0
0
【450. 删除二叉搜索树中的节点】二叉树遍历
摘要:import java.util.HashMap; import java.util.Map; /** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeN
21
1
0
【473. 火柴拼正方形】深度搜索、划分、回溯
摘要://先求出和为edge的划分。再枚举划分,至多只需要枚举三个划分import java.util.ArrayList; import java.util.List; class Solution { int edge = 0; List<Integer> stateList = new ArrayL
26
0
0
//雪花飘落效果
点击右上角即可分享
微信分享提示
深色
回顶
收起