leetcode—1534.统计好的三元组
class Solution:
def countGoodTriplets(self, arr: List[int], a: int, b: int, c: int) -> int:
l=len(arr)
ans=0
for i in range(l):
for j in range(i+1,l):
if abs(arr[i]-arr[j])>a:
continue
if abs(arr[i]-arr[j])<=a:
for k in range(j+1,l):
if abs(arr[j]-arr[k])<=b and abs(arr[i]-
共有 0 条评论