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: exercises/practice/pythagorean-triplet/.approaches/introduction.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@ The problem space can easily become very large, and 'naive' or more 'brute force
6
6
There are three reasonably common variations to this problem
7
7
1. A [cubic time][approaches-cubic] solution, which uses highly nested loops and is non-performant.
8
8
2. A [quadratic time][approaches-quadratic] solution, which uses one nested loop, and is reasonably easy to figure out.
9
-
3. A [linear time][approaches-linear] solution, requiring some deeper understanding of the mathematics of finding trplets.
9
+
3. A [linear time][approaches-linear] solution, requiring some deeper understanding of the mathematics of finding triplets.
10
10
11
11
12
12
If those terms are unclear to you, you might like to read about [time complexity][time-complexity], and how it is described by [asymptotic notation][asymptotic-notation].
@@ -68,7 +68,7 @@ This gives a substantial speed advantage, allowing the tests to run to completio
68
68
69
69
However, the Exercism online test runner will still time out with this solution.
70
70
71
-
Examining the code, it is clear that the upper bounds on the `loop` variables are far too generous, and too much work is bing done.
71
+
Examining the code, it is clear that the upper bounds on the `loop` variables are far too generous, and too much work is being done.
72
72
73
73
74
74
The solution below tightens the bounds and pre-calculates `c * c` in the outer `loop`.
0 commit comments