One Line Solution using Java 8


  • 0
    J
    public class Solution {
        public int[] sortTransformedArray(int[] nums, int a, int b, int c) {
            return IntStream.of(nums).boxed().mapToInt(x->(a*x*x+b*x+c)).sorted().toArray();
        }
    }
    

Log in to reply
 

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