Notice
Recent Posts
Recent Comments
Link
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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 |
| 29 | 30 | 31 |
Tags
- tibero
- VirtualBox
- Algorithm
- 데이터베이스
- C#
- 파이썬 데이터프레임
- Python DataFrame
- 리눅스
- 파이썬 전처리
- HTML
- 코딩테스트
- csharp
- 오라클
- dbeaver
- 파이썬
- putty
- sql
- PYTHON
- Oracle
- 파이썬 알고리즘
- 리눅스 명령어
- Oracle VM VirtualBox
- python algorithm
- it용어
- linux
- MariaDB
- Python 라이브러리
- 알고리즘
- it 용어
- RFP
Archives
- Today
- Total
오경석의 개발노트
Python 알고리즘_1부터 n까지 연속한 숫자의 제곱의 합 본문
# algorithm_1, 계산복잡도 : O(n)
def squared1(n):
result = 0
for i in range(1, n + 1):
result += i * i
return result
# algorithm_2, 계산복잡도 : O(1)
def squared_2(n):
return n * (n + 1) * (2 * n + 1) // 6'알고리즘 > Python 알고리즘' 카테고리의 다른 글
| Python 알고리즘_리스트 최솟값 구하기 (0) | 2022.11.14 |
|---|---|
| Python 알고리즘_리스트 최댓값 구하기 (0) | 2022.11.14 |
| Python 알고리즘_리스트 최댓값의 위치 구하기 (0) | 2022.11.14 |
| Python 알고리즘_1부터 n까지의 합 구하기 (0) | 2022.11.09 |
| Python 알고리즘_절댓값 구하기 (0) | 2022.11.09 |
Comments