What is a Fenwick Tree (Binary Indexed Tree)?

What is a Fenwick Tree (Binary Indexed Tree)?

Approach: Explain a structure for efficient prefix sums and updates.

A data structure that can efficiently update elements and calculate prefix sums in a table of numbers. It uses bit manipulation to store partial sums in an array, providing O(log n) for both operations.

Follow-up: What is the space complexity?

Key concepts: prefix sum, bit manipulation, O(log n).