滴滴笔试
4.10-滴滴笔试情况
第一题:ac,贪心算法,根据
第二题:36%,不会写
int[][] arr = new int[n][2];
Arrays.sort(arr, Comparator.comparingInt(o->o[0]));
int time = 0;
time += arr[0][0];
time += arr[0][1];
for (int i = 1; i < n; i++) {
if (arr[i][0] <= time) {
time += arr[i][1];
} else {
time = arr[i][0];
time += arr[i][1];
}
}
System.out.println(time);