Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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
- 1주일회고
- JavaScript
- Spring multimodule
- 취업리부트코스
- 프로그래머스
- TiL
- jwt
- 커스텀 헤더
- 인프콘 2024
- 99클럽
- 코딩테스트 준비
- DesignPattern
- 구글 OAuth login
- spring batch 5.0
- 디자인패턴
- 디자인 패턴
- 프로그래머스 이중우선순위큐
- KPT회고
- 개발자부트캠프추천
- 빈 조회 2개 이상
- 빈 충돌
- 파이썬
- 개발자 취업
- @FeignClient
- 전략패턴 #StrategyPattern #디자인패턴
- 단기개발자코스
- jwttoken
- Python
- infcon 2024
- 항해99
Archives
- Today
- Total
m1ndy5's coding blog
LeetCode 561. Array Partition with Python 본문
https://leetcode.com/problems/array-partition/
class Solution:
def arrayPairSum(self, nums: List[int]) -> int:
nums.sort()
answer = 0
for i in range(0, len(nums), 2):
answer += nums[i]
return answer
큰 애들은 큰 애들이랑 붙어야 큰 애들이 많이 살아남을 거 같아서 정렬한 다음 짝수번째 인덱스 애들만 더했다!
'알고리즘 with python > 알고리즘 스터디' 카테고리의 다른 글
LeetCode 232. Implement Queue using Stacks with Python (0) | 2024.01.04 |
---|---|
LeetCode 225. Implement Stack using Queues (0) | 2024.01.04 |
LeetCode 15. 3Sum with Python (2) | 2024.01.03 |
LeetCode 5. Longest Palindromic Substring with Python (1) | 2024.01.03 |
LeetCode 49. Group Anagrams with Python (1) | 2024.01.03 |