Dynamic Range Maximum — Solution & Editorial
A segment tree (or Fenwick tree where the aggregate is invertible) supports both operations in O(log N). Point-assign updates the leaf and re-aggregates up the path.
Complexity: O((N + Q) log N)
A segment tree (or Fenwick tree where the aggregate is invertible) supports both operations in O(log N). Point-assign updates the leaf and re-aggregates up the path.
Complexity: O((N + Q) log N)