当前位置:网站首页>剑指 Offer II 035. 最小时间差
剑指 Offer II 035. 最小时间差
2022-06-25 16:35:00 【Python ml】
def getMinutes(t:str)->int:
return ((ord(t[0])-ord('0'))*10+ord(t[1])-ord('0'))*60+(ord(t[3])-ord('0'))*10+ord(t[4])-ord('0')
class Solution:
def findMinDifference(self, timePoints: List[str]) -> int:
n=len(timePoints)
if n>1440: return 0
timePoints.sort()
ans=float('inf')
t0Minutes=getMinutes(timePoints[0])
preMinutes=t0Minutes
for i in range (1,n):
curMinutes=getMinutes(timePoints[i])
ans=min(ans,curMinutes-preMinutes)
preMinutes=curMinutes
ans=min(ans,t0Minutes+1440-curMinutes)
return ans
边栏推荐
- 居家办公让我绩效拿了C | 社区征文
- [proficient in high concurrency] deeply understand the basics of assembly language
- 完美洗牌问题
- Day_ 16 set
- 万卷书 - 大力娃的书单
- 八种button的hover效果
- 二十九-使用RealSenseD435进行ORBSLAM2实时三维重建
- Generate post order traversal according to pre order traversal and mid order traversal
- Internship: the annotation under swagger involves the provision of interfaces
- 卡尔曼时间序列预测
猜你喜欢
随机推荐
解析数仓lazyagg查询重写优化
Wireshark network card cannot be found or does not display the problem
Vscode plug-in self use
Do you know all the configurations of pychrm?
论文笔记:LBCF: A Large-Scale Budget-Constrained Causal Forest Algorithm
Day_ ten
Differences between et al and etc
[untitled]
Generate post order traversal according to pre order traversal and mid order traversal
Ad domain login authentication
mysql使用过程中遇到的问题
AD域登录验证
Day_ seventeen
PLSQL 存储函数SQL编程
redis 分布式锁整理
剑指 Offer II 010. 和为 k 的子数组 前缀和差
Record learning of hystrix knowledge --20210929
論文筆記:LBCF: A Large-Scale Budget-Constrained Causal Forest Algorithm
【機器學習】基於多元時間序列對高考預測分析案例
Redis系列——概述day1-1








