51
Dev开发社区
首页
文章
问答
工具
搜索
登录
注册
#leetCode
LeetCode 50 N-Queens
The n-queenspuzzleistheproblemofplacing n queensonan n×n chessboardsuchthatnotwoqueensattackeachother.Givenaninteger n,returnalldi...
代码星球
·
2020-08-25
LeetCode
N-Queens
[LeetCode] Find Minimum in Rotated Sorted Array
Supposeasortedarrayisrotatedatsomepivotunknowntoyoubeforehand.(i.e., Followup for"FindMinimuminRotatedSortedArray":Whatif duplicates&nb...
代码星球
·
2020-08-21
LeetCode
Find
Minimum
in
Rotated
[leetcode]Scramble String
3Ddp问题 classSolution{public:boolisScramble(strings1,strings2){//StarttypingyourC/C++solutionbelow//DONOTwriteintmain()functionintN=s1.size();if(N!=s2.size(...
代码星球
·
2020-08-09
leetcode
Scramble
String
[leetcode]Partition List
/***Definitionforsingly-linkedlist.*structListNode{*intval;*ListNode*next;*ListNode(intx):val(x),next(NULL){}*};*/classSolution{public:ListNode*partition(ListNo...
代码星球
·
2020-08-09
leetcode
Partition
List
leetcode 查找每个元素都出现两次的列表,返回只出现一次的元素
Givenanarrayofintegers,everyelementappears#twiceexceptforone.Findthatsingleone.classSolution(object):defsingleNumber(self,nums):""":typenums:List[int]:rtype:int...
代码星球
·
2020-08-09
元素
出现
leetcode
查找
每个
leetcode 58-> Length of Last Word
Givenastring s consistsofupper/lower-casealphabetsandemptyspacecharacters '',returnthelengthoflastwordinthestring.Ifthelastworddoesnotexist...
代码星球
·
2020-08-09
leetcode
Length
of
Last
Word
leetcode 53-> Maximum Subarray
Givenanintegerarray nums,findthecontiguoussubarray (containingatleastonenumber)whichhasthelargestsumandreturnitssum.classSolution(object):defmax...
代码星球
·
2020-08-09
leetcode
Maximum
Subarray
leetcode 46-> Permutations
Givenacollectionof distinct integers,returnallpossiblepermutations.classSolution(object):defpermute(self,nums):""":typenums:List[int]:rtype:List...
代码星球
·
2020-08-09
leetcode
Permutations
leetcode 29-> Divide Two Integers without using multiplication, division and mod operator
classSolution(object):defdivide(self,dividend,divisor):""":typedividend:int:typedivisor:int:rtype:int"""ispositive=Trueifdividend>0anddivisor<0:ispo...
代码星球
·
2020-08-09
leetcode
Divide
Two
Integers
without
leetcode 19-> Remove Nth Node From End of List
#Definitionforsingly-linkedlist.#classListNode(object):#def__init__(self,x):#self.val=x#self.next=NoneclassSolution(object):defremoveNthFromEnd(self,head,...
代码星球
·
2020-08-09
leetcode
Remove
Nth
Node
From
leetcode 18-> 4Sum
classSolution(object):deffourSum(self,nums,target):""":typenums:List[int]:typetarget:int:rtype:List[List[int]]"""l=len(nums)nums.sort()ifl<4:return[]re...
代码星球
·
2020-08-09
leetcode
4Sum
leetcode 17-> Letter Combinations of a Phone Number
classSolution(object):defletterCombinations(self,digits):""":typedigits:str:rtype:List[str]"""ifdigits=="":return[]nums_to_letters={2:"abc",3:"def",4:"ghi...
代码星球
·
2020-08-09
leetcode
Letter
Combinations
of
Phone
leetcode 16-> 3Sum Closest
Givenanarray nums of n integersandaninteger target,findthreeintegersin nums suchthatthesumisclosestto target.Retur...
代码星球
·
2020-08-09
leetcode
3Sum
Closest
leetcode 15-> 3Sum
classSolution(object):defthreeSum(self,nums):res=[]nums.sort()foriinxrange(len(nums)-2):ifi>0andnums[i]==nums[i-1]:continuel,r=i+1,len(nums)-1whilel<...
代码星球
·
2020-08-09
leetcode
3Sum
leetcode 14-> Longest Common Prefix
note:Allgiveninputsareinlowercaseletters a-z.classSolution(object):deflongestCommonPrefix(self,strs):""":typestrs:List[str]:rtype:str"""iflen(strs)==...
代码星球
·
2020-08-09
leetcode
Longest
Common
Prefix
首页
上一页
...
25
26
27
28
29
...
下一页
尾页
按字母分类:
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
其他