Skip to main content

Practice · 2 of 3

Σn Discipline

CHALLENGE
Difficulty: advanced+25 XP

**Scenario.** T test cases (T ≤ 1000) with per-test n; the statement guarantees Σn ≤ 200000. Your per-test algorithm is O(n^2). Which is true? **Which approach is the best fit? The program only needs to print the letter.** **A)** Fine: per-test n is small, so O(n^2) per test is safe **B)** Unsafe in general: one test with n = 200000 costs 4·10^10; only the SUM is bounded **C)** Fine because T ≤ 1000 caps everything **D)** Unsafe only if values are large

Back to lesson: Practice: Budget Drills