Given an Array
we need to compute
.
What is the running time of a time-efficient solution?
I thought the running time of the time-efficient solution for the equation
would be n^2 (quadratic time) but the solution is n (linear time).
Can someone explain me how is it n (linear time)?