没有合适的资源?快使用搜索试试~ 我知道了~
leetcode添加元素使和等于-DailyAlgorithm:leetcode刷题笔记
共93个文件
py:83个
md:10个
需积分: 10 0 下载量 174 浏览量
2021-06-30
06:45:53
上传
评论
收藏 122KB ZIP 举报
温馨提示
leetcode添加元素使和等于 leetcode进阶之路,道阻且长 1.数组之和 ### 解题之前需要先想好各种可能情况,比如[],[1],[3,3],[1,2,3,4,3]等特殊情况 示例: 给定 nums = [2, 7, 11, 15], target = 9 因为 nums[0] + nums[1] = 2 + 7 = 9 所以返回 [0, 1] ''' #获取list中的值和索引的对应关系 cc = [1, 2, 3, 2, 4] from collections import defaultdict dd = defaultdict(list) for k, va in [(v,i) for i, v in enumerate(cc)]: dd[k].append(va) print(dd) ''' def twoSum(self, nums, target): res = [] for index,i in enumerate(nums):#enumerate同时获取索引和值 temp = [] b = target - i if b in nums[index+1:]
资源推荐
资源详情
资源评论
收起资源包目录
DailyAlgorithm-master.zip (93个子文件)
DailyAlgorithm-master
Tree_5
tree_traversals.py 4KB
README.md 14KB
DFSAndRecursive_20
README.md 8KB
leetcode
longestCommonPrefix.py 601B
threeSum.py 3KB
ZigzagTransformation.py 1010B
nextPermutation.py 1KB
isPalindrome.py 381B
letterCombinations.py 3KB
removeNthFromEnd.py 666B
removeElement.py 1KB
romanToInt.py 1KB
strToInt.py 251B
generateParenthesis.py 2KB
strStr.py 495B
isMatch.py 1KB
swapPairs.py 1KB
mergeTwoLists.py 1KB
threeSumClosest.py 3KB
FindMedia.py 2KB
maxArea.py 1KB
__init__.py 101B
twoSum.py 730B
fourSum.py 1KB
longestValidParentheses.py 1KB
findSubstring.py 1KB
FindTheLongestReturnString.py 4KB
divide.py 2KB
ReversInteger.py 672B
twoNumAdd.py 2KB
reverseKGroup.py 2KB
isValid.py 870B
intToRoman.py 940B
mergeKLists.py 996B
longestSubstringWithoutRepeatingCharacters.py 1KB
BinarySearchAndDivide_15
README.md 16KB
TwoPoint_10
README.md 2KB
DynamicProgramming_30
arraySonSum.py 1KB
0-1Bag.py 1KB
coinChange.py 596B
HouseRobberII_213.py 1KB
HouseRobber198.py 749B
README.md 35KB
Sort
sort_top10.py 6KB
README.md 7KB
README.md 39KB
Link_20
README.md 15KB
HashTable_8
README.md 3KB
swardToOffer
twoCharTress.py 3KB
longestCommonPrefix.py 1KB
LeftRotateString.py 742B
isNumeric.py 2KB
Add.py 737B
deleteDuplication.py 2KB
twoCharSearchTreeAndBiLink.py 2KB
IsBalanced_Solution.py 1KB
printListFromTailToHead.py 741B
PrintMinNumber.py 1KB
permutations.py 1KB
Print_twoChatTreeMultiRows.py 1KB
Print_zhizi.py 2KB
EntryNodeOfLoop.py 2KB
KthNode.py 1KB
GetUglyNumber_Solution.py 2KB
medianOfDataStream.py 593B
FirstNotRepeatingChar.py 1KB
Sum_Solution.py 542B
FindFirstCommonNode.py 3KB
StrToInt.py 1KB
IsContinuous.py 2KB
NumberOf1Between1AndN_Solution.py 494B
ReverseSentence.py 718B
duplicate.py 957B
FindContinuousSequence.py 909B
serializeAndDeserialize.py 1KB
FirstAppearingOnce.py 596B
fromOneToNHaveOne.py 1KB
FindNumsAppearOnce.py 676B
isSymmetrical.py 1KB
GetNext.py 3KB
TreeDepth.py 1KB
match.py 2KB
GetNumberOfK.py 2KB
LinkNode.py 4KB
copyComplexLink.py 1KB
charArray.py 380B
Find.py 909B
LastRemaining_Solution.py 682B
FindNumbersWithSum.py 767B
multiply.py 574B
replaceSpace.py 661B
InversePairs.py 4KB
BFSAndTopologicalSort_8
README.md 5KB
共 93 条
- 1
资源评论
weixin_38745925
- 粉丝: 28
- 资源: 890
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功