Skip to content

Commit cf7aa7b

Browse files
add 1925
1 parent 2b11869 commit cf7aa7b

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ _If you like this project, please leave me a star._ ★
88

99
| # | Title | Solutions | Video | Difficulty | Tag 1
1010
|-----|----------------|---------------|--------|-------------|-------------
11+
|1925|[Count Square Sum Triples](https://leetcode.com/problems/count-square-sum-triples/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1925.java) ||Easy|Array, Greedy|
1112
|1920|[Build Array from Permutation](https://leetcode.com/problems/build-array-from-permutation/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1920.java) ||Easy||
1213
|1913|[Maximum Product Difference Between Two Pairs](https://leetcode.com/problems/maximum-product-difference-between-two-pairs/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1913.java) ||Easy|Sort|
1314
|1910|[Remove All Occurrences of a Substring](https://leetcode.com/problems/remove-all-occurrences-of-a-substring/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1904.java) ||Medium|String|
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package com.fishercoder.solutions;
2+
3+
public class _1925 {
4+
public static class Solution1 {
5+
public int countTriples(int n) {
6+
int count = 0;
7+
for (int i = 1; i < n; i++) {
8+
for (int j = 1; j < n; j++) {
9+
int product = i * i + j * j;
10+
double sq = Math.sqrt(product);
11+
if (sq <= n && (sq - Math.floor(sq) == 0)) {
12+
count++;
13+
}
14+
}
15+
}
16+
return count;
17+
}
18+
}
19+
}

0 commit comments

Comments
 (0)