
공통된 문제 하나씩 풀어와서 서로 설명해주는 오프라인 스터디
문제 풀이
프로그래머스
코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.
programmers.co.kr
// 석우님의 풀이 - 1
const test = sizes.map(el => el[0] > el[1] ? el[0] : el[1]);
const test2 = sizes.map(el => el[1] < el[0] ? el[1] : el[0]);
console.log(test, test2);
return Math.max(...test) * Math.max(...test2);
// 2
sizes.forEach(el => {
el.sort((a, b) => b - a);
})
const 큰놈 = sizes.map(el => el[0])
const 작은놈 = sizes.map(el => el[1])
return Math.max(...큰놈) * Math.max(...작은놈);
// 도영님의 풀이
function solution(sizes) {
let bestSize = [Math.max(...sizes.map(v => Math.min(...v))),
Math.max(...sizes.map(v => Math.max(...v)))]
return bestSize[0] * bestSize[1];
}
'알고리즘 > Programmers' 카테고리의 다른 글
[알고리즘 스터디][프로그래머스 Lv.1] 나머지가 1이 되는 수 찾기 (0) | 2022.12.25 |
---|---|
[알고리즘 스터디][프로그래머스 Lv.0] 최빈값 구하기 (0) | 2022.12.24 |
[프로그래머스 Lv.0] 양꼬치 (0) | 2022.11.05 |
[프로그래머스 Lv.0] 배열의 평균 (0) | 2022.11.05 |
[프로그래머스 Lv.0] 각도기 문제로 알아보는 filter.length 써먹기 (0) | 2022.11.02 |