Trains the technique from
LeetCode 46PermutationsThis is an original problem, written from a brief that listed the technique, the difficulty, the topics, the function shape and the input bounds — none of that problem's wording, examples, hints or editorials. The link is there so you can map your practice onto the standard set.
Same function shape, different story and different numbers.
A calibration bench applies a set of signed offsets, given as offsets, to an instrument. Each offset is applied exactly once per run, and the instrument drifts differently depending on which offset comes first, so the lab wants to inspect every run order before choosing one.
Return every arrangement of offsets that uses each offset exactly once, so n offsets yield n! arrangements. Each arrangement lists the offsets in the sequence they would be applied. The arrangements themselves may be handed back in whatever sequence you like.
The offsets are pairwise distinct, so no two arrangements are identical.
Example 1
Three offsets admit six run orders, one for each choice of which offset is applied first paired with each ordering of the remaining two.
Example 2
With two offsets the bench can only apply them in one order or the other.
Example 3
A single offset leaves nothing to reorder, so exactly one run order exists.
The values you return may be in any order.
The editor is preloaded with this. It matches the parent problem's shape, so a solution that works here transfers to a judge unchanged.
def run_orders(offsets: list[int]) -> list[list[int]]:public List<List<Integer>> runOrders(int[] offsets)See the step-by-step animation, the intuition, and clean code in every language — free, no credit card.