Wondering if there is a better solution

Revision en1, by Polar_, 2022-09-09 06:53:47

I found this on leetcode someone posted the problem . I am wondering if there is a solution for followup .
Given a calculation class where you initialize values for $$$a,b,c$$$ and the following function $$$f(x) = ax^2 + bx + c$$$, and a list of numbers, apply this function to all values in the list.

class Calculation {
int a;
int b;
int c;

int[] calculate(int[] arr)
}

Followup: We want the output array to be sorted. Can we do better than $$$O(nlogn)$$$?

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English Polar_ 2022-09-09 06:53:47 515 Initial revision (published)