반응형
https://school.programmers.co.kr/learn/courses/30/lessons/42747
프로그래머스
코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.
programmers.co.kr
풀이 (1차 시도)
쉬운 문제인거같다.
def solution(citations):
answer = 0
n = len(citations)
for i in range(1, n+1):
count = 0
for j in citations:
if j >= i:
count += 1
if count == i:
answer = count
return answer
풀이 (2차 시도)
def solution(citations):
answer = 0
n = len(citations)
for i in range(1, n+1):
count = 0
for j in citations:
if j >= i:
count += 1
if i >= count:
answer = count
break
return answer
반응형
'코딩 테스트 > Programmers' 카테고리의 다른 글
[Python] [Level 2] 튜플 (0) | 2022.11.01 |
---|---|
[Python] [Level 2] 행렬의 곱셈 (0) | 2022.10.31 |
[Python] [Level 2] 점프와 순간 이동 (0) | 2022.10.28 |
[Python] [Level 2] 예상 대진표 (0) | 2022.10.27 |
[Python] [Level 2] N개의 최소공배수 (0) | 2022.10.22 |