You are viewing a single comment's thread. Return to all comments →
Only O(M) space is needed. The question was tagged "sparse arrays" but this is a brute-force, dense array.
if((q+1)<=N) is unnecessary because [N+1] space is allocated.
if((q+1)<=N)
[N+1]
Seems like cookies are disabled on this browser, please enable them to open this website
Array Manipulation
You are viewing a single comment's thread. Return to all comments →
Only O(M) space is needed. The question was tagged "sparse arrays" but this is a brute-force, dense array.
if((q+1)<=N)
is unnecessary because[N+1]
space is allocated.