Trains the technique from
LeetCode 1752Check if Array Is Sorted and RotatedThis 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 pottery studio loads clay trays onto a circular turntable, one tray per station around the rim. House procedure says the loader picks any station to begin at and then works clockwise around the full circle, never putting on a tray lighter than the one just placed. Two trays of equal weight next to each other are perfectly fine.
An inspector arrives later and reads the weights off clockwise into the array weights, but the inspector begins at whichever station happens to face the doorway, which is not usually the station the loader began at. So the reading is the loader's ordering turned around the rim by some unknown number of stations.
Decide whether the reading is consistent with house procedure: return true when some station exists such that reading weights clockwise from it, all the way around, never steps down in weight, and false when no station does that. The inspector's own starting station counts, so a reading that never steps down as written is consistent.
Example 1
Beginning at the station holding 4 and going clockwise gives 4, 5, 6, 7, 9, which never steps down, so the loader could have started there.
Example 2
Reading clockwise from each station in turn gives 5, 3, 8, 6 then 3, 8, 6, 5 then 8, 6, 5, 3 then 6, 5, 3, 8. Every one of those steps down somewhere, so no station is consistent with procedure.
Example 3
Equal weights are allowed side by side, so the reading never steps down at all and any station works.
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 turntable_weight_order(weights: list[int]) -> bool:public boolean turntableWeightOrder(int[] weights)See the step-by-step animation, the intuition, and clean code in every language — free, no credit card.