일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- 개발자
- 리얼 클래스
- 괜찮음
- 만화도
- 매일
- 스탭퍼
- FIT XR
- 30분
- 쓰릴오브파이트
- 영어원서읽기
- English
- 운동
- 사이드
- 화상영어
- 파비최
- Daily Challenge
- realclass
- 3줄정리
- Problem Solving
- 10분
- 읽기
- 영어공부
- 뭐든
- 링피트
- 월간
- leetcode
- 프로젝트
- 잡생각
- Writing
- 미드시청
Archives
- Today
- Total
파비의 매일매일 공부기록
2023.12.18 Today's Challenge 본문
https://leetcode.com/problems/maximum-product-difference-between-two-pairs/
Maximum Product Difference Between Two Pairs - LeetCode
Can you solve this real interview question? Maximum Product Difference Between Two Pairs - The product difference between two pairs (a, b) and (c, d) is defined as (a * b) - (c * d). * For example, the product difference between (5, 6) and (2, 7) is (5 * 6
leetcode.com
정렬 후 푸는 문제. 매우 쉬움
class Solution:
def maxProductDifference(self, nums: List[int]) -> int:
nums.sort(reverse=True)
return nums[0] * nums[1] - nums[-1] * nums[-2]
반응형
'Problem Solving > LeetCode' 카테고리의 다른 글
2023.12.20 Today's Challenge (1) | 2023.12.20 |
---|---|
2023.12.19 Today's Challenge (0) | 2023.12.19 |
2023.12.17 Today's Challenge (0) | 2023.12.17 |
2023.12.16 Today's Challenge (1) | 2023.12.16 |
2023.12.15 Today's Challenge (0) | 2023.12.15 |
Comments