class Solution { public int hardestWorker(int n, int[][] logs) { int res = logs[0][1]; int id = logs[0][0];
for (int i = 1; i < logs.length; i++) { if (res < logs[i][1] - logs[i - 1][1] || (res == logs[i][1] - logs[i - 1][1] && id > logs[i][0])) { res = logs[i][1] - logs[i - 1][1]; id = logs[i][0]; } }
return id;
} }
|