Skip to content

Commit 20c59da

Browse files
committed
do daily; it's identical to yesterday
1 parent e67493b commit 20c59da

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

my-submissions/h3027 optimised.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
class Solution:
2+
def numberOfPairs(self, points: List[List[int]]) -> int:
3+
points.sort(key=lambda x: (x[0], -x[1]))
4+
5+
output = 0
6+
# Top left
7+
for i, (_, y1) in enumerate(points) :
8+
# top right
9+
min_y = -inf
10+
for j, (_, y2) in enumerate(points[i + 1:], i + 1) :
11+
if min_y < y2 <= y1 :
12+
output += 1
13+
min_y = y2
14+
if y1 == min_y :
15+
break
16+
17+
return output

my-submissions/h3027.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
This question is identical to medium Q3025 but with Alice and Bob instead of points A and B.

0 commit comments

Comments
 (0)