| 10 | |
| 11 | # Solution:(Approach 1) |
| 12 | class Solution: |
| 13 | def countGoodTriplets(self, arr: List[int], a: int, b: int, c: int) -> int: |
| 14 | n=len(arr) |
| 15 | count=0 |
| 16 | for i in range(n-2): |
| 17 | for j in range(i+1,n-1): |
| 18 | if (abs(arr[i] - arr[j]) > a): |
| 19 | continue |
| 20 | for k in range(j+1,n): |
| 21 | if (abs(arr[j] - arr[k]) <= b and abs(arr[i] - arr[k]) <= c): |
| 22 | count+=1 |
| 23 | return count |
nothing calls this directly
no outgoing calls
no test coverage detected