資源簡介
python習題

代碼片段和文件信息
“““
Given?an?array?of?integers?return?indices?of?the?two?numbers
such?that?they?add?up?to?a?specific?target.
You?may?assume?that?each?input?would?have?exactly?one?solution
and?you?may?not?use?the?same?element?twice.
Example:
????Given?nums?=?[2?7?11?15]?target?=?9
????Because?nums[0]?+?nums[1]?=?2?+?7?=?9
????return?[0?1].
“““
#?和為目標值即目標值與其中一數(shù)的差在數(shù)組中
class?Solution:
????def?twoSum(self?nums?target):
????????“““
????????:type?nums:?List[int]
????????:type?target:?int
????????:rtype:?List[int]
????????“““
????????dict_temp?=?{}
????????for?i?value?in?enumerate(nums):
????????????if?value?in?dict_temp:
????????????????return(dict_temp[value]?i)
????????????else:
????????????????dict_temp[target?-?value]?=?i
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2019-01-17?17:33??leetcode_python-master\
?????目錄???????????0??2019-01-17?17:33??leetcode_python-master\001-100\
?????文件?????????768??2019-01-17?17:33??leetcode_python-master\001-100\001_twoSum.py
?????文件?????????810??2019-01-17?17:33??leetcode_python-master\001-100\007_reverseInteger.py
?????文件????????2757??2019-01-17?17:33??leetcode_python-master\001-100\008_stringtiInteger.py
?????文件?????????806??2019-01-17?17:33??leetcode_python-master\001-100\009_palindromeNumber.py
?????文件????????2288??2019-01-17?17:33??leetcode_python-master\001-100\013_romantoInteger.py
?????文件?????????866??2019-01-17?17:33??leetcode_python-master\001-100\014_longestCommonPrefix.py
?????文件?????????872??2019-01-17?17:33??leetcode_python-master\001-100\019_removeNthNodeFromEndofLiist.py
?????文件?????????848??2019-01-17?17:33??leetcode_python-master\001-100\020_validParentheses.py
?????文件????????1625??2019-01-17?17:33??leetcode_python-master\001-100\026_removeDuplicatesfromSortedArray.py
?????文件????????1738??2019-01-17?17:33??leetcode_python-master\001-100\027_removeElement.py
?????文件?????????855??2019-01-17?17:33??leetcode_python-master\001-100\028_implementstrStr.py
?????文件?????????827??2019-01-17?17:33??leetcode_python-master\001-100\035_searchInsertPosition.py
?????文件?????????946??2019-01-17?17:33??leetcode_python-master\001-100\038_countandSay.py
?????文件?????????781??2019-01-17?17:33??leetcode_python-master\001-100\043_multiplyStrings.py
?????文件?????????587??2019-01-17?17:33??leetcode_python-master\001-100\046_permytations.py
?????文件????????1100??2019-01-17?17:33??leetcode_python-master\001-100\048_rotateImage.py
?????文件?????????732??2019-01-17?17:33??leetcode_python-master\001-100\058_lengthofLastWord.py
?????文件?????????896??2019-01-17?17:33??leetcode_python-master\001-100\066_plusOne.py
?????文件?????????475??2019-01-17?17:33??leetcode_python-master\001-100\067_addBinary.py
?????文件?????????723??2019-01-17?17:33??leetcode_python-master\001-100\070_climbingStairs.py
?????文件?????????778??2019-01-17?17:33??leetcode_python-master\001-100\088_mergeSortedArray.py
?????目錄???????????0??2019-01-17?17:33??leetcode_python-master\101-200\
?????文件?????????650??2019-01-17?17:33??leetcode_python-master\101-200\118_pascalsTriangle.py
?????文件????????1407??2019-01-17?17:33??leetcode_python-master\101-200\122_bestTimetoBuyandSellStockII.py
?????文件?????????581??2019-01-17?17:33??leetcode_python-master\101-200\125_validPalindrome.py
?????文件?????????552??2019-01-17?17:33??leetcode_python-master\101-200\136_singleNumber.py
?????文件????????1260??2019-01-17?17:33??leetcode_python-master\101-200\141_li
?????文件?????????860??2019-01-17?17:33??leetcode_python-master\101-200\169_majorityElement.py
?????文件?????????631??2019-01-17?17:33??leetcode_python-master\101-200\171_excelSheetColumnNumber.py
............此處省略59個文件信息
評論
共有 條評論