Skip to content

Commit 43e97b6

Browse files
committed
Do daily
1 parent a9e0f2b commit 43e97b6

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

my-submissions/m2145.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
class Solution:
2+
def numberOfArrays(self, differences: List[int], lower: int, upper: int) -> int:
3+
minn, maxx = 0, 0
4+
curr = 0
5+
6+
for dif in differences :
7+
curr += dif
8+
minn, maxx = min(minn, curr), max(maxx, curr)
9+
10+
return max(0, (upper - lower + 1) - (maxx - minn))

my-submissions/m781 oneliner.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
class Solution:
22
def numRabbits(self, answers: List[int]) -> int:
3-
return sum((freqs + 1) * (ceil(x / (freqs + 1))) for freqs, x in Counter(answers).items())
3+
return sum((freqs + 1) * (ceil(x / (freqs + 1))) for freqs, x in Counter(answers).items())

0 commit comments

Comments
 (0)