Fenwick Tree Mastery: Core Operations and Practical Applications
Core Functinos
1. Point Update Operation
void update(int idx, int delta) {
while (idx <= arrSize) {
tree[idx] += delta;
idx += idx & -idx; // Propagate to parent nodes
}
}
2. Prefix Sum Query
long long query(int pos) {
long long result = 0;
while (pos > 0) {
result += tree[pos];
pos -= pos & -pos; // Move ...
Posted on Sat, 13 Jun 2026 18:23:20 +0000 by rupam_jaiswal
Competition Analysis and Problem Solutions - August 10, 2022
Score: 260 points | Rank: 3rd
T1: 100 points
T2: 100 points
T3: 60 points
T4: 0 points
Problem Solutiosn
T1 - Sequence Generaiton
Standard simulation problem. For each sequence iteration, count consecutive digits from the previous sequence.
#include <bits/stdc++.h>
using namespace std;
string sequence[30];
int main() {
int n;
...
Posted on Thu, 11 Jun 2026 17:00:42 +0000 by BigMonkey