Skip to content

Instantly share code, notes, and snippets.

@DongguemYoo
Created July 5, 2020 04:34
Show Gist options
  • Save DongguemYoo/6d2ec60f16b57a1e31d6a0652e7d7f59 to your computer and use it in GitHub Desktop.
Save DongguemYoo/6d2ec60f16b57a1e31d6a0652e7d7f59 to your computer and use it in GitHub Desktop.
[코드잇] 최대 곲 구하기 python
#최대곲 구하기
def max_product(card_lists):
# 코드를 작성하세요.
answer = 1;
#하나씩 돌면서 최고값을 곱해주고 삭제한다.
for i in range(0, len(card_lists)):
answer*= max(card_lists[i])
card_lists[i].remove(max(card_lists[i]))
return answer;
# 예시
test_cards = [[1, 2, 3], [4, 6, 1], [8, 2, 4], [3, 2, 5], [5, 2, 3], [3, 2, 1]]
print(max_product(test_cards))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment