인프런 영문 브랜드 로고
인프런 영문 브랜드 로고

Inflearn Community Q&A

comad's profile image
comad

asked

Introduction to Python Algorithm Problem Solving (Coding Test Preparation)

5. Conference room assignment (greedy)

회의실 배정

Written on

·

231

0

이렇게 코드를 작성했는데 이것도 맞는 답인가요?

n = int(input())
a_lst = []
b_lst = []
for i in range(n):
    total = 0
    a, b = map(int, input().split())
    a_lst.append(a)
    b_lst.append(b)

    for j in range(0, len(b_lst)):
        for k in range(0, len(a_lst)):
            if b_lst[j] == a_lst[k]:
                total += 1
   
    largest = total
    if total > largest:
        total = largest
print(total)
python코테 준비 같이 해요!

Answer 1

0

codingcamp님의 프로필 이미지
codingcamp
Instructor

안녕하세요^^

회의실 배정은 정렬하고 O(n)으로 해결하는게 정석입니다. 

comad's profile image
comad

asked

Ask a question