public class Solution
{
public int FindLengthOfLCIS(int[] nums)
{
var len = nums.Length;
if (len < )
{
return len;
} var last = nums[];
int max = ;
int inc = ;
for (int i = ; i < len; i++)
{
if (last >= nums[i])
{
max = inc > max ? inc : max;
inc = ;
}
else if (last < nums[i])
{
inc++;
}
last = nums[i];
}
return max > inc ? max : inc;
}
}

大体思路是正确的,有些细节没有考虑清楚。参考了网上的答案进行了修正。

leetcode674的更多相关文章

  1. [Swift]LeetCode674. 最长连续递增序列 | Longest Continuous Increasing Subsequence

    Given an unsorted array of integers, find the length of longest continuous increasing subsequence (s ...

  2. Leetcode674.Longest Continuous Increasing Subsequence最长连续递增序列

    给定一个未经排序的整数数组,找到最长且连续的的递增序列. 示例 1: 输入: [1,3,5,4,7] 输出: 3 解释: 最长连续递增序列是 [1,3,5], 长度为3. 尽管 [1,3,5,7] 也 ...

  3. LeetCode674. 最长连续递增序列

    原题链接 1 class Solution: 2 def findLengthOfLCIS(self, nums: List[int]) -> int: 3 ans = begin = 0 4 ...

随机推荐

  1. Android:BroadcastReceiver

    参考:<第一行代码:Android> 郭霖(著)   Broadcast分类 注册方式: 动态广播 在代码中注册receiver 一定要手动在onDestroy()时调用unregiste ...

  2. HDU3652 B-number 数位DP第二题

    A wqb-number, or B-number for short, is a non-negative integer whose decimal form contains the sub- ...

  3. Bezier曲线原理—动态解释

    公式线性公式给定点P0.P1,线性贝兹曲线只是一条两点之间的直线.且其等同于线性插值.这条线由下式给出: 一阶贝赛尔曲线上的由两个点确定 P0 和P1,当t在0--->1区间上递增时,根据此会得 ...

  4. test20190320

    全连 \(n\leq 10^6\) ,保证答案在 \(long\ long​\) 范围内. 比较浅显的 \(dp\ ?\) 记 \(f[i]\) 表示考虑前 \(i\) 个音符,其中第 \(i\) 个 ...

  5. RNG—随机数产生器

    RNG 随机数产生器 RNG g_rng(12345); /********************************************************************** ...

  6. WPF自定义控件之图形解锁控件 ScreenUnLock

    ScreenUnLock 与智能手机上的图案解锁功能一样.通过绘制图形达到解锁或记忆图形的目的. 本人突发奇想,把手机上的图形解锁功能移植到WPF中.也应用到了公司的项目中. 在创建ScreenUnL ...

  7. 用Eclipse进行java学习的步骤

    用Eclipse进行java学习的步骤(1)File,new,File Project->在New Java Project页面的Project name文本框中填入名称,点击finish(2) ...

  8. MySQL出现1030-Got error 28 from storage engine错误

    Navicat for MySQL出现1030-Got error 28 from storage engine错误  刚刚还能用这会儿就用不了了,估计是磁盘空间不足引起的! 在根目录/下执行命令:d ...

  9. 笔记本启动时提示错误:amd_xata.sys数字签名无法验证

    开机失败,提示adm文件无法验证 文件:Windows\system32\drivers\amd_xata.sys 状态:0xc0000428 信息:Windows 无法验证此文件的数字签名   工具 ...

  10. Unit05: JavaScript对象概述 、 常用内置对象一 、 常用内置对象二 、 常用内置对象三

    Unit05: JavaScript对象概述 . 常用内置对象一 . 常用内置对象二 . 常用内置对象三 常用内置对象使用演示: <!DOCTYPE html> <html> ...