Problems

Expensive Calc Budget

EasyDebugging & Performance

Each render either recomputes an expensive value (cost c ms) or reuses a memo (cost 0). Input: line 1 — c; line 2 — JSON array of dep values per render. Print total ms spent with memoization, then ms WITHOUT memoization (recompute every render), as two lines.

Input: two lines. Output: memoized total, unmemoized total.

Your program reads from stdin and prints to stdout.

Example 1

Input: 10 [1,1,1,2]

Output: 20 40

Hints

ReactPerformance
Expensive Calc Budget | CodeForge AI