일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 | 29 | 30 |
Tags
- 프로젝트
- 사이드
- FIT XR
- 만화도
- 미드시청
- 괜찮음
- Problem Solving
- 잡생각
- 개발자
- 스탭퍼
- 3줄정리
- Writing
- 10분
- 링피트
- 파비최
- 30분
- 뭐든
- 화상영어
- 읽기
- 운동
- 매일
- 쓰릴오브파이트
- leetcode
- English
- 리얼 클래스
- realclass
- Daily Challenge
- 영어공부
- 월간
- 영어원서읽기
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