We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Subtracting from what exactly? What can you subtract from if you don't know the rest of the array? O(n) means that you are able to solve this while reading the numbers in. If you read the array first and then work on top of it it's not O(n).
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Sherlock and Array
You are viewing a single comment's thread. Return to all comments →
Subtracting from what exactly? What can you subtract from if you don't know the rest of the array? O(n) means that you are able to solve this while reading the numbers in. If you read the array first and then work on top of it it's not O(n).