Editorial for SAC '22 Code Challenge 3 P3 - Bob Sort
Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.
Submitting an official solution before solving the problem yourself is a bannable offence.
Submitting an official solution before solving the problem yourself is a bannable offence.
Author:
First, find by iterating across the array.
Second, create an array of pairs that store the value modulo the respective round (e.g., for round 1, mod the value by ; for round 2, mod the value by ; etc.).
Third, sort that array by the modulo value using a custom comparator or built-in functions.
Finally, output that round and repeat the second and third steps until you have reached the final round.
Time Complexity:
Comments