This solution is really helpful!!!! Thank you! Bro. I love you
@storypku Than you so much for pointing that out! I've updated my post.
@chaitanyaphalak Yes, thanks for pointing that out, I just changed the name for clarity but missed that. Corrected now
Wonder what the runtime is, considering the difference between j and i can be as large as the entire pos list, seems like a O(n^2) solution because of the assignment slice pos[i:j]
No one has replied
@yihangho You're definitely right. Since this is my first segment tree ever, I'll try to improve by practicing more on problems here
@elastico Thanks for the quick response. I understand now.
@ywsstan Thank you for pointing out. You are right. It should be the floorEntry. It seems such test case is missing.
It is inaccurate to say average as worst case could happen a lot. Besides, remove action on List in Java will shift all the elements after the object to left, even if you do it only once per loop, it would cost an extra O(n).
@awice Thanks to explain, I see why my understanding before was wrong. The square as a whole could not be splited to hit the lowest ground!
Disabled Categories are greyed out
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.