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 |
Tags
- SQL
- Math
- 파이썬
- 코테
- simulation
- sorting
- bit manipulation
- geometry
- database
- implement
- array
- 자바
- Matrix
- greedy
- Stack
- Number Theory
- string
- Binary Tree
- Counting
- 구현
- java
- Binary Search
- Tree
- dynamic programming
- Method
- Class
- two pointers
- hash table
- Data Structure
- 코딩테스트
Archives
- Today
- Total
코린이의 소소한 공부노트
[LeetCode/Easy] 2413. Smallest Even Multiple 본문
1. Input
1) int n
2. Output
2) 2와 n의 배수 중 가장 작은 수를 반환
3. Constraint
1) 1 <= n <= 150인 양의 정수
4. Example
Input: n = 5 -> Output: 10
Input: n = 6 -> Output: 6
5. Code
1) 첫 코드(2023/05/03)
class Solution {
public int smallestEvenMultiple(int n) {
if(n%2==0)
return n;
else
return n*2;
}
}
'코딩테스트 풀이 > JAVA' 카테고리의 다른 글
[LeetCode/Easy] 2427. Number of Common Factors (0) | 2023.05.03 |
---|---|
[LeetCode/Easy] 2418. Sort the People (0) | 2023.05.03 |
[LeetCode/Easy] 2399. Check Distances Between Same Letters (0) | 2023.05.03 |
[LeetCode/Easy] 2395. Find Subarrays With Equal Sum (0) | 2023.05.03 |
[백준 온라인 저지] 13909. 창문 닫기 (0) | 2023.05.02 |