Skip to content

Commit aaf9b6c

Browse files
committedJul 13, 2024·
add 2824
1 parent 17dfec8 commit aaf9b6c

File tree

2 files changed

+20
-0
lines changed
  • paginated_contents/algorithms/3rd_thousand
  • src/main/java/com/fishercoder/solutions/thirdthousand

2 files changed

+20
-0
lines changed
 

‎paginated_contents/algorithms/3rd_thousand/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
|------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------|---------------------------|----------------------------------------------------------------------
33
| 2965 | [Find Missing and Repeated Values](https://leetcode.com/problems/find-missing-and-repeated-values/) | [Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/thirdthousand/_2965.java) | | Easy |
44
| 2864 | [Maximum Odd Binary Number](https://leetcode.com/problems/maximum-odd-binary-number/) | [Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/thirdthousand/_2864.java) | | Easy |Greedy
5+
| 2824 | [Count Pairs Whose Sum is Less than Target](https://leetcode.com/problems/count-pairs-whose-sum-is-less-than-target/) | [Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/thirdthousand/_2824.java) | | Easy |
56
| 2812 | [Find the Safest Path in a Grid](https://leetcode.com/problems/find-the-safest-path-in-a-grid/) | [Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/thirdthousand/_2812.java) | | Medium |BFS
67
| 2751 | [Robot Collisions](https://leetcode.com/problems/robot-collisions/) | [Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/thirdthousand/_2751.java) | | Hard | Stack, Simulation
78
| 2716 | [Minimize String Length](https://leetcode.com/problems/minimize-string-length/) | [Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/thirdthousand/_2716.java) | [:tv:](https://youtu.be/aMJ3T0K8LjI) | Easy |
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package com.fishercoder.solutions.thirdthousand;
2+
3+
import java.util.List;
4+
5+
public class _2824 {
6+
public static class Solution1 {
7+
public int countPairs(List<Integer> nums, int target) {
8+
int pairs = 0;
9+
for (int i = 0; i < nums.size() - 1; i++) {
10+
for (int j = i + 1; j < nums.size(); j++) {
11+
if (nums.get(i) + nums.get(j) < target) {
12+
pairs++;
13+
}
14+
}
15+
}
16+
return pairs;
17+
}
18+
}
19+
}

0 commit comments

Comments
 (0)
Please sign in to comment.