## Solutions
### triple loop brute force
```python
class Solution(object):
def countGoodTriplets(self, arr, a, b, c):
"""
:type arr: List[int]
:type a: int
:type b: int
:type c: int
:rtype: int
"""
count = 0
n = len(arr)
for i in range(n):
for j in range(i+1, n):
if abs(arr[i] - arr[j]) > a:
continue
for k in range(j+1, n):
if abs(arr[j] - arr[k]) <= b and abs(arr[i] - arr[k]) <= c:
count += 1
return count
```
- 可以学到
- 用 [[Python Basic Grammar#for + range + length]] 的多层 loop 怎么写
- loop 里的 continue
- constraints says: `3 <= arr.length <= 100`, 100^3 is acceptable, so we are satisfied with the brute force solution
#### Complexity Analysis
- Time complexity is On^3
- because we have a triple loop
- Space complexity is O1
- count and n is constant and we did't use extra space