Understanding Algorithm Efficiency and Data Structures
Problem Statement
Consider the following problem: Find all possible combinations of a, b, and c such that a + b + c = 1000 and a^2 + b^2 = c^2 (where a, b, and c are natural numbers).
Initial Attempt
import time
start_time = time.time()
# Note: triple loop
for a in range(0, 1001):
for b in range(0, 1001):
for c in range(0, 1001):
...
Posted on Fri, 15 May 2026 15:21:00 +0000 by noblegas