Skip to content

Commit c88f6a9

Browse files
Zanger67/leetcodeZanger67/leetcode
Zanger67/leetcode
authored and
Zanger67/leetcode
committed
Updated markdown files
1 parent 47464af commit c88f6a9

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

markdowns/Questions_By_Code_Length.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ Calculations are based on the code files's byte sizes.
117117
| 350 | [Intersection of Two Arrays II](<https://leetcode.com/problems/intersection-of-two-arrays-ii>) | Easy | Daily | [solution](<_350. Intersection of Two Arrays II.md>) | java, py | Jul 02, 2024 |
118118
| 66 | [Plus One](<https://leetcode.com/problems/plus-one>) | Easy | N150 | [solution](<_66. Plus One.md>) | c | Jun 03, 2024 |
119119
| 40 | [Combination Sum II](<https://leetcode.com/problems/combination-sum-ii>) | Medium | Daily, N150 | [solution](<_40. Combination Sum II.md>) | py | Aug 13, 2024 |
120+
| 1534 | [Count Good Triplets](<https://leetcode.com/problems/count-good-triplets>) | Easy | Daily | [solution](<_1534. Count Good Triplets.md>) | c, py | Apr 14, 2025 |
120121
| 611 | [Valid Triangle Number](<https://leetcode.com/problems/valid-triangle-number>) | Medium | | [solution](<_611. Valid Triangle Number.md>) | py | May 22, 2024 |
121122
| 3229 | Weekly Contest 407 - q4 - [Minimum Operations to Make Array Equal to Target](<https://leetcode.com/problems/minimum-operations-to-make-array-equal-to-target>) | Hard | Contest | [solution](<_3229. Minimum Operations to Make Array Equal to Target.md>) | py | Jul 21, 2024 |
122123
| 381 | [Insert Delete GetRandom O(1) - Duplicates allowed](<https://leetcode.com/problems/insert-delete-getrandom-o1-duplicates-allowed>) | Hard | | [solution](<_381. Insert Delete GetRandom O(1) - Duplicates allowed.md>) | java | Jul 06, 2024 |
@@ -170,7 +171,6 @@ Calculations are based on the code files's byte sizes.
170171
| 1351 | [Count Negative Numbers in a Sorted Matrix](<https://leetcode.com/problems/count-negative-numbers-in-a-sorted-matrix>) | Easy | | [solution](<_1351. Count Negative Numbers in a Sorted Matrix.md>) | java, py | Jun 01, 2024 |
171172
| 919 | [Complete Binary Tree Inserter](<https://leetcode.com/problems/complete-binary-tree-inserter>) | Medium | | [solution](<_919. Complete Binary Tree Inserter.md>) | py | Jul 05, 2024 |
172173
| 271 | [Encode and Decode Strings](<https://leetcode.com/problems/encode-and-decode-strings>) | Medium | B75, N150 | [solution](<_271. Encode and Decode Strings.md>) | py | Jun 13, 2024 |
173-
| 1534 | [Count Good Triplets](<https://leetcode.com/problems/count-good-triplets>) | Easy | Daily | [solution](<_1534. Count Good Triplets.md>) | c, py | Apr 14, 2025 |
174174
| 24 | [Swap Nodes in Pairs](<https://leetcode.com/problems/swap-nodes-in-pairs>) | Medium | | [solution](<_24. Swap Nodes in Pairs.md>) | c | Jun 07, 2024 |
175175
| 1268 | [Search Suggestions System](<https://leetcode.com/problems/search-suggestions-system>) | Medium | | [solution](<_1268. Search Suggestions System.md>) | py | Jun 29, 2024 |
176176
| 1 | [Two Sum](<https://leetcode.com/problems/two-sum>) | Easy | B75, N150 | [solution](<_1. Two Sum.md>) | java, py | May 22, 2024 |

markdowns/_1534. Count Good Triplets.md

+11
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
- [e1534_v1.c](<../my-submissions/e1534_v1.c>)
2424
- [m1534_v1_compressed_lol.c](<../my-submissions/m1534_v1_compressed_lol.c>)
2525
- [e1534_v1_brute_force.py](<../my-submissions/e1534_v1_brute_force.py>)
26+
- [e1534_v2_brute_force_oneliner.py](<../my-submissions/e1534_v2_brute_force_oneliner.py>)
2627
### C
2728
#### [e1534_v1.c](<../my-submissions/e1534_v1.c>)
2829
```C
@@ -74,3 +75,13 @@ class Solution:
7475
return output
7576
```
7677

78+
#### [e1534_v2_brute_force_oneliner.py](<../my-submissions/e1534_v2_brute_force_oneliner.py>)
79+
```Python
80+
class Solution:
81+
def countGoodTriplets(self, arr: List[int], a: int, b: int, c: int) -> int:
82+
return [
83+
abs(arr[i] - arr[j]) <= a and abs(arr[j] - arr[k]) <= b and abs(arr[i] - arr[k]) <= c
84+
for i in range(len(arr) - 2) for j in range(i + 1, len(arr) - 1) for k in range(j + 1, len(arr))
85+
].count(True)
86+
```
87+

0 commit comments

Comments
 (0)