Trains the technique from
LeetCode 360Sort Transformed ArrayThis 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 tuning rig is swept through a list of dial offsets, given in non-decreasing order and possibly containing repeats. At offset x the rig reports the response
a * x * x + b * x + c
Return the responses of all the offsets, arranged in non-decreasing order. The returned list has one entry per offset, so a repeated offset contributes its response more than once. Any of a, b and c may be zero or negative.
Example 1
The five responses are 8, 3, 0, -1 and 0 in dial order, and the returned list is those same five numbers arranged from smallest to largest.
Example 2
With a zero leading coefficient the responses are 13, 7, 1 and -2, so the returned list reverses the dial order.
Example 3
Offset -2 reports -4 and offset 3 reports 6. Each offset appears twice, so each response appears twice in the answer.
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 sorted_responses(offsets: list[int], a: int, b: int, c: int) -> list[int]:public int[] sortedResponses(int[] offsets, int a, int b, int c)See the step-by-step animation, the intuition, and clean code in every language — free, no credit card.