2025-08-16 09:06:11 +0000 UTC
Count Square Sum Triples
Categories:
Links
Code
class Solution:
def countTriples(self, n: int) -> int:
res = 0
for a in range(1, n):
for b in range(a + 1, n):
c = math.sqrt(a * a + b * b)
if c % 1 == 0 and c <= n:
res += 2
return res