leetcode Two Sum ----python3
来源:互联网 发布:mac装win10后启动黑屏 编辑:程序博客网 时间:2024/06/07 22:52
看完网上的想法自己写出来的,也算抄了一下把
class Solution: def twoSum(self, nums, target): """ :type nums: List[int] :type target: int :rtype: List[int] """ key_list = [] value_list =[] lens = len(nums) for i in range(lens): key_list.append(i) value_list.append(nums[i]) n = target - nums[i] try: j = value_list.index(n) if j is not None and j<i: return[i,j] except ValueError as err: pass
阅读全文
0 0
- leetcode Two Sum ----python3
- 【Leetcode】Two Sum (Sum)
- LeetCode: Two Sum
- LeetCode: Two Sum
- [Leetcode] Two Sum
- LeetCode : Two Sum
- Leetcode: Two Sum
- leetcode 46: Two Sum
- [LeetCode] Two Sum
- LeetCode 1 - Two Sum
- Leetcode : Two Sum
- 【leetcode】Two Sum
- [LeetCode]Two Sum
- leetcode Two Sum
- [Leetcode] Two Sum
- [leetcode] Two Sum
- LeetCode - Two Sum
- leetcode之Two Sum
- 1004. Counting Leaves (30)
- UVa 1586 水题
- 在WPF中添加WINFORM控件的方法
- github第一天学习总结
- BMA250E 加速度传感器和插接板,用于移动消费类电子产品
- leetcode Two Sum ----python3
- 电子线路设计技巧7:UC3843A升压电路中振荡频率和占空比的确定方法
- 吴恩达Coursera深度学习课程 DeepLearning.ai 编程作业(4-1)
- wiringpi安装编译问题解决
- 【python】【excel读写 模块】
- 找第一个只出现一次的字符
- 2008-2009 ACM-ICPC, NEERC, Southern Subregional Contest
- java.lang.ClassNotFoundException: Cannot find class: BaseResultMap
- 写给自己