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
- ๊น๋ฏธ๊ฒฝ
- ํ๋ก๊ทธ๋๋ฐ
- ๋ฐ์ํ
- Java
- Python
- ๋ ์
- ComputerScience
- ๋ฐ์ดํฐ๋ฒ ์ด์ค
- css
- ์ฅํธ์์ค
- ๊ฐ๋ฐ
- JavaScript
- ์ค๋ผํด
- ์๋ฐ
- ๋ผํ๋ผ์ค์๋ง๋
- ์นํผ๋ธ๋ฆฌ์ฑ
- ์ํ
- ๊นํ๋จ
- ์ฝ๋ฉ
- ์ฑ
- database
- ์ปดํจํฐ๊ณผํ
- ์๋ฐ์คํฌ๋ฆฝํธ
- ์นํ์ด์ง๋ง๋ค๊ธฐ
- ๋ง์ผ๋ด๊ฐ์ธ์์๋ค์์ฐ๋ค๋ฉด
- ๊น๋ฏธ๊ฒฝ์๋งํ์์
- ํ์ด์ฌ
- K๋ฐฐํฐ๋ฆฌ
- html
- K๋ฐฐํฐ๋ฆฌ๋ ๋ณผ๋ฃจ์
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 |