- 문제
모의고사- 완전탐색
코딩테스트 연습 - 모의고사 | 프로그래머스 스쿨 (programmers.co.kr)
프로그래머스
코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.
programmers.co.kr
- 코드
def solution(answers):
answer = []
first=[1,2,3,4,5]
second=[2,1,2,3,2,4,2,5]
third=[3,3,1,1,2,2,4,4,5,5]
score=[0,0,0]
for i in range(len(answers)):
if answers[i]==first[i%len(first)]:
score[0]+=1
if answers[i]==second[i%len(second)]:
score[1]+=1
if answers[i]==third[i%len(third)]:
score[2]+=1
maxs=max(score)
result=[]
for i in range(3):
if score[i]==maxs:
result.append(i+1)
return result
- 문제
최소직사각형 - 완전탐색
코딩테스트 연습 - 최소직사각형 | 프로그래머스 스쿨 (programmers.co.kr)
프로그래머스
코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.
programmers.co.kr
- 내가 짠 코드
def solution(sizes):
w=[]
h=[]
for i in range(len(sizes)):
w.append(max(sizes[i]))
h.append(min(sizes[i]))
return max(w) * max(h)
- 문제
회문 문자열 검사 - 탐색
- 코드
n=int(input())
for i in range(n):
a=input()
a=a.upper()
if a == a[::-1]:
print("#%d YES" %i)
else:
print("#%d NO" %i)
'코딩테스트' 카테고리의 다른 글
코테 스터디 18번째 TIL : 탐색, 시뮬레이션 문제 풀이 (0) | 2024.09.05 |
---|---|
99클럽 코테 스터디 40일차 TIL : 문제 풀이 (1) | 2024.08.29 |
99클럽 코테 스터디 37일차 TIL : DFS 문제 풀이 (0) | 2024.08.27 |
99클럽 코테 스터디 24일차 TIL : DFS 문제 풀이 (0) | 2024.08.14 |
99클럽 코테 스터디 21일차 TIL : 그리디, DFS 문제 풀이 (0) | 2024.08.13 |