152. Two pointers wrap on a.ring, and undoing queues any rollback structure (2026-11-21)
- Decision.
a.ring.maximal/minimal(state, ok:)return[D]RingSlice/[D]?RingSlicekeyed by the piece's last position.undoing(s, add:)turns anyUndostructure (mark,undo_to) into aTrackby the queue-undo trick, O(log n) re-applications amortized. Lambdas takemutparameters asfndoes. - Why.
btoi20p3was a divide and conquer over rawIntstreet indices with- 1adjustments. "Everything exceptl..=r" is a ring window, and a rollback DSU in a two-pointer pass is a known trick that had no name; with both, Joker is a two-pointer pass. - Reverse. Drop
Ring.maximal/minimalandundoing; Joker returns to divide and conquer.