modify code order

pull/6/head
左程云 4 years ago
parent df33454323
commit a3bc767b31

@ -23,8 +23,11 @@ public class Code01_SumOfSubarrayMinimums {
return ans;
}
// 没有用单调栈
public static int subArrayMinSum2(int[] arr) {
// left[i] = x : arr[i]左边离arr[i]最近,<=arr[i]位置在x
int[] left = leftNearLessEqual2(arr);
// right[i] = y : arr[i]右边离arr[i]最近,< arr[i],的数位置在y
int[] right = rightNearLess2(arr);
int ans = 0;
for (int i = 0; i < arr.length; i++) {

@ -30,6 +30,7 @@ public class Code02_FibonacciProblem {
return res;
}
// O(logN)
public static int f3(int n) {
if (n < 1) {
return 0;
@ -52,14 +53,13 @@ public class Code02_FibonacciProblem {
for (int i = 0; i < res.length; i++) {
res[i][i] = 1;
}
// res = 矩阵中的1
int[][] tmp = m;// 矩阵1次方
int[][] t = m;// 矩阵1次方
for (; p != 0; p >>= 1) {
if ((p & 1) != 0) {
res = muliMatrix(res, tmp);
res = muliMatrix(res, t);
}
tmp = muliMatrix(tmp, tmp);
t = muliMatrix(t, t);
}
return res;
}

@ -1,4 +1,4 @@
package class28;
package class27;
public class Code01_KMP {
// O(N)

@ -1,4 +1,4 @@
package class28;
package class27;
import java.util.ArrayList;

@ -1,4 +1,4 @@
package class28;
package class27;
public class Code03_IsRotation {

@ -1,4 +1,4 @@
package class29;
package class28;
public class Code01_Manacher {

@ -1,4 +1,4 @@
package class29;
package class28;
public class Code02_AddShortestEnd {

@ -1,4 +1,4 @@
package class27;
package class29;
import java.util.Comparator;
import java.util.PriorityQueue;

@ -1,4 +1,4 @@
package class27;
package class29;
import java.util.Arrays;

@ -1,4 +1,4 @@
package class27;
package class29;
public class Code03_ReservoirSampling {
Loading…
Cancel
Save