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
- 알고리즘
- cpu scheduling
- easy
- KAKAO
- Top-down
- GKE
- Programmers
- Singleton Pattern
- Observer Pattern
- docker
- mobaXTerm
- 피보나치
- k8s
- LeetCode
- github
- 그리디
- Kotlin
- golang
- Python
- 백준
- java
- 파이썬
- GCP
- kubernetes
- Backjoon
- Codility
- go
- BubbleSort
- Dynamic Programming
Archives
- Today
- Total
To Be Developer
[LeetCode] 367. Valid Perfect Square 본문
class Solution(object):
def isPerfectSquare(self, num):
"""
:type num: int
:rtype: bool
"""
# 정사각형인지 아닌지 확인
# num 은 사각형의 넓이
# 밑변 ^ 2 = 넓이
# 넓이 ^ 0.5 = 밑변
res = num**0.5
# 계산하면 float 형이 나온다.
# int로 형 변환 하였을 때 값의 크기가 변하지 않으면
# True
# 그렇지 않으면 False
if res == int(res):
return True
else :
return False
'알고리즘 > LeetCode' 카테고리의 다른 글
| [LeetCode] 561. Array Partition I (0) | 2019.03.24 |
|---|---|
| [LeetCode] 28. Implement strStr() (0) | 2019.03.24 |
| [LeetCode] 290. Word Pattern (0) | 2019.03.24 |
| [LeetCode] 263. Ugly Number (0) | 2019.03.23 |
| [LeetCode] 9. Palindrome Number.py (0) | 2019.03.22 |