I was looking at the Josephus Problem II in the CSES problem set, and couldn't find a c++ solution that didn't use ordered_set, which is not in the standard library. This made me wonder if I need to learn about other libraries to get good at cp. Any input appreciated.
Also if someone knows how to solve the Josephus Problem II only using the standard library please outline it for me ty
my code here.
You essentially brute force the algorithm by finding the next person by literally locating the k'th person to the right.
The ordered set is needed in some solutions for querying "kth largest in a set of integers". Such queries can also be done by walking on segtrees as well.
I have solved it using binary search & BIT.
code