Skip to content

Commit

Permalink
finish 1629
Browse files Browse the repository at this point in the history
  • Loading branch information
BLZbanme committed Jan 9, 2022
1 parent 5d254f2 commit 938b1fd
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions 1601-1700/1601-1650/1629SlowestKey/demo.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
class Solution:
def slowestKey(self, releaseTimes: List[int], keysPressed: str) -> str:
N = len(releaseTimes)
tmpVal = 0
res = ''
for i in range(N):
if not i:
tmp = releaseTimes[i]
else:
tmp = releaseTimes[i] - releaseTimes[i - 1]
if tmpVal < tmp:
tmpVal = tmp
res = keysPressed[i]
if tmpVal == tmp:
res = max(res, keysPressed[i])
return res

0 comments on commit 938b1fd

Please sign in to comment.