A/C Python solution, beat 90%, easy to understand


  • 0
    W

    class Solution(object):
    def sortTransformedArray(self, nums, a, b, c):
    """
    :type nums: List[int]
    :type a: int
    :type b: int
    :type c: int
    :rtype: List[int]
    """
    res = []

        for num in nums:
            tmp = a*num*num + b*num + c
            res.append(tmp)
            
        return sorted(res)

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.