Count Square Sum Triples asks you to count ordered triples of positive integers up to a given limit where the first two squares add up to the third square.
Statement
A square triple (a,b,c) is a triple of positive integers satisfying a2+b2=c2.
Given an integer n, return the total number of square triples such that 1≤a,b,c≤n.
Constraints:
1≤n≤250
Examples
Fetching Slides...
Understand the problem
Now, let’s take a moment to make sure you’ve correctly understood the problem. The quiz below helps you check if you’re solving the correct problem:
Count Square Sum Triples
1.
For the input n = 11, how many square triples are counted when (a,b) order matters?
A.
2
B.
8
C.
4
D.
6
1 / 3
Figure it out!
We have a game for you to play. Rearrange the logical building blocks to develop a clearer understanding of how to solve this problem.
Sequence - Vertical
Drag and drop the cards to rearrange them in the correct sequence
1
2
3
4
5
Try it yourself
Implement your solution in the following coding playground.
Count Square Sum Triples asks you to count ordered triples of positive integers up to a given limit where the first two squares add up to the third square.
Statement
A square triple (a,b,c) is a triple of positive integers satisfying a2+b2=c2.
Given an integer n, return the total number of square triples such that 1≤a,b,c≤n.
Constraints:
1≤n≤250
Examples
Fetching Slides...
Understand the problem
Now, let’s take a moment to make sure you’ve correctly understood the problem. The quiz below helps you check if you’re solving the correct problem:
Count Square Sum Triples
1.
For the input n = 11, how many square triples are counted when (a,b) order matters?
A.
2
B.
8
C.
4
D.
6
1 / 3
Figure it out!
We have a game for you to play. Rearrange the logical building blocks to develop a clearer understanding of how to solve this problem.
Sequence - Vertical
Drag and drop the cards to rearrange them in the correct sequence
1
2
3
4
5
Try it yourself
Implement your solution in the following coding playground.