头像

山鬼_9




离线:1天前


最近来访(0)


class Solution(object):
def findNumbersWithSum(self, nums, target):
“”“
:type nums: List[int]
:type target: int
:rtype: List[int]
“”“
i1=[]
i2=[]
for j in nums:
if target-j in nums:
i1.append(target-j)
i1.append(j)
break
else:
i2.append(j)
return i1




class Solution(object):
def getMissingNumber(self, nums):
“”“
:type nums: List[int]
:rtype: int
“”“
for i in range(0,len(nums)+1):
if i not in nums:
return i




class Solution(object):
def getLeastNumbers_Solution(self, input, k):
“”“
:type input: list[int]
:type k: int
:rtype: list[int]
“”“
input.sort()
c=input[0:k]
return c