08 2020 档案

摘要:爬楼梯 点击标题可跳转到官网进行查看 假设你正在爬楼梯。需要 n 阶你才能到达楼顶。 每次你可以爬 1 或 2 个台阶。你有多少种不同的方法可以爬到楼顶呢? 注意:给定 n 是一个正整数。 示例 1: 输入: 2 输出: 2 解释: 有两种方法可以爬到楼顶。 1. 1 阶 + 1 阶 2. 2 阶 阅读全文
posted @ 2020-08-10 21:03 jiew-c 阅读(132) 评论(0) 推荐(0)
摘要:53. 最大子序和 点击标题即可跳转到LeetCode官网进行查看,提交代码 给定一个整数数组 nums ,找到一个具有最大和的连续子数组(子数组最少包含一个元素),返回其最大和。 示例: 输入: [-2,1,-3,4,-1,2,1,-5,4] 输出: 6 解释: 连续子数组 [4,-1,2,1] 阅读全文
posted @ 2020-08-09 22:15 jiew-c 阅读(116) 评论(0) 推荐(0)
摘要:35. Search Insert Position Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would b 阅读全文
posted @ 2020-08-09 21:21 jiew-c 阅读(155) 评论(0) 推荐(0)
摘要:Implement strStr(). Return the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack. Example 1: Input: haystac 阅读全文
posted @ 2020-08-07 21:01 jiew-c 阅读(222) 评论(0) 推荐(0)
摘要:给你一个数组 nums 和一个值 val,你需要 原地 移除所有数值等于 val 的元素,并返回移除后数组的新长度。 不要使用额外的数组空间,你必须仅使用 O(1) 额外空间并 原地 修改输入数组。 元素的顺序可以改变。你不需要考虑数组中超出新长度后面的元素。 示例 1: 给定 nums = [3, 阅读全文
posted @ 2020-08-06 21:13 jiew-c 阅读(119) 评论(0) 推荐(0)