# 转载请注明出处 http://blog.youkuaiyun.com/qq_34175893/article/details/79635054
# 打算开始用python学习算法,并进行一系列的学习过程及心得体会的记录,欢迎大家持续关注,一起学习。欢迎大家提出意见或建议
# 不关心问题的解决,只关心不同的解决的问题的思路
在每一个solution前面我都会标明该solution所用时间以及排名,部分优秀的solution还会解析一下思路
# _*_ coding:utf-8 _*_
# 7021ms 2.82%
class Solution0(object):
def twoSum(self, nums, target):
"""
:type nums: List[int]
:type target: int
:rtype: List[int]
"""
numc = nums
for a,i in enumerate(nums):
for b,j in enumerate(numc):
if i+j == target and a != b:
return [a,b]
# 5068ms 22.43%
class Solution1(object):
def twoSum(self, nums, target):
"""
:type nums: List[int]
:type target: in