当前位置:网站首页>剑指 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
边栏推荐
猜你喜欢

【機器學習】基於多元時間序列對高考預測分析案例

2022-06-17 advanced network engineering (x) is-is-general header, establishment of adjacency relationship, IIH message, DIS and pseudo node

2022-06-17 advanced network engineering (IX) is-is- principle, NSAP, net, area division, network type, and overhead value

加密潮流:时尚向元宇宙的进阶

Are these old system codes written by pigs?

ddia数据密集型应用系统设计 整理
![[Jianzhi offer II 091. painting the house]](/img/63/dc54c411b1a2f2b1d69b62edafde38.png)
[Jianzhi offer II 091. painting the house]
![[100 questions of Blue Bridge Cup intensive training] scratch command mobile Blue Bridge Cup scratch competition special prediction programming question intensive training simulation exercise question](/img/45/9955c9a5edeaa681f3fa8ce4041bfe.png)
[100 questions of Blue Bridge Cup intensive training] scratch command mobile Blue Bridge Cup scratch competition special prediction programming question intensive training simulation exercise question

Kalman time series prediction

Mac PHP multi version management and swoole extension installation
随机推荐
【无标题】
微信公众号服务器配置
剑指 Offer II 012. 左右两边子数组的和相等
2022-06-17 网工进阶(十)IS-IS-通用报头、邻接关系的建立、IIH报文、DIS与伪节点
论文笔记:LBCF: A Large-Scale Budget-Constrained Causal Forest Algorithm
六大专题全方位优化,阿里巴巴性能优化小册终开源,带你直抵性能极致
解析数仓lazyagg查询重写优化
Bombard the headquarters. Don't let a UI framework destroy you
The art of code annotation. Does excellent code really need no annotation?
Apijson simple to use
Wireshark网卡无法找到或没有显示的问题
A TDD example
使用PyWebIO测试,刚入门的测试员也能做出自己的测试工具
Wechat official account server configuration
Paper notes: generalized random forests
Mysql database multi table query
The problem of missing precision of kettle table input components
Ad domain login authentication
Structure de la mémoire JVM
Optimization of lazyagg query rewriting in parsing data warehouse