Class Solution
- java.lang.Object
-
- g1901_2000.s1925_count_square_sum_triples.Solution
-
public class Solution extends Object
1925 - Count Square Sum Triples.Easy
A square triple
(a,b,c)
is a triple wherea
,b
, andc
are integers anda2 + b2 = c2
.Given an integer
n
, return the number of square triples such that1 <= a, b, c <= n
.Example 1:
Input: n = 5
Output: 2
Explanation: The square triples are (3,4,5) and (4,3,5).
Example 2:
Input: n = 10
Output: 4
Explanation: The square triples are (3,4,5), (4,3,5), (6,8,10), and (8,6,10).
Constraints:
1 <= n <= 250
-
-
Constructor Summary
Constructors Constructor Description Solution()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
countTriples(int n)
-