can anybody help me to reduce the complexity of richest_ begger problem, i’m not able to reduce it from n^2 to n
RCB
There’s difference array or Fenwick tree.
Edit: and difference array worked for me.