leetcode1190
摘要:参考:https://leetcode.com/problems/reverse-substrings-between-each-pair-of-parentheses/discuss/382775/Python3-straightforward-and-easiest-on-discussion
阅读全文
posted @
2019-09-15 22:45
Sempron2800+
阅读(322)
推荐(0)
leetcode1189
摘要:算法思想:贪心+Hash。 记录b a l o n出现的次数,计算可以构成的单词的最少字符。
阅读全文
posted @
2019-09-15 21:36
Sempron2800+
阅读(216)
推荐(0)
校招真题练习035 最少立方数之和(小米)
摘要:最少立方数之和 题目描述给出一个数字N(0<N<1000000),将N写成立方数和的形式,求出需要的最少立方数个数。例如N=17,1+8+8 = 17,最少需要3个立方数,则输出3。N= 28,1+1+1+1+8+8+8=28, 需要7个立方数,1+27=28,需要2个立方数,所以最少立方数为2,则
阅读全文
posted @
2019-09-11 09:11
Sempron2800+
阅读(386)
推荐(0)
leetcode1185
摘要:1 from datetime import datetime 2 3 class Solution: 4 def dayOfTheWeek(self, day: int, month: int, year: int) -> str: 5 days = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday","Sund
阅读全文
posted @
2019-09-11 07:19
Sempron2800+
阅读(229)
推荐(0)
leetcode1184
摘要:1 class Solution: 2 def distanceBetweenBusStops(self, distance: List[int], start: int, destination: int) -> int: 3 if start == destination: 4 return 0 5 elif start < destination: 6 dis1,dis2 = 0,0 7 f
阅读全文
posted @
2019-09-11 07:08
Sempron2800+
阅读(170)
推荐(0)
leetcode1175
摘要:1 class Solution: 2 def factorial(self,N): 3 result = 1 4 while N > 0: 5 result *= N 6 N -= 1 7 return result 8 9 def numPrimeArrange...
阅读全文
posted @
2019-09-10 21:14
Sempron2800+
阅读(158)
推荐(0)
leetcode1170
摘要:1 import collections 2 import bisect 3 4 class Solution: 5 def getFC(self,word): 6 obj = collections.Counter(word) 7 for i in range(97,123): 8 c = chr(i) 9 if c in obj: 10 return obj[c] 11 12 def numS
阅读全文
posted @
2019-09-10 16:41
Sempron2800+
阅读(174)
推荐(0)
leetcode1154
摘要:1 class Solution: 2 def isLeap(self,year): 3 if (year % 4 == 0 and year % 100 != 0) or (year % 400 == 0): 4 return True 5 return False 6 7 def dayOfYea...
阅读全文
posted @
2019-09-10 16:13
Sempron2800+
阅读(161)
推荐(0)