FastPrepSort a Quadratic-Transformed Array
Problems/Sort a Quadratic-Transformed Array

Sort a Quadratic-Transformed Array

LinkedIn logoLinkedIn● MediumFULLTIMEPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in a LinkedIn phone screen. The report gives the quadratic transform, a sorted input and output, the need for linear time, and the first example. We chose the number limits, and how to treat an empty array and repeated values. Our version is about 95% the same as the reported question.

You are given an integer array nums sorted from smallest to largest and three integers a, b, and c. For each value x, calculate f(x) = a * x * x + b * x + c. Return all the results from smallest to largest.

  • Keep every result, including duplicates. Do not remove repeated input values or repeated results.
  • For this exercise, an empty input returns an empty array, and repeated input values are allowed.
  • Your solution must run in O(n) time, where n = nums.length.

For this exercise, the numeric limits below ensure every transformed value fits in a signed 32-bit integer. The coefficients may be positive, negative, or zero.

Function

sortQuadraticTransform(nums: int[], a: int, b: int, c: int) → int[]

Examples

Example 1

nums = [-4,-2,2,4]a = 1b = 3c = 5return = [3,9,15,33]

The transformed values in input order are [9,3,15,33]. Returning them in sorted order gives [3,9,15,33].

Example 2

nums = [-4,-2,2,4]a = -1b = 3c = 5return = [-23,-5,1,7]

The transformed values are [-23,-5,7,1]. Sorting retains all four occurrences and gives [-23,-5,1,7].

Example 3

nums = []a = 0b = 0c = 8return = []

There are no elements to transform, so the result is empty.

Constraints

  • 0 <= nums.length <= 2000.
  • -1000 <= nums[i] <= 1000; nums is sorted in nondecreasing order.
  • -100 <= a, b, c <= 100.
  • All inputs are integers. Under these practice bounds, |f(x)| <= 100100100, so exact signed 32-bit arithmetic is sufficient.

More LinkedIn Phone Screen questions

  • Maximum Product of a Contiguous SubarrayPHONE SCREEN · Seen Nov 2026
  • Maximum Sum of a Contiguous SubarrayPHONE SCREEN · Seen Nov 2026
  • Merge Two Sorted ListsPHONE SCREEN · Seen Nov 2026
  • Sqrt(x)PHONE SCREEN · Seen Nov 2026
  • Total Years of Work ExperiencePHONE SCREEN · Seen Nov 2026
  • Sum an Arbitrary-Dimensional ArrayPHONE SCREEN · Seen Oct 2026
  • Known Words Matching Phone DigitsPHONE SCREEN · Seen Oct 2026
  • Inverse-Depth Nested List SumPHONE SCREEN · Seen Oct 2026
  • Valid Number with ExponentsPHONE SCREEN · Seen Oct 2026
  • Constant-Time Minimum StackPHONE SCREEN · Seen Oct 2026

Similar questions at other companies

  • Find All Pythagorean TripletsDell Technologies · PHONE SCREENDell Technologies interview questions
  • Count Centaur Friend RequestsMeta · PHONE SCREENMeta interview questions
  • Valid Triangle NumberBloomberg LP · PHONE SCREEN · ONSITE INTERVIEWBloomberg LP interview questions
  • Count Winning Dice Face PairsGoogle · PHONE SCREEN · ONSITE INTERVIEWGoogle interview questions
  • Merge Sorted Squares of Two ArraysWhatNot · PHONE SCREEN · ONSITE INTERVIEWWhatNot interview questions
  • 3SumAmazon · PHONE SCREEN
  • Sort Ones, Twos, and Threes In PlaceAgoda · PHONE SCREEN · ONSITE INTERVIEWAgoda interview questions
  • Adaptive Calibration ErrorOpenAI · PHONE SCREENOpenAI interview questions
  • Meeting Rooms IIUber · PHONE SCREENUber interview questions
  • Sort ColorsVisa · PHONE SCREENVisa interview questions

LinkedIn interview experiences

  • LinkedIn Senior MLE Interview Questions: 1 Experience
  • LinkedIn Staff AI Engineer Phone Screens: 1 Experience
  • LinkedIn Experienced MLE Onsite: 1 Experience
  • LinkedIn Coding with AI Interview: 4 Experiences
  • LinkedIn Experienced Infrastructure SWE Onsite: 1 Experience
All LinkedIn interview questionsSee LinkedIn hiring insights
Saved
class Solution {
    public int[] sortQuadraticTransform(int[] nums, int a, int b, int c) {
        // Write your code here.
    }

}
Checking account…