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 | 29 | 30 |
| 31 |
Tags
- 티스토리챌린지
- code
- SQL
- 컴퓨터공학
- 오블완
- Mesh
- Python
- coding
- DS
- 컴퓨터사이언스
- 개발자
- Data_Structure
- CS
- meshgraphnet
- 데베
- CNN
- 대학생
- Database
- 코딩테스트
- mysql
- 데이터
- db
- 데이터베이스
- GNN
- 코테
- 자료구조
- sort
- Leet Code
- adaptive remeshing
- LeetCode
Archives
- Today
- Total
sy1214ei 님의 블로그
[Leet Code] 561. Array Partition 본문
class Solution:
# def selection_sort(self, nums):
# for i in range(len(nums)):
# smallest = i
# for j in range(i+1, len(nums)):
# if nums[j] < nums[smallest]:
# smallest = j
# nums[i], nums[smallest] = nums[smallest], nums[i]
# return nums
def arrayPairSum(self, nums: List[int]) -> int:
# nums = self.selection_sort(nums)
nums.sort()
result = 0
for i in range(0,len(nums), 2):
result += nums[i]
return result
'[Coding]' 카테고리의 다른 글
| [Leet Code] 628. Maximum Product of Three Numbers - Python (0) | 2024.11.25 |
|---|---|
| [Leet Code] 594. Longest Harmonious Subsequence - Python (0) | 2024.11.25 |
| [Leet Code] 414. Third Maximum Number (1) | 2024.11.25 |
| [Leet Code] 350. Intersection of Two Arrays II (0) | 2024.11.25 |
| [Leet Code] 349. Intersection of Two Array (1) | 2024.11.25 |