Notice
Recent Posts
Recent Comments
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- Real or Not? NLP with Disaster Tweets
- gs25
- 프로그래머스 파이썬
- SW Expert Academy
- 코로나19
- hackerrank
- AI 경진대회
- 자연어처리
- github
- leetcode
- Git
- dacon
- 백준
- 편스토랑 우승상품
- 캐치카페
- programmers
- 파이썬
- Kaggle
- Baekjoon
- 금융문자분석경진대회
- ChatGPT
- 더현대서울 맛집
- 데이콘
- Docker
- ubuntu
- 우분투
- PYTHON
- 프로그래머스
- 맥북
- 편스토랑
- Today
- 1
- Total
- 2,398,405
솜씨좋은장씨
[leetCode] 367. Valid Perfect Square (Python) 본문
728x90
반응형
Given a positive integer num, write a function which returns True if num is a perfect square else False.
Follow up: Do not use any built-in library function such as sqrt.
Example 1:
Input: num = 16
Output: true
Example 2:
Input: num = 14
Output: false
Constraints:
- 1 <= num <= 2^31 - 1
Solution
class Solution:
def isPerfectSquare(self, num: int) -> bool:
sqrt_num = num ** 0.5
answer = False
if sqrt_num == int(sqrt_num):
answer = True
return answer
SOMJANG/CODINGTEST_PRACTICE
1일 1문제 since 2020.02.07. Contribute to SOMJANG/CODINGTEST_PRACTICE development by creating an account on GitHub.
github.com
'Programming > 코딩 1일 1문제' 카테고리의 다른 글
[leetCode] 476. Number Complement (Python) (0) | 2021.01.27 |
---|---|
[leetCode] 784. Letter Case Permutation (Python) (0) | 2021.01.26 |
[leetCode] 804. Unique Morse Code Words (Python) (0) | 2021.01.24 |
[leetCode] 1636. Sort Array by Increasing Frequency (Python) (0) | 2021.01.23 |
[leetCode] 648. Replace Words (Python) (0) | 2021.01.22 |
0 Comments