FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
java-algorithm-interview/src/ch07/P10_2.java at main · onlybooks/java-algorithm-interview · GitHub
onlybooks
/
java-algorithm-interview
Public
Notifications
You must be signed in to change notification settings
Fork
27
Star
110
Code
Issues
4
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
java-algorithm-interview
/
src
/
ch07
/
P10_2.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
18 lines (15 loc) · 415 Bytes
Breadcrumbs
java-algorithm-interview
/
src
/
ch07
/
P10_2.java
Copy path
File metadata and controls
18 lines (15 loc) · 415 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
package
ch07
;
import
java
.
util
.
Arrays
;
public
class
P10_2
{
public
int
arrayPairSum
(
int
[]
nums
) {
int
sum
=
0
;
Arrays
.
sort
(
nums
);
// 앞에서부터 오름차순으로 인덱스 반복
for
(
int
i
=
0
;
i
<
nums
.
length
;
i
++) {
// 짝수 번째일때 값의 합 계산
if
(
i
%
2
==
0
)
sum
+=
nums
[
i
];
}
return
sum
;
}
}
Back
|
FazBrowse Home
|
New Git URL