250x250
Notice
Recent Posts
Recent Comments
- Today
- Total
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- certbot
- sequelize
- flutter
- Nodejs
- AWS
- css
- nginx
- await
- Node.js
- TypeScript
- jsonwebtoken
- RDS
- MYSQL
- async
- atlas
- findByIdAndDelete
- til
- wil
- JavaScript
- https
- double quote
- Find
- mongoose
- TailwindCSS
- moment
- Express
- EC2
- single quote
- clipBehavior
- mongodb
Link
Archives
반응형
목록약수 (1)
기억 휘발 방지소
약수 구하기
자연수 N (N > 0)이 주어졌을 때 N의 약수 구하기 👉 단순한 방법 def find_divisor(n): divisors = [] for i in range(1, n + 1): if n % i == 0: divisors.append(i) return divisors num = 100 print(find_divisor(num)) # [1, 2, 4, 5, 10, 20, 25, 50, 100] 반복문을 1부터 n까지 돌려준다. 만약 n을 i로 나누었을 때 나누어 떨어지면 약수이므로 divisor_list 배열에 저장해준다. 시간복잡도: O(N) 👉 좀 더 효율적인 방법 def find_divisor(n): divisors = [] for i in range(1, int(n**0.5) + 1): if n..
Algorithm
2022. 7. 22. 17:49
반응형