๐Ÿ’ป

[ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค] ์ฝ”๋”ฉํ…Œ์ŠคํŠธ ์—ฐ์Šต > ์™„์ „ํƒ์ƒ‰ > ์ตœ์†Œ์ง์‚ฌ๊ฐํ˜• ๋ณธ๋ฌธ

์•Œ๊ณ ๋ฆฌ์ฆ˜/๊ธฐ์ดˆ๋‹ค์ง€๊ธฐ

[ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค] ์ฝ”๋”ฉํ…Œ์ŠคํŠธ ์—ฐ์Šต > ์™„์ „ํƒ์ƒ‰ > ์ตœ์†Œ์ง์‚ฌ๊ฐํ˜•

๋˜ํšจ๋‹ˆ 2024. 11. 1. 16:37

https://school.programmers.co.kr/learn/courses/30/lessons/86491

 

ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค

SW๊ฐœ๋ฐœ์ž๋ฅผ ์œ„ํ•œ ํ‰๊ฐ€, ๊ต์œก, ์ฑ„์šฉ๊นŒ์ง€ Total Solution์„ ์ œ๊ณตํ•˜๋Š” ๊ฐœ๋ฐœ์ž ์„ฑ์žฅ์„ ์œ„ํ•œ ๋ฒ ์ด์Šค์บ ํ”„

programmers.co.kr

LV1. ์ตœ์†Œ์ง์‚ฌ๊ฐํ˜•

 

๐Ÿ’ก์•„์ด๋””์–ด

๋ชจ๋“  ๋ช…ํ•จ์„ ๋„ฃ์„ ์ˆ˜ ์žˆ๋Š” ์ง€๊ฐ‘์„ ๋งŒ๋“œ๋ ค๋ฉด ๊ฐ€๋กœ๋˜ ์„ธ๋กœ๋˜ MAX๊ธธ์ด๋กœ ๋ฐ”๊ฟ”์•ผํ•˜๋Š”๋ฐ, 

2๋ฒˆ์งธ ์›์†Œ๋งŒ ๋ฐ”๊ฟ”์„œ ์ƒ๊ฐํ•˜๋ฉด [70,30] ๋˜๋ฏ€๋กœ ๊ฐ€๋กœ๊ธธ์ด๊ฐ€ 60,70,60,80 ์„ธ๋กœ๊ธธ์ด๊ฐ€ 50,30,30,40 ์ด ๋œ๋‹ค.

๊ฐ€๋กœ๊ธธ์ด ์ค‘ ์ตœ๋Œ€์ธ 80 ๊ณผ ์„ธ๋กœ๊ธธ์ด ์ค‘ ์ตœ๋Œ€์ธ 50 ์„ ๊ณฑํ•œ 4000 ์ด ์ •๋‹ต์ด๋‹ค.

๋”ฐ๋ผ์„œ, ์ด ๋ฌธ์ œ๋Š” size๋ฐฐ์—ด์˜ ๊ฐ€๋กœ์™€ ์„ธ๋กœ๋ฅผ ๊ฐ€์ง€๊ณ  max์™€ min์˜ ๋ฐฐ์—ด์„ ๋งŒ๋“  ํ›„์— max๊ฐ’์„ ์ฐพ์•„์„œ ๊ณฑํ•˜๋ฉด ์ •๋‹ต์ด ๋œ๋‹ค.

 

 

๐Ÿ’ป ์ฝ”๋“œ์ž‘์„ฑ

def solution(sizes):
    answer = 0
    max_list = []
    min_list = []
    for idx, size in enumerate(sizes):
        max_list.append(max(size[0], size[1])) 
        min_list.append(min(size[0], size[1]))

    answer = max(max_list)*max(min_list)        
        
    return answer
๋ฐ˜์‘ํ˜•
Comments