Minumum Capacity Box
2026. 3. 8. 16:20ㆍAlgorithm/Leetcode, Lintcode, HackerRank, etc.
- 목차
반응형
class Solution:
def minimumIndex(self, capacity: list[int], itemSize: int) -> int:
idx = -1
mn = float('inf')
for i, cap in enumerate(capacity):
if cap >= itemSize:
if mn > cap:
mn = cap
idx = i
return idx
반응형
'Algorithm > Leetcode, Lintcode, HackerRank, etc.' 카테고리의 다른 글
| 207. Course Schedule (0) | 2026.03.09 |
|---|---|
| Find the smallest balanced index (0) | 2026.03.08 |
| 3341. Find Minimum Time to Reach Last Room I (0) | 2026.03.08 |
| 2363. Merge Similar Items (0) | 2026.03.06 |
| 784. Letter Case Permutation (0) | 2026.03.06 |