# Sort Transformed Array

Given a sorted array of integers nums and integer values ab and c. Apply a function of the form f(x) = ax2 + bx + c to each element x in the array.

The returned array must be in sorted order.

Expected time complexity: O(n)

Example:

```nums = [-4, -2, 2, 4], a = 1, b = 3, c = 5,

Result: [3, 9, 15, 33]

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

Result: [-23, -5, 1, 7]

https://discuss.leetcode.com/topic/48424/java-o-n-incredibly-short-yet-easy-to-understand-ac-solution
```
``` 1 public class Solution {
2     public int[] sortTransformedArray(int[] nums, int a, int b, int c) {
3         int n = nums.length;
4         int[] sorted = new int[n];
5         int i = 0, j = n - 1;
6         int index = a >= 0 ? n - 1 : 0;
7         while (i <= j) {
8             if (a >= 0) {
10             } else {
12             }
13         }
14         return sorted;
15     }
16
17     private int quad(int x, int a, int b, int c) {
18         return a * x * x + b * x + c;
19     }
20 }```

## 360. Sort Transformed Array

Given a sorted array of integers nums and integer values a, b and c. Apply a function of the form f(x) = ax2 + bx + c to each element x in the array. The returned array must be in sorted order. Expected time complexity: O(n) Example: nums = [-4, -2,

## [LeetCode] Sort Transformed Array 变换数组排序

Given a sorted array of integers nums and integer values a, b and c. Apply a function of the form f(x) = ax2 + bx + c to each element x in the array. The returned array must be in sorted order. Expected time complexity: O(n) Example: nums = [-4, -2,

## Leetcode 360: Sort Transformed Array

Given a sorted array of integers nums and integer values a, b and c. Apply a quadratic function of the form f(x) = ax2 + bx + c to each element x in the array. The returned array must be in sorted order. Expected time complexity: O(n) Example: nums =

## 360. Sort Transformed Array二元一次方程返回大数序列

［抄题］: Given a sorted array of integers nums and integer values a, b and c. Apply a quadratic function of the form f(x) = ax2 + bx + c to each element x in the array. The returned array must be in sorted order. Expected time complexity: O(n) Example 1

## leetcode360 - Sort Transformed Array - medium

Given a sorted array of integers nums and integer values a, b and c. Apply a quadratic function of the form f(x) = ax2 + bx + c to each element x in the array.The returned array must be in sorted order.Expected time complexity: O(n)Example 1:Input: n

## Sort the Array

Being a programmer, you like arrays a lot. For your birthday, your friends have given you an array a consisting of n distinct integers. Unfortunately, the size of a is too small. You want a bigger array! Your friends agree to give you a bigger array,

## Codeforces Round #258 (Div. 2) B. Sort the Array

Being a programmer, you like arrays a lot. For your birthday, your friends have given you an array a consisting of n distinct integers. Unfortunately, the size of a is too small. You want a bigger array! Your friends agree to give you a bigger array,