3 ms·
> 1. How would you detect the largest sub array (i.e. max sum of adjacent numbers) given an example array: That's a fun one. The obvious solution is O(n^2), bu
by pjscott 14y ago
> 1. How would you detect the largest sub array (i.e. max sum of adjacent numbers) given an example array:
That's a fun one. The obvious solution is O(n^2), but there's a less obvious way to do it in O(n). (I'm not giving spoilers, because this actually is fun to solve.)
- wting 14y agoA sad fact is I had to look up the answer, and the algorithm is well known from one of my university's professors which I've had class with.