You are viewing a single comment's thread. Return to all comments →
This is O(n + k), not O(n).
In particular, when n = 0 you have:
n = 0
-- O(k) space allocation (m[k]) -- O(k) run time (for(int i=1; i<=k/2 && i!=k-i; i++) loop).
m[k]
for(int i=1; i<=k/2 && i!=k-i; i++)
Seems like cookies are disabled on this browser, please enable them to open this website
Divisible Sum Pairs
You are viewing a single comment's thread. Return to all comments →
This is O(n + k), not O(n).
In particular, when
n = 0
you have:-- O(k) space allocation (
m[k]
)-- O(k) run time (
for(int i=1; i<=k/2 && i!=k-i; i++)
loop).