Open quangh33 opened 3 years ago
Thank you for your feedback!
On Sun, Oct 3, 2021 at 2:33 PM Hoang Dinh Quang @.***> wrote:
This function is still O(n) in worst case (imagine left == 0, right == n-1). Consider make it O(1) by calculating all prefix sum in advance. You may check Khanh/NamAnh's repo as reference.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/nathanmng/LeetCode/issues/1, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEYN32XMPP77ZQLAZ3TSIKDUFABLNANCNFSM5FHJLRDQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
https://github.com/nathanmng/LeetCode/blob/b246dc9d3f27d6552a081f34bdf06c64fc975687/prefixSum/range-sum-query-immutable.js#L13
This function is still O(n) in worst case (imagine left == 0, right == n-1). Consider make it O(1) by calculating all prefix sum in advance. You may check Khanh/NamAnh's repo as reference.