commit ef2fc75854cf819dc5ec9acef9e0ce2bd82c7c2f Author: fst1996 <2411194573@qq.com> Date: Wed Oct 4 22:56:53 2023 +0800 数组算法以及初始pom diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..73f69e0 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml +# Editor-based HTTP Client requests +/httpRequests/ diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..b81ac35 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 0000000..c2bae49 --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..6560a98 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,36 @@ + + + + \ No newline at end of file diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml new file mode 100644 index 0000000..2a89eda --- /dev/null +++ b/.idea/jarRepositories.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..4b661a5 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,14 @@ + + + + + + + + + + \ No newline at end of file diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..7777b04 --- /dev/null +++ b/pom.xml @@ -0,0 +1,97 @@ + + + 4.0.0 + + com.bwie + test-10.01 + 1.0-SNAPSHOT + + + org.junit.jupiter + junit-jupiter-api + 5.10.0-M1 + + + + org.springframework.boot + spring-boot-configuration-processor + true + 2.7.8 + + + cn.hutool + hutool-all + 5.8.18 + + + org.springframework.boot + spring-boot-starter-web + 2.7.8 + + + com.alibaba + fastjson + 1.2.67 + + + org.java-websocket + Java-WebSocket + 1.3.8 + + + com.squareup.okhttp3 + okhttp + 4.10.0 + + + org.projectlombok + lombok + 1.18.24 + + + org.slf4j + slf4j-log4j12 + 1.7.30 + + + mysql + mysql-connector-java + 5.1.32 + + + org.mybatis.spring.boot + mybatis-spring-boot-starter + 2.3.1 + + + org.springframework.boot + spring-boot-starter-aop + 2.7.2 + + + org.json + json + 20210307 + + + commons-codec + commons-codec + 1.15 + + + com.amazonaws + aws-java-sdk-s3 + 1.12.68 + + + + com.amazonaws + aws-java-sdk-core + 1.12.68 + + + + + diff --git a/src/main/java/com/bwie/test/Test01.java b/src/main/java/com/bwie/test/Test01.java new file mode 100644 index 0000000..646f02e --- /dev/null +++ b/src/main/java/com/bwie/test/Test01.java @@ -0,0 +1,25 @@ +package com.bwie.test; + +import org.junit.jupiter.api.Test; + +/** + * 算法 + */ +public class Test01 { + @Test + public int canJump(int[] nums) { + int maxIndex = 0; // 每次跳跃后的最大边界 + int step = 0; // 记录跳跃步数 + int end = 0; // 每一次搜完一层后更新end,并且将步数加1,直到可以跳到最后一格 + for (int i = 0; i < nums.length - 1; i++) { + if (maxIndex >= i) { + maxIndex = Math.max(maxIndex, i + nums[i]); // 找到下次可以到达的最远边界。 + if (i == end) { // 如果已经搜完了这一层,就将步数加1,并更新end的位置。 + end = maxIndex; + step++; + } + } + } + return step; + } +} diff --git a/target/classes/com/bwie/test/Test01.class b/target/classes/com/bwie/test/Test01.class new file mode 100644 index 0000000..d9f6315 Binary files /dev/null and b/target/classes/com/bwie/test/Test01.class differ diff --git a/target/maven-archiver/pom.properties b/target/maven-archiver/pom.properties new file mode 100644 index 0000000..0c2efea --- /dev/null +++ b/target/maven-archiver/pom.properties @@ -0,0 +1,5 @@ +#Generated by Maven +#Wed Oct 04 22:55:50 CST 2023 +version=1.0-SNAPSHOT +groupId=com.bwie +artifactId=test-10.01 diff --git a/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst new file mode 100644 index 0000000..408068a --- /dev/null +++ b/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst @@ -0,0 +1 @@ +com\bwie\test\Test01.class diff --git a/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst new file mode 100644 index 0000000..e00223c --- /dev/null +++ b/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst @@ -0,0 +1 @@ +D:\lv6\test-10.01\src\main\java\com\bwie\test\Test01.java diff --git a/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst b/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst new file mode 100644 index 0000000..e69de29 diff --git a/target/test-10.01-1.0-SNAPSHOT.jar b/target/test-10.01-1.0-SNAPSHOT.jar new file mode 100644 index 0000000..58af6c8 Binary files /dev/null and b/target/test-10.01-1.0-SNAPSHOT.jar differ diff --git a/test-10.01.iml b/test-10.01.iml new file mode 100644 index 0000000..78b2cc5 --- /dev/null +++ b/test-10.01.iml @@ -0,0 +1,2 @@ + + \ No newline at end of file