I tried the bucketing by value since it is in [-100, 100] and used SortedList but got TLE... I was thinking it is enough since update is O(logn) and sumRange is O(200 * logn)
Hi Larry, I tried very basic approch in this question that I am initialing array, sum of whole array and then in update making change in array on that index and also changing sum according to new value and in getSum , just minus sum of array (0, left) + array (right+1, Len array) and it was 98 % faster in python submission and memory was around 80% better, can you explain why??
How did you deal with the range?
I tried the bucketing by value since it is in [-100, 100] and used SortedList but got TLE... I was thinking it is enough since update is O(logn) and sumRange is O(200 * logn)
Thank you!!
Hi Larry, I tried very basic approch in this question that I am initialing array, sum of whole array and then in update making change in array on that index and also changing sum according to new value and in getSum , just minus sum of array (0, left) + array (right+1, Len array) and it was 98 % faster in python submission and memory was around 80% better, can you explain why??
Submissions score can be random