You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: solution/1900-1999/1925.Count Square Sum Triples/README_EN.md
+57-34
Original file line number
Diff line number
Diff line change
@@ -53,7 +53,13 @@ tags:
53
53
54
54
<!-- solution:start -->
55
55
56
-
### Solution 1
56
+
### Solution 1: Enumeration
57
+
58
+
We enumerate $a$ and $b$ in the range $[1, n)$, then calculate $c = \sqrt{a^2 + b^2}$. If $c$ is an integer and $c \leq n$, then we have found a Pythagorean triplet, and we increment the answer by one.
59
+
60
+
After the enumeration is complete, return the answer.
61
+
62
+
The time complexity is $O(n^2)$, where $n$ is the given integer. The space complexity is $O(1)$.
0 commit comments