I'm revisiting CSES problem set to help a friend. In "Sorting and Searching", I came across this problem: Josephus Problem II. My solution was using an ordered set, and after a quick search, it seems like everyone online do this too. However, we see the more general version of this problem: List Removals, which is in the section "Range Queries".
The category of this problem and a solution which is more general made me wonder if there is an alternative solution, perhaps without ordered set. I did some search online and found O(n) solution to the Josephus Problem (also see cp-algorithm. But this is different from the CSES problem, as it only finds the last element.
So, is there any solution that is not doing removal on ordered set?