![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
算法
明夕何夕-
这个作者很懒,什么都没留下…
展开
-
二分查找
二分查找package array;/*二分查找 * * 寻找要寻找的数的位置 * */public class Array5 { public static void main(String[] args) { // 写一个有序数组 int[] array = new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9 }; // 这里可以设置为键盘...原创 2019-03-31 18:44:01 · 104 阅读 · 0 评论 -
数组
声明数组package array;public class Array1 { public static void main(String[] args) { //定义声明数组的方法 int[] arr=new int[10]; // int[] arr1= {1,2,3}; // int[] arr2; arr2= new int[10]; // a...原创 2019-04-05 14:57:36 · 224 阅读 · 0 评论 -
LeetCode练习(1)
给定一个整数数组 nums 和一个目标值 target,请你在该数组中找出和为目标值的那 两个 整数,并返回他们的数组下标。目标是减少时间,以空间换时间的目的。你可以假设每种输入只会对应一个答案。但是,你不能重复利用这个数组中同样的元素。示例:给定 nums = [2, 7, 11, 15], target = 9因为 nums[0] + nums[1] = 2 + 7 = 9所以返回...原创 2019-04-05 15:52:55 · 518 阅读 · 0 评论