offer411--两个数字之和为s
来源:互联网 发布:windows 运行ios 编辑:程序博客网 时间:2024/06/06 09:48
# coding=utf-8def counts(array, s): if array is None: return 0 i = 0 j = len(array) - 1 while i < j: if array[i] + array[j] > s: j -= 1 elif array[i] + array[j] < s: i += 1 else: print array[i], array[j] j -= 1 i += 1 pass pass passdef main(): array = [1, 2, 3, 4, 5, 6, 7, 8, 9] counts(array, 9) passif __name__ == '__main__': main() pass
阅读全文
0 0
- offer411--两个数字之和为s
- 牛客网刷题之和为S的两个数字
- 剑指Offer之和为S的两个数字
- 剑指offer面试题之和为S的两个数字
- 剑指offer(二十一)之和为S的两个数字
- 剑指offer之和为S的两个数字
- 【剑指offer之和为s的两个数字VS和为s的连续正数序列】
- 和为S的两个数字之和&&和为s的连续正数序列
- 【剑指offer】之和为给定值的两个数字
- 1、找到数组里两个数字之和为某个值
- 和为S的两个数字
- 和为S的两个数字
- 找出和为S的两个数字
- 和为S的两个数字
- 何为s的两个数字
- 【5】和为s的两个数字
- 和为S的两个数字
- 和为s的两个数字
- 方差分析
- 分布式与集群的区别
- @controller和@RestController的用法小结
- nginx反向代理时通过rewrite解决后端资源css/js/img 写了绝对路径的问题
- 学生管理系统---小问题总结
- offer411--两个数字之和为s
- git版本控制器使用(一)
- 全面解析javascript事件流模型以及各事件流模型在浏览器中的兼容性情况
- postgre实现类似Oracle的trunc日期函数
- web.xml基本配置
- 102 复习习题:最值题
- 个人总结12
- java泛型中的通配符 extends与super
- Oracle中sqlldr的使用