def sortTransformedArray(self, nums, a, b, c):
:type nums: List[int]
:type a: int
:type b: int
:type c: int
res = 
for num in nums: tmp = a*num*num + b*num + c res.append(tmp) return sorted(res)
Technically for some programming language you can solve it with two lines, one line apply function, second line sort them using build in methods.
But they ask you to do it in O(n), sort is O(n*logn).
sort is O(n*logn)
Here it's O(n).
How sorted function works?
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.