Skip to content

Practice Count Square Sum Triples

Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.

Easy#1925
LeetCode Problem

Count Square Sum Triples

Problem Statement

A square triple (a,b,c) is a triple where a, b, and c are integers and a^2 + b^2 = c^2. Given an integer n, return the number of square triples such that 1 <= a, b, c <= n.

Source: Count Square Sum Triples on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
n = 5
Output
2

# Example 2

Input
n = 10
Output
4

Constraints

1 <= n <= 250

Related LeetCode Problems

Practice more problems similar to Count Square Sum Triples.

Review your practice with PhantomCodeAI

After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.