[프로그래머스] 최댓값 만들기 (1)

Youje0·2023년 2월 21일

문제

정수 배열 numbers가 매개변수로 주어집니다. numbers의 원소 중 두 개를 곱해 만들 수 있는 최댓값을 return하도록 solution 함수를 완성해주세요.

내 풀이

function solution(numbers) {
    let a= numbers.sort((a,b)=>{return b-a})
    return a[0] * a[1]
}
profile
ㅠㅠ

0개의 댓글