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
- greedy
- implement
- sorting
- array
- string
- 코딩테스트
- Matrix
- geometry
- Data Structure
- database
- Method
- 구현
- 파이썬
- simulation
- SQL
- Tree
- 코테
- Class
- dynamic programming
- java
- bit manipulation
- 자바
- Counting
- Binary Tree
- Number Theory
- two pointers
- hash table
- Binary Search
- Stack
- Math
Archives
- Today
- Total
코린이의 소소한 공부노트
[LeetCode/Easy] 2481. Minimum Cuts to Divide a Circle 본문
1. Input
1) int n
2. Output
1) 원판을 n등분 하기 위한 최소 커팅 횟수를 반환
- 1회 커팅에 지름 또는 반지름의 형태로만 자를 수 있다.
3. Constraint
1) 1 <= n <= 100
4. Example
Input: n = 4 -> Output: 2
Input: n = 3 -> Output: 3
설명:
- 지름 형태로 2번 자르면 4등분이 된다.
- 반지름 형태로 3번 자르면 3등분이 된다.
5. Code
1) 첫 코드(2023/05/04)
class Solution {
public int numberOfCuts(int n) {
if(n==1) return 0;
return n%2==0 ? n/2 : n;
}
}
'코딩테스트 풀이 > JAVA' 카테고리의 다른 글
[프로그래머스/Lv.0] 그림 확대 (0) | 2023.05.04 |
---|---|
[LeetCode/Easy] 2485. Find the Pivot Integer (0) | 2023.05.04 |
[LeetCode/Easy] 2475. Number of Unequal Triplets in Array (0) | 2023.05.04 |
[LeetCode/Easy] 2469. Convert the Temperature (0) | 2023.05.04 |
[LeetCode/Easy] 2465. Number of Distinct Averages (0) | 2023.05.04 |