AC Solution using Java 8 Lambda Expression


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

Log in to reply
 

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