You are viewing a single comment's thread. Return to all comments →
Neat!
That said, this definitely isn't O(1) auxiliary space. You allocate an array of length N
It's also not O(n). It's O(N+K). If N = 3 and K = 1,000,000,000,000 that first for-loop is still gonna take a mighty long time (by comparison).
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 →
Neat!
That said, this definitely isn't O(1) auxiliary space. You allocate an array of length N
It's also not O(n). It's O(N+K). If N = 3 and K = 1,000,000,000,000 that first for-loop is still gonna take a mighty long time (by comparison).