一个排好序的数组,找出两数之和为m的所有组合
来源:互联网 发布:linux安装php和nginx 编辑:程序博客网 时间:2024/05/16 15:01
- public static void main(String[] args) throws UnsupportedEncodingException {
- int[] ints = { 1, 3, 10, 12 , 13, 18, 22 ,58 };
- int find = 23;
- int start = 0;
- int end = ints.length - 1;
- while (ints[start] >= find) {
- System.out.println("都比他-------------------------------大哦!");
- return;
- }
- while (end > start) {
- if (ints[start] + ints[end] == find) {
- System.out.println(ints[start] + " + " + ints[end] + " = "
- + find);
- end--;
- start++;
- } else if (ints[start] + ints[end] < find) {
- start++;
- } else if (ints[start] + ints[end] > find) {
- end--;
- }
- System.out.println(start +" "+end);
- }
- }
0 0
- 一个排好序的数组,找出两数之和为M的所有组合
- 一个排好序的数组,找出两数之和为m的所有组合
- 一个数组,找出两数之和为m的所有组合
- 一个数组,找出两数之和为m的所有组合
- 排好序的数组中,找出两数之和为m的所有组合
- 给定一个无序整形数组,找出其中所以三个数之和为0的所有组合
- 在一个排序数组里面找出所有和为m的组合
- 从数组中找出所有组合为s的数
- 从长度为N的数组中找出所有M个元素组合的优化算法
- 找出数组中两个数之和为指定的数
- 在一个数组中找出几个数之和为指定的数
- 笔试题:写一个有序整数数组两两之和等于某个数所有组合
- 求从一个整数数组中两个数之和为m的两个数
- 找出数组中和为N+1的的所有组合
- [LeetCode] 3Sum 找出所有三个元素之和为0的组合
- 求一个数组里面所有和等于m的组合
- 长度为n的数组,有一个数m重复出现了n/2+1次,找出这个数
- 微软100题(21)1到n找出所有的和为m的组合
- VMware安装Ubuntu及基本设置
- 在CentOS上安装Java环境:[1]使用yum安装java
- Mycat 数据库分库分表中间件
- 【BZOJ3590】[Snoi2013]Quare【双连通分量】【状压DP】【神题】
- Linux定时关机说明
- 一个排好序的数组,找出两数之和为m的所有组合
- Spring Boot Web应用的异常处理
- 【bzoj4455】[Zjoi2016]小星星
- Oracle 数据库转码 US7ASCII ZHS16GBK
- 153 mysql索引优化入门
- Android权限扫描工具
- linux命令记录
- Android自定义控件系列九:从源码看Android触摸事件分发机制
- MyCat:开源分布式数据库中间件