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.
I didn't bother using the array. Why write to memory? Also didn't bother typecasting strings to ints (I also solved in Python). Why incur the overhead of function calls? Not sure why some people are bothering with binary search either. Binary search may be O(log(n)), but the sorting algorithm you used on that not-preprocessed data was probably O(n log(n)). And many hard-coded their binary search because they couldn't or didn't want to use a built-in, which although useful practice for interviews is an off-by-one error nightmare.
Intro to Tutorial Challenges
You are viewing a single comment's thread. Return to all comments →
I didn't bother using the array. Why write to memory? Also didn't bother typecasting strings to ints (I also solved in Python). Why incur the overhead of function calls? Not sure why some people are bothering with binary search either. Binary search may be O(log(n)), but the sorting algorithm you used on that not-preprocessed data was probably O(n log(n)). And many hard-coded their binary search because they couldn't or didn't want to use a built-in, which although useful practice for interviews is an off-by-one error nightmare.