976-Largest-Perimeter-Triangle
Sat 17 May 2025
https://leetcode.com/problems/largest-perimeter-triangle
import pyutil as pyu
pyu.get_local_pyinfo()
print(pyu.ps2("python-dotenv"))
from typing import List
class Solution:
def largestPerimeter(self, A: List[int]) -> int:
A = sorted(A)
for i in range(len(A) - 1, 1, -1):
if A[i - 2] + A[i - 1] > A[i]:
return A[i - 2] + A[i - 1] + A[i]
return 0
new Solution().largestPerimeter()
Score: 5
Category: leetcode