Search
⌘K

Leetcode 360. Sort Transformed Array

Given a sorted array nums and a quadratic function f(x)=ax^2+bx+c, transform each element by f and return the values in sorted order. The key is to exploit the parabola's shape (monotonic on each side of its vertex) with a two-pointer sweep to produce the sorted result in O(n) time.

Asked at:

Meta


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Early October, 2025

Meta

Senior

Interviewer asked squares of a sorted array question, then the follow up was this question

Comments

Your account is free and you can post anonymously if you choose.