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 |
Tags
- ๋ผํ๋ผ์ค์๋ง๋
- html
- ๋ฐ์ํ
- K๋ฐฐํฐ๋ฆฌ
- ๊น๋ฏธ๊ฒฝ์๋งํ์์
- ๋ ์
- Java
- ์นํผ๋ธ๋ฆฌ์ฑ
- ComputerScience
- database
- ํ๋ก๊ทธ๋๋ฐ
- ์ค๋ธ์
- ์๋ฐ
- ๋ฐ์ดํฐ๋ฒ ์ด์ค
- ์ปดํจํฐ๊ณผํ
- ํ์ด์ฌ
- ๋ง์ผ๋ด๊ฐ์ธ์์๋ค์์ฐ๋ค๋ฉด
- JavaScript
- ์ค๋ผํด
- css
- ๋ฆฌ์กํธ
- ์นํ์ด์ง๋ง๋ค๊ธฐ
- ํฐ์คํ ๋ฆฌ์ฑ๋ฆฐ์ง
- ์ฝ๋ฉ
- K๋ฐฐํฐ๋ฆฌ๋ ๋ณผ๋ฃจ์
- ๊ฐ๋ฐ
- ์ํ
- ์๋ฐ์คํฌ๋ฆฝํธ
- ์ฑ
- Python
Archives
- Today
- Total
JiYoung Dev ๐ฅ
[JAVA] List์์ ๋ฐฐ์ด(Array)๋ก ๋ณํํ๊ธฐ ๋ณธ๋ฌธ
List.toArray()
- ๊ธฐ๋ณธ ํ์ ์ ์๋ฃํ (ex. int[])๋ก๋ ๋ณํ ๋ถ๊ฐ๋ฅ
Integer[] answer = arr.toArray(new Integer[arr.size()]);
public Integer[] solution(int[] numbers) {
ArrayList<Integer> arr = new ArrayList<Integer>();
int idx = 0;
for(int i = 0 ; i < numbers.length ; i++){
for(int j = i + 1 ; j < numbers.length ; j++){
int sum = numbers[i] + numbers[j];
if(!arr.contains(sum)) {
arr.add(sum);
};
}
}
arr.sort(Comparator.naturalOrder());
Integer[] answer = arr.toArray(new Integer[arr.size()]);
return answer;
}
'Question' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
REST API ๊ท์น (0) | 2023.09.04 |
---|---|
[Spring Boot ์น์์ผ] @ServerEndPoint๊ฐ ์๋ ์ปจํธ๋กค๋ฌ์์ ์์กด์ฑ ์ฃผ์ ์๋ฌ (0) | 2023.09.02 |
[JAVA] List ์ ๋ ฌ - sort() (0) | 2023.08.24 |
[Spring boot] ์ฒจ๋ถํ์ผ ๊ธฐ๋ฅ ์ถ๊ฐ (0) | 2023.08.22 |
[python] ์์์ ์๋ฆฟ์ ์ง์ (round) (0) | 2023.08.22 |