출처 : https://leetcode.com/problems/maximum-number-of-coins-you-can-get/
There are 3n piles of coins of varying size, you and your friends will take piles of coins as follows:
3 piles of coins (not necessarily consecutive).Given an array of integers piles where piles[i] is the number of coins in the ith pile.
Return the maximum number of coins that you can have.

class Solution {
public int maxCoins(int[] piles) {
ArrayList<Integer> arrayList = new ArrayList<>();
for (int p : piles) arrayList.add(p);
int answer = 0;
Collections.sort(arrayList);
while (arrayList.size() > 0) {
int alice = arrayList.size() - 1;
arrayList.remove(alice);
int me = arrayList.size() - 1;
answer += arrayList.get(me);
arrayList.remove(me);
arrayList.remove(0);
}
return answer;
}
}