Skip to content

Commit a20e979

Browse files
committed
O(nlogn) time for sorting and O(1) space
1 parent 805fe3f commit a20e979

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
class Solution:
2+
def sortTransformedArray(self, nums: List[int], a: int, b: int, c: int) -> List[int]:
3+
def quad_func(x):
4+
return a * (x**2) + b*x + c
5+
return sorted([quad_func(x) for x in nums])

0 commit comments

Comments
 (0)