Notice
Recent Posts
Recent Comments
- Today
- Total
01-25 23:16
Tags
- array
- ์ธํด
- spring
- ๋ฐ์ดํฐ๋ฒ ์ด์ค
- database
- ์๋ฐ
- leetcode
- ์์์ ๋ ฌ
- ๋ฌธ๋ฒ
- dp
- java
- BFS
- ์กธ์ ์ํ
- MST
- ๋ฐฑ์ค
- ๋ค์ต์คํธ๋ผ
- ๊ตฌํ
- ๋ฒจ๋งํฌ๋
- PS
- Algorithm
- Graph
- ์๋ฐ์์ ์
- ๊ทธ๋ฆฌ๋
- ๋ฐฑ์๋
- CS
- ํ๋ก๊ทธ๋๋จธ์ค
- OOP
- pytorch
- ์๋ฃ๊ตฌ์กฐ
- tree
Link
Partially Committed
[๋ฐฐ์ด] ๊ฐ์ ์ซ์๋ ์ซ์ด (JAVA) ๋ณธ๋ฌธ
๐ฅ Algorithm || ๋ฌธ์ ํ์ด/PS
[๋ฐฐ์ด] ๊ฐ์ ์ซ์๋ ์ซ์ด (JAVA)
WonderJay 2022. 9. 2. 23:21728x90
๋ฐ์ํ
SMALL
https://school.programmers.co.kr/learn/courses/30/lessons/12906?language=java
ํ์ด1
import java.io.IOException;
import java.util.ArrayList;
class Solution {
public int[] solution(int []arr) throws IOException {
int[] answer = {};
ArrayList<Integer> arrlist = new ArrayList<Integer>();
int backup = -1;
for(int i = 0 ; i < arr.length; i++){
if(backup != arr[i]){
arrlist.add(arr[i]);
backup = arr[i];
}
}
answer = new int[arrlist.size()];
for(int i = 0 ; i < arrlist.size(); i++){
answer[i] = arrlist.get(i);
}
return answer;
}
}
728x90
๋ฐ์ํ
LIST
'๐ฅ Algorithm || ๋ฌธ์ ํ์ด > PS' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[ํ] ๊ธฐ๋ฅ๊ฐ๋ฐ (JAVA) (0) | 2022.09.03 |
---|---|
[์คํ/ํ] ์ฌ๋ฐ๋ฅธ ๊ดํธ (JAVA) (0) | 2022.09.03 |
[์ ๋ ฌ] ๊ฐ์ฅ ํฐ ์ (JAVA) (0) | 2022.09.02 |
[์ ๋ ฌ] K ๋ฒ์งธ์ (JAVA) (0) | 2022.09.02 |
[ํ๋ก๊ทธ๋๋จธ์ค] ํฐ ์ ๋ง๋ค๊ธฐ (0) | 2022.07.14 |
Comments