Dynamic Binary Indexed Trees Here we go, Problem Statement: You are given an integer N, size of the array initialized to 0, and Q queries. queries are of 2 types. 1. update value V at index I. 2. Output the sum of element <=Index I. Queries are given in the format 1 I V 2 I Constraint: 1<=N<=10^18 1<=Q<=10^5 all queries are online I=(previous_answer+I)%N+1 V=(previous_answer+V)%N+1 Solution Approach: Why do we need Dynamic BIT ? Let's solve the problem bit by bit. If constraints were low then we can use a simple Segment tree or Fenwick tree for this purpose. If queries weren't asked in an online manner then we can use coordinate compression and make the BIT of at most 10^5 size as that will cover all the queries. But if constraints are high and the problem isn't offline. Here comes the Idea of "Dynamic Binary Indexed Tree". We can solve this by Dynamic Segment Trees to but for the sake of this article...
Blogs related to the topic you won't find anywhere else.