| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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
- collections
- cte
- sql
- Queue
- AARRR
- tableau
- 완전탐색
- lv4
- time complexity
- 코딩테스트
- Level2
- LeetCode
- coding
- import re
- 파이썬
- mysql
- 프로그래머스
- 코테
- programmers
- python
- coding test
- join
- level4
- 코딩
- lambda
- Growth hacking
- itertools
- counter
- Stack
- 조합
Archives
- Today
- Total
목록Iterations (1)
ror_coding
[Python] Counter (collections)
collections Library 불러오기.from collections import Counter Counter를 적용한 data.data = [1,4,2,2,3,3,5,5]data = Counter(data) # O(n) 1. most_common() : 빈도 순으로 정렬하여 출력.for item, count in data.most_common(): # O(n log n) print(item, count)Element: 3, Count: 2 Element: 2, Count: 2 Element: 5, Count: 2 Element: 1, Count: 1 Element: 4, Count: 1 2. elements() : 각 요소를 해당 카운트만큼 반복해서 반환하는 iterater. (0 or 음수..
Coding Test/Python
2024. 10. 24. 15:25