Hello guys,
I was trying to solve Distinct Colors: link.
I did a naive solution which obviously led to TLE.
TLE
I saw various solutions that use BIT. But I cant assimilate why BIT works here, what BIT represents here (for e.g. in case range sum query BIT keeps track of cummulative frequency.)
It would be great if someone tells some trick how to use BIT for various other purposes too.
Thanks!