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'm asking for help about my python code. (I'll post in the comment) What my code do is following the idea you guys shared in the discussions. ( Don't sort every sliding window & use bisect module to help place new expenditure into the window. ) Without using the bisect module, I do it with two hand-craft functions 'binary_remove' and 'binary_insert', try to do an O(logn) time complexity. But in the test cases, I still fail by timeout at the case 1~5. (The answers are all corrrect when I doing offline). Can someone help me find out what's wrong with my code? Or should I just give up these two hand-craft functions? Thanks a lot.
Fraudulent Activity Notifications
You are viewing a single comment's thread. Return to all comments →
I'm asking for help about my python code. (I'll post in the comment) What my code do is following the idea you guys shared in the discussions. ( Don't sort every sliding window & use bisect module to help place new expenditure into the window. ) Without using the bisect module, I do it with two hand-craft functions 'binary_remove' and 'binary_insert', try to do an O(logn) time complexity. But in the test cases, I still fail by timeout at the case 1~5. (The answers are all corrrect when I doing offline). Can someone help me find out what's wrong with my code? Or should I just give up these two hand-craft functions? Thanks a lot.