Notice
Recent Posts
Recent Comments
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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
- hackerrank
- gs25
- 편스토랑 우승상품
- 데이콘
- 맥북
- programmers
- SW Expert Academy
- Real or Not? NLP with Disaster Tweets
- 코로나19
- 편스토랑
- 프로그래머스 파이썬
- Baekjoon
- 백준
- PYTHON
- 우분투
- Kaggle
- ubuntu
- dacon
- AI 경진대회
- leetcode
- 캐치카페
- ChatGPT
- github
- 자연어처리
- 더현대서울 맛집
- 금융문자분석경진대회
- 파이썬
- 프로그래머스
- Git
- Docker
Archives
- Today
- Total
솜씨좋은장씨
[Programmers] 해시 : 위장 (Python) 본문
728x90
반응형

1일 1문제 65일차!
오늘의 문제는 프로그래머스 해시의 위장입니다.
프로그래머스
코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.
programmers.co.kr
Solution
def solution(clothes):
answer = 1
spy_clothes_dict = {}
for cloth in clothes:
if cloth[1] not in spy_clothes_dict.keys():
spy_clothes_dict[cloth[1]] = 1
else:
spy_clothes_dict[cloth[1]] = spy_clothes_dict[cloth[1]] + 1
all_values = list(spy_clothes_dict.values())
values_without_zero = [val for val in all_values if val != 0]
for value in values_without_zero:
answer = answer * (value + 1)
answer = answer - 1
return answer
SOMJANG/CODINGTEST_PRACTICE
1일 1문제 since 2020.02.07. Contribute to SOMJANG/CODINGTEST_PRACTICE development by creating an account on GitHub.
github.com
'Programming > 코딩 1일 1문제' 카테고리의 다른 글
[Programmers] 스택/큐 : 다리를 지나는 트럭 (Python) (0) | 2020.04.13 |
---|---|
[BaekJoon] 1264번 : 모음의 개수 (Python) (0) | 2020.04.12 |
[BaekJoon] 1912번 : 연속합 (Python) (0) | 2020.04.10 |
[Programmers] 힙 : 디스크 컨트롤러 (Python) (0) | 2020.04.09 |
[BaekJoon] 9465번 : 스티커 (Python) (1) | 2020.04.08 |