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
- Number Theory
- bit manipulation
- 구현
- Matrix
- Class
- greedy
- SQL
- Data Structure
- 코테
- Math
- Stack
- string
- Binary Search
- Method
- Tree
- Binary Tree
- Counting
- dynamic programming
- sorting
- geometry
- 자바
- two pointers
- hash table
- 파이썬
- simulation
- java
- implement
- database
- array
- 코딩테스트
Archives
- Today
- Total
코린이의 소소한 공부노트
[프로그래머스/Lv.2] 최댓값과 최솟값 본문
1. Input
1) 문자열 s
2. Output
1) 최솟값 공백 최댓값 형태의 문자열
3. Constraint
1) s에는 둘 이상의 정수가 공백으로 구분되어 있다.
4. Example
Input: s=“1 2 3 4” -> Output: “1 4”
5. Code
1) 첫 코드(2022/11/23)
String[] ss = s.split(" ");
int[] list = new int[ss.length];
for(int i=0 ; i<list.length ; i++)
list[i] = Integer.valueOf(ss[i]);
Arrays.sort(list);
return String.valueOf(list[0]) + " " + String.valueOf(list[list.length-1]);
'코딩테스트 풀이 > JAVA' 카테고리의 다른 글
[프로그래머스/Lv.2] N개의 최소공배수 (0) | 2022.11.23 |
---|---|
[프로그래머스/Lv.2] 피보나치 수 (0) | 2022.11.23 |
[프로그래머스/Lv.1] 최대공약수와 최소공배수 (0) | 2022.11.23 |
[프로그래머스/Lv.1] 콜라츠 추측 (0) | 2022.11.23 |
[프로그래머스/Lv.1] 평균 구하기 (0) | 2022.11.23 |