We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent fa25fab commit 23e979aCopy full SHA for 23e979a
problems/0674.最长连续递增序列.md
@@ -156,7 +156,31 @@ public:
156
157
158
Java:
159
-
+```java
160
+ /**
161
+ * 1.dp[i] 代表当前下表最大连续值
162
+ * 2.递推公式 if(nums[i+1]>nums[i]) dp[i+1] = dp[i]+1
163
+ * 3.初始化 都为1
164
+ * 4.遍历方向,从其那往后
165
+ * 5.结果推导 。。。。
166
+ * @param nums
167
+ * @return
168
+ */
169
+ public static int findLengthOfLCIS(int[] nums) {
170
+ int[] dp = new int[nums.length];
171
+ for (int i = 0; i < dp.length; i++) {
172
+ dp[i] = 1;
173
+ }
174
+ int res = 1;
175
+ for (int i = 0; i < nums.length - 1; i++) {
176
+ if (nums[i + 1] > nums[i]) {
177
+ dp[i + 1] = dp[i] + 1;
178
179
+ res = res > dp[i + 1] ? res : dp[i + 1];
180
181
+ return res;
182
183
+```
184
185
Python:
186
0 commit comments