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
- 코딩테스트
- two pointers
- 코테
- Number Theory
- Method
- 구현
- greedy
- Stack
- Binary Tree
- Data Structure
- SQL
- dynamic programming
- simulation
- Counting
- bit manipulation
- array
- java
- Math
- Binary Search
- string
- geometry
- 자바
- hash table
- implement
- Matrix
- 파이썬
- database
- Tree
- Class
- sorting
Archives
- Today
- Total
코린이의 소소한 공부노트
[프로그래머스/Lv.0] 제곱수 판별하기 본문
1. Input
1) 정수 n
2. Output
1) n이 제곱수라면 1을, 아니라면 2를 반환
2) 제곱수는 어떤 자연수를 제곱했을 때 나오는 정수
3. Constraint
1) 1 <= n <= 1000000
4. Example
Input: n=144 -> Output: 1
Input: n=10 -> Output: 2
5. Code
1) 첫 코드(2022/10/25)
int i = 1;
while(true){
if(i*i==n) return 1;
else if(i*i>n) return 2;
i++;
}
'코딩테스트 풀이 > JAVA' 카테고리의 다른 글
[프로그래머스/Lv.0] 문자열 정렬하기 (2) (0) | 2022.11.01 |
---|---|
[프로그래머스/Lv.0] 세균 증식 (0) | 2022.11.01 |
[프로그래머스/Lv.0] 문자열안에 문자열 (0) | 2022.11.01 |
[프로그래머스/Lv.0] OX퀴즈 (0) | 2022.11.01 |
[프로그래머스/Lv.0] 자릿수 더하기 (0) | 2022.11.01 |