# 카카오 경력
###### tags: `Tag(코테)`
## 1
### Q



### A
```
class Result {
/*
* Complete the 'solution' function below.
*
* The function is expected to return an INTEGER.
* The function accepts following parameters:
* 1. INTEGER x
* 2. INTEGER y
* 3. INTEGER z
*/
public static int solution(int x, int y, int z) {
int bigger = Math.max(x, y);
int distance = Math.abs(x-y);
if(distance>z) return -1;
return ( bigger + (Math.abs(distance-z)/2) );
}
}
```
### result


## 2
### Q


### A
```
public static int solution(List<Integer> cost, int x) {
long cnt = 0;
long power[] = new long[cost.size()];
power[0] = 1;
for(int k=1; k<cost.size(); k++){
power[k] = (power[k-1]*2)%1000000007;
}
for(int i=cost.size()-1; i>=0; i--){
if(x-cost.get(i)>=0){
x -= cost.get(i);
cnt += power[i]%1000000007;
}
}
return (int)(cnt%1000000007);
}
```

## result

## 3
### Q


### A
```
class Result {
/*
* Complete the 'solution' function below.
*
* The function is expected to return an INTEGER.
* The function accepts INTEGER_ARRAY box as parameter.
*/
public static int solution(List<Integer> box) {
// Write your code here
int max = 0;
long sum = 0;
for(int i=0; i<box.size(); i++){
sum += box.get(i);
int now = (int)(sum/(i+1));
int div = (int)(sum%(i+1));
if(div>0){
now++;
}
max = Math.max(max, now);
}
return max;
}
}
```

### result
