Fenwick tree range updates

Write codeMedium25 minCitadel style

Your task

Maintain a Fenwick (binary indexed) tree over an initial integer array arr. Process operations: ["update", i, v] SETS arr[i] = v (an assignment, not an increment), and ["query", l, r] returns the sum of the inclusive range [l, r]. Indices are 0-based. Return the list of answers to the "query" operations, in order.

Examples

fenwick_point_update_range_sum(arr: list[int], ops: list[list]) -> list[int]
Example 1
Inputfenwick_point_update_range_sum([1, 2, 3, 4, 5], [["query", 0, 4], ["update", 2, 10], ["query", 0, 4], ["query", 2, 2]])
Output[15, 22, 10]