These are the sorting problems every placement candidate should be able to solve, from a plain sort to counting inversions and bucket gaps. Pick the idea first: merge, partition, counting or a key function. Trace a small input on paper, then check your program against every test.