Hiring process8 levels
  1. 1 IQ Test
  2. 2 Additional Online Test (If Required)
  3. 3 Office Interview with Hiring Manager
  4. 4 Unpaid Test Task (Motivation Check)
  5. 5 Paid Test Task and Follow-Up Interview
  6. 6 Iterative Paid Test Tasks
  7. 7 Office Verification
  8. 8 Final Interview with the Founder

Problems > Order Statistics Live > Editorial

Order Statistics Live — Solution & Editorial

Back to the Problem

Coordinate-compress all inserted values (read the operations offline), then a Fenwick tree of counts supports insert/delete in O(log) and k-th smallest by binary search (or Fenwick descent).

Complexity: O(Q log Q)

Watch out: Deleting a value not present must be a no-op; and compression must cover values that are inserted.