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.
This can be made a little more efficient. You're using bisect_left, followed by insort later, which is a combination of bisect followed by insert. So you're basically repeating the bisect step when you could just use the index gotten from the first bisect step.
You can also avoid a little bit of confusion by using bisect, instead of bisect_left and remove the +1. The following passes all test cases.
Maximum Subarray Sum
You are viewing a single comment's thread. Return to all comments →
This can be made a little more efficient. You're using
bisect_left
, followed byinsort
later, which is a combination ofbisect
followed byinsert
. So you're basically repeating thebisect
step when you could just use the index gotten from the firstbisect
step. You can also avoid a little bit of confusion by usingbisect
, instead ofbisect_left
and remove the+1
. The following passes all test cases.