DSA SheetLesson · no judge

CODE DRILL 1 · RUN ONLY

Write it, run it, read the output

This is a scratch drill — your code runs, nothing is graded or recorded. No test cases, no expected output, no verdict.

TASK

Implement both ways of summing the array [4, 2, 7, 1]. Print the direct sum and its auxiliary-space label, then print the copy-first sum and its auxiliary-space label.

C++
Loading editor…

OUTPUT

Sample
Direct sum: 14, auxiliary space: O(1)
Copy-first sum: 14, auxiliary space: O(n)

What a finished answer prints, from the lesson. Nothing has run yet — press Run and this is replaced by your program’s own output.

Previous · Inroduction to Time ComplexityNext part · Code drill 2