반응형
Recent Posts
Notice
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 |
Tags
- 백준 2309
- 코딩테스트준비
- til
- leetcode
- 딥러닝
- 개발자 취업
- 해시
- dfs
- softeer
- 개발자취업
- 혁펜하임
- 활성화 함수
- easy 딥러닝
- 기능개발
- 큐
- 항해99
- boj 2309
- BFS
- 코딩테스트 준비
- BOJ
- 스택
- python 2309
- 99항해
- 프로그래머스
- 파이썬
- 백준
- 구현
- Python
- 99클럽
- 알고리즘
Archives
- Today
- Total
동까의 코딩
[99클럽] 38일차 TIL 본문
반응형
이제 마지막 정규 스터디가 종료되었습니다.
그래도 매일 TIL 적는 습관을 가져가보도록 하겠습니다.
https://leetcode.com/problems/reduce-array-size-to-the-half/submissions/1302135035/
class Solution:
def minSetSize(self, arr: List[int]) -> int:
N = len(arr)
nums = defaultdict(int)
for num in arr:
nums[num] += 1
nums = sorted(nums.items(), key = lambda x: x[1], reverse=True)
count = 0
ans = 0
for key, value in nums:
count += value
ans += 1
if count >= N/2:
return ans
반응형
'문제 풀이 > 99클럽' 카테고리의 다른 글
99클럽 코테 스터디 1일차 TIL (0) | 2025.01.14 |
---|---|
[99항해] 39일차 TIL (0) | 2024.06.28 |
[99클럽] 37일차 TIL (0) | 2024.06.26 |
[99클럽] 36일차 TIL (0) | 2024.06.25 |
[99클럽] 35일차 TIL (0) | 2024.06.25 |