[Algorithm] 14 week(4.11 ~ 4.17) 1/3

Dev_min·2022년 4월 11일
0

algorithm

목록 보기
44/157

1464. Maximum Product of Two Elements in an Array

var maxProduct = function(nums) {
    const sortedNums = nums.sort((a, b) => a - b);
    return (sortedNums[nums.length - 1] - 1) * (sortedNums[nums.length - 2] - 1)
};
profile
TIL record

0개의 댓글