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 | 31 | 
													Tags
													
											
												
												- 우분투
- 더현대서울 맛집
- 캐치카페
- 편스토랑
- 금융문자분석경진대회
- Baekjoon
- 코로나19
- 데이콘
- leetcode
- Kaggle
- AI 경진대회
- ubuntu
- 프로그래머스 파이썬
- PYTHON
- dacon
- Git
- Docker
- hackerrank
- 편스토랑 우승상품
- 파이썬
- 자연어처리
- programmers
- SW Expert Academy
- ChatGPT
- 프로그래머스
- 백준
- gs25
- Real or Not? NLP with Disaster Tweets
- 맥북
- github
													Archives
													
											
												
												- Today
- Total
솜씨좋은장씨
[leetCode] 633. Sum of Square Numbers (Python) 본문
728x90
    
    
  반응형
    
    
    
  
Given a non-negative integer c, your task is to decide whether there're two integers a and b such that a2 + b2 = c.
Example 1:
Input: 5
Output: True
Explanation: 1 * 1 + 2 * 2 = 5Example 2:
Input: 3
Output: FalseSolution
class Solution:  
    def judgeSquareSum(self, c): 
        for i in range(0,int(c**0.5)+1):  
            extra=c-pow(i, 2)  
            if (pow(int(extra**0.5),2)) == extra:  
                return True  
        return False 


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] 541. Reverse String II (Python) (0) | 2020.06.22 | 
|---|---|
| [HackerRank] Sorting: Comparator (Python) (0) | 2020.06.20 | 
| [leetCode] 283. Move Zeroes (Python) (0) | 2020.06.19 | 
| [leetCode] 20. Valid Parentheses (Python) (0) | 2020.06.17 | 
| [leetCode] 125. Valid Palindrome (Python) (0) | 2020.06.16 | 
								  Comments
								
							
						
					
                    
                
					
					
					
					
					
					
				 
						
					 
					 
													 
													 
													