ucode.vn's blog

By ucode.vn, history, 3 years ago, In English

sum(a[i,j]) = prefix_sum[j] — prefix_sum[i-1] => sum(a[i,j]) = 0 when 1 prefix_sum in the previous prefix_sum or this prefix_sum equal 0

I have a set data structure that stores prefix_sum1 . values and 1 variable prefix_sum Browse each index i from 0 -> n-1 : add prefix_sum a[i] if prefix_sum is in prefix_sum1 then return True If prefix_sum is 0, return True add prefix_sum1 prefix_sum Then all box fields that return True have been processed. And Returns False

  • Vote: I like it
  • -8
  • Vote: I do not like it