Ezvor

3930. Power Update After K-th Largest Insertion II

HardArray Preparing judge… LeetCode
ArrayHash TableMathSegment TreeSorting

Hints

Hint 1
Convert kth largest into rank size - k + 1 in increasing order.
Hint 2
Use coordinate compression + Fenwick tree to find that ranked value efficiently.
Hint 3
Update p with fast modular exponentiation.