MCPcopy Create free account
hub / github.com/ROUTINE-STUDY/Algorithm / Sanghoo

Class Sanghoo

LeetCode/Greedy/561. Array Partition I/Sanghoo.java:8–22  ·  view source on GitHub ↗

https://leetcode.com/problems/array-partition-i/

Source from the content-addressed store, hash-verified

6 * https://leetcode.com/problems/array-partition-i/
7 */
8public class Sanghoo {
9
10 public int arrayPairSum(int[] nums) {
11 int maxSum = 0;
12
13 Arrays.sort(nums);
14
15 for(int i=0; i<nums.length; i+=2) {
16 maxSum += nums[i];
17 }
18
19 return maxSum;
20 }
21
22}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected