nums
-
leecode.1. 两数之和
给定一个整数数组 nums 和一个整数目标值 target,请你在该数组中找出 和为目标值 target 的那 两个 整数,并返回它们的数组下标。 你可以假设每种输入只会对应一个…
-
LEETCODE数组嵌套
题目:数组嵌套 索引从0开始长度为N的数组A,包含0到N – 1的所有整数。找到最大的集合S并返回其大小,其中 S[i] = {A[i], A[A[i]], A[A[A[i]]],…
-
2.生成10个随机数保存于数组中,并找出其最大值和最小值
2.生成10个随机数保存于数组中,并找出其最大值和最小值 [root@CentOS8 ~]# cat array_max_min.sh !/bin/bash ***********…
-
LeetCode 704 Binary Search 模板
Given an array of integers nums which is sorted in ascending order, and an integer target,…
-
Leetcode 198/213/337 House Robber
198. 已知是非负数组,小偷去抢,偷完一家后,不能再偷邻居,即不能拿隔壁的。 没有排序,没有连续 s0=H0=1; S1=max(S0,H1)=2 S2=max(S1,S0+H…
-
LeetCode 704 Binary Search 模板
Given an array of integers nums which is sorted in ascending order, and an integer target,…
-
算法训练营
1. 快速排序 public static void main(String[] args) { int[] nums = {-1,0,1,2,-1,-4}; quickSort(…
-
排序算法之冒泡排序、插入排序、选择排序,查找算法之二分查找
排序算法 排序算法的概念, 我们将对数组进行排序来实现几种不同的排序算法,让大家更好的体会不同算法中的执行过程 冒泡排序 概念 1、比较相邻的元素。如果第一个比第二个大,就交换他们…
-
Python ACM 模式下的输入输出
与leetcode的核心代码模式不同,acm模式下需要自己编写输入与输出函数。推荐以下几个网站练习acm模式:牛客网:OJ在线编程常见输入输出练习场牛客网:华为机试 AcWing …
-
JS/TS算法—状态压缩
位运算 位运算符 ‘&'(与),有0则0 ‘|'(或),有1则1 ‘^'(异或) ,相同为0,不同为1———–位运算中常用 …