#1925
Count Square Sum Triples
newbie · 210 · lc easy +16 · premium · verified · 77.1% accepted · 738 likes · top 88%
Description
A square triple (a, b, c) satisfies a2 + b2 = c2 for positive integers a, b, c.
Given an integer n, return the count of square triples where 1 <= 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).
Code
1
2
3