Skip to content

Commit 60c01cb

Browse files
committed
Day29
1 parent c1c79bb commit 60c01cb

2 files changed

Lines changed: 29 additions & 0 deletions

File tree

leetcode3/최민지/4024.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
class Solution:
2+
def nearestDrone(self, drones: list[list[int]], target: list[int]) -> int:
3+
result = []
4+
for drone in drones:
5+
s = drone[0]
6+
e = drone[1]
7+
r = drone[2]
8+
temp = abs(s - target[0]) + abs(e - target[1])
9+
if temp <= r:
10+
result.append(temp)
11+
else:
12+
result.append(100)
13+
14+
15+
output = min(result)
16+
if output != 100:
17+
return result.index(output)
18+
else:
19+
return -1
20+

leetcode3/최민지/907.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
class Solution:
2+
def sumSubarrayMins(self, arr: List[int]) -> int:
3+
result = []
4+
for i in range(1, len(arr)+1):
5+
for j in range(0, i):
6+
temp = arr[j:j+i]
7+
result.append(min(temp))
8+
return sum(result) % ( 10**9 + 7 )
9+

0 commit comments

Comments
 (0)