nums
-
leetcode 45 跳跃游戏 最少次数 C/C++ 动态规划
动态转移方程 dp[pos] = min{dp[pos-k] +1} 当a[pos-k] >= k , k 是两次状态之间a的物理距离。 动态规划并不是这个例…
-
Python文件和异常(五)
一、从文件中读取数据 open()函数 参数 file 文件路径 mode mode参数 可做操作 若文件不存在 如何处理原内容 r 只可读 报错 – r+ 可读可写 …
-
Review binary search
33. 搜索旋转排序数组 – 力扣(LeetCode)81. 搜索旋转排序数组 II – 力扣(LeetCode)153. 寻找旋转排序数组中的最小值 &#…
-
用java实现二分查找
/** *调用erfen方法,输入数据int[] s= {0,1,2,3,4,5}和8,输出方法的返回值 */ public class Erfen { public int se…
-
leetcode198:打家劫舍
package com.mxnet; public class Solution198 { public static void main(String[] args) { } /…
-
[Oracle] LeetCode 1802 Maximum Value at a Given Index in a Bounded Array
You are given three positive integers: n, index, and maxSum. You want to construct an arra…
-
654. 最大二叉树
654. 最大二叉树 给定一个不重复的整数数组 nums 。 最大二叉树 可以用下面的算法从 nums 递归地构建: 创建一个根节点,其值为 nums 中的最大值。 递归地在最大值…
-
算法性能技巧
算法性能提升总结 巧用hash表 利用hash,来进行映射,从而降低代码的复杂度,和冗余度 eg: 求两个数之和 class Solution: def twoSum(self, …
-
LeetCode 169 Majority Element
Given an array nums of size n, return the majority element. The majority element is the el…
-
力扣-刷题-324. 摆动排序 II
题目链接 来源:力扣(LeetCode)链接:https://leetcode.cn/problems/wiggle-sort-ii著作权归领扣网络所有。商业转载请联系官方授权,非…