๋ฌธ์
https://school.programmers.co.kr/learn/courses/30/lessons/12921
ํ์ด
def solution(n):
num=set(range(2,n+1))
for i in range(2,n+1):
if i in num:
num-=set(range(2*i,n+1,i))
return len(num)
์๋ผํ ์คํ ๋ค์ค์ ์ฒด๋ฅผ ์ด์ฉํ ํ์ด
'๐๏ธ Algorithm > โฌ ํ๋ก๊ทธ๋๋จธ์ค' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
โฌ [Programmers] [Python] [Level2] ์ ํ๋ฒํธ ๋ชฉ๋ก (0) | 2023.04.11 |
---|---|
โฌ [Programmers] [Python] [Level3] ์ด์ค ์ฐ์ ์์ ํ (0) | 2023.04.11 |
โฌ [Programmers] [Python] [Level1] ๊ฐ์ฅ ๊ฐ๊น์ด ๊ฐ์ ๊ธ์ (0) | 2023.04.10 |
โฌ [Programmers] [Python] [Level1] ํธ๋ ํ์ดํธ ๋ํ (0) | 2023.04.10 |
โฌ [Programmers] [Python] [Level1] ์ผ์ด์ฌ (0) | 2023.04.10 |