LeetCode 360, Medium. Topics: Array, Math, Two Pointers, Sorting. View on LeetCode.
Generate this problem as a practice environment: tested reference solution, 16 parametrized pytest cases, and a playground notebook:
Problem
Given a sorted integer array nums and three integers a, b and c, apply a quadratic function of the form f(x) = ax^2 + bx + c to each element nums[i] in the array, and return the array in a sorted order.
Examples
Constraints
1 <= nums.length <= 200
-100 <= nums[i], a, b, c <= 100
nums is sorted in ascending order.
Follow up: Could you solve it in O(n) time?
Solution
Reference implementation from solution.py on GitHub, full suite in test_solution.py:
Complexity
NeetCode All. Last modified on September 7, 2026