PracHub
QuestionsPremiumLearningGuidesCheatsheetNEWCoaches
|Home/Coding & Algorithms/Two Sigma

Return sorted values after quadratic transform

Last updated: Mar 29, 2026

Quick Overview

This question evaluates understanding of mathematical transformations and array manipulation, specifically how applying a quadratic function affects the ordering of a sorted sequence.

  • nan
  • Two Sigma
  • Coding & Algorithms
  • Data Scientist

Return sorted values after quadratic transform

Company: Two Sigma

Role: Data Scientist

Category: Coding & Algorithms

Difficulty: nan

Interview Round: Technical Screen

## Problem You are given a sorted integer array `nums` (non-decreasing order) and integers `a`, `b`, `c` that define a quadratic function: \[ f(x) = ax^2 + bx + c \] Apply the function to every element in `nums`, producing an array `res[i] = f(nums[i])`. Return `res` in **sorted (non-decreasing) order**. ### Input - `nums`: sorted array of integers - `a`, `b`, `c`: integers ### Output - A sorted array containing `f(x)` for each `x` in `nums` ### Constraints - `1 <= len(nums) <= 2 * 10^5` - `-10^4 <= nums[i], a, b, c <= 10^4` ### Example - Input: `nums = [-4,-2,2,4], a = 1, b = 3, c = 5` - Output: `[3,9,15,33]`

Quick Answer: This question evaluates understanding of mathematical transformations and array manipulation, specifically how applying a quadratic function affects the ordering of a sorted sequence.

Related Interview Questions

  • Implement Price-Time Order Matching - Two Sigma (medium)
  • Compute Piecewise Linear Interpolation - Two Sigma (medium)
  • Implement an In-Memory Database - Two Sigma (hard)
  • Merge two sorted linked lists - Two Sigma (hard)
  • Merge Two Sorted Lists - Two Sigma (hard)
Two Sigma logo
Two Sigma
Jan 22, 2026, 12:00 AM
Data Scientist
Technical Screen
Coding & Algorithms
3
0
Loading...

Problem

You are given a sorted integer array nums (non-decreasing order) and integers a, b, c that define a quadratic function:

f(x)=ax2+bx+cf(x) = ax^2 + bx + cf(x)=ax2+bx+c

Apply the function to every element in nums, producing an array res[i] = f(nums[i]). Return res in sorted (non-decreasing) order.

Input

  • nums : sorted array of integers
  • a , b , c : integers

Output

  • A sorted array containing f(x) for each x in nums

Constraints

  • 1 <= len(nums) <= 2 * 10^5
  • -10^4 <= nums[i], a, b, c <= 10^4

Example

  • Input: nums = [-4,-2,2,4], a = 1, b = 3, c = 5
  • Output: [3,9,15,33]

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Two Sigma•More Data Scientist•Two Sigma Data Scientist•Two Sigma Coding & Algorithms•Data Scientist Coding & Algorithms
PracHub

Master your tech interviews with 7,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.