We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8ab6c5c commit 5d964eeCopy full SHA for 5d964ee
1500-2000/1534.js
@@ -0,0 +1,20 @@
1
+var countGoodTriplets = function(arr, a, b, c) {
2
+ let goodTriplets = 0;
3
+ const length = arr.length;
4
+
5
+ for (let i = 0; i < length; i++) {
6
+ for (let j = i + 1; j < length; j++) {
7
+ if (Math.abs(arr[i] - arr[j]) <= a) {
8
+ for (let k = j + 1; k < length; k++) {
9
+ if (Math.abs(arr[j] - arr[k]) <= b &&
10
+ Math.abs(arr[i] - arr[k]) <= c) {
11
+ goodTriplets++;
12
+ // 🥋 Rock Lee: "No secret powers—just structured hustle!" 🧱
13
+ }
14
15
16
17
18
19
+ return goodTriplets;
20
+};
0 commit comments