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.
Even with this, it was insufficiently fast for me and failed on 14.
The optimization that allowed this method to pass for me was to preinitialize the array. This saves on perhaps many memory operations that would be used to extend the array.
That said, myself I don't quite know what principle it is that allows us to know which prefix to search for based on the current one.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
An unexpected error occurred. Please try reloading the page. If problem persists, please contact support@hackerrank.com
Maximum Subarray Sum
You are viewing a single comment's thread. Return to all comments →
Even with this, it was insufficiently fast for me and failed on 14.
The optimization that allowed this method to pass for me was to preinitialize the array. This saves on perhaps many memory operations that would be used to extend the array.
That said, myself I don't quite know what principle it is that allows us to know which prefix to search for based on the current one.