06 2022 档案
摘要: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
阅读全文
摘要:要特别注意下精度,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
阅读全文
摘要:import java.util.*; class Solution { public static void main(String[] args) { Solution solution = new Solution(); System.out.println(solution.minimumN
阅读全文
摘要:class Solution { public static void main(String[] args) { Solution solution = new Solution(); System.out.println(solution.longestSubsequence("1001010"
阅读全文
摘要:class Solution { public static void main(String[] args) { Solution solution = new Solution(); solution.countSubarrays(new int[]{ 2,1,4,3,5 },10); } pu
阅读全文
摘要:import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.Arrays; public class Main { public static void main(String[] args) t
阅读全文
摘要:import java.util.HashSet; import java.util.Set; class Solution { public long distinctNames(String[] ideas) { int[][] cnt = new int[26][26]; boolean[][
阅读全文
摘要: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
阅读全文
摘要:import java.util.Arrays; class Solution { public int numSubseq(int[] nums, int target) { Arrays.sort(nums); int len = nums.length; long ans = 0l; for
阅读全文
摘要: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
阅读全文
摘要:class Solution { public static void main(String[] args) { Solution solution = new Solution(); int ans = solution.videoStitching(new int[][]{ {8,10},{1
阅读全文
摘要://只需要考虑前6位的状态,i这种状态和i+6这个状态是一样的import java.util.ArrayDeque; import java.util.Arrays; import java.util.HashSet; class Solution { public static void mai
阅读全文
摘要:class MyCalendarThree { private TreeMap<Integer, Integer> cnt; public MyCalendarThree() { cnt = new TreeMap<Integer, Integer>(); } public int book(int
阅读全文
摘要:class MyCalendarThree { public static void main(String[] args) { MyCalendarThree myCalendarThree = new MyCalendarThree(); System.out.println( myCalend
阅读全文
摘要:import java.io.IOException; import java.util.Scanner; public class Main { static int MOD = 1000000007; public static void main(String[] args) throws I
阅读全文
摘要: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
阅读全文
摘要://空间可以降到2维class Solution { private int MOD= 1000000007; public int profitableSchemes(int n, int minProfit, int[] g, int[] profit) { int len = profit.l
阅读全文
摘要:import java.util.HashMap; import java.util.Map; /** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeN
阅读全文
摘要://先求出和为edge的划分。再枚举划分,至多只需要枚举三个划分import java.util.ArrayList; import java.util.List; class Solution { int edge = 0; List<Integer> stateList = new ArrayL
阅读全文

浙公网安备 33010602011771号