亲!马上注册或者登录会查看更多内容!
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
// This is the text editor interface. // Anything you type or change here will be seen by the other person in real time. 8 c& x5 ^ P2 q L1 `
/* Imagine you have some load balancer logs. Each log record is a tuple in the format {start, end, value}. Value - is a number of active connections for the period [start, end].
: E4 c6 f' Y5 c6 V# p" MGiven a set of such tuples find a time (any single point) in the day when total load (sum of # active connections) of the system was maximum. * P8 o. q! C+ N( M
0 1 2 3 4 5 6 7 8 9
5 e) J, s# l r) h[33333333333333] [----------55555--] [----1] [--1111---------] [-1111--] | [-----7777-----------] [------1111------------] | [-------------------] [----2222------------------] | [------------------------] **** 3 + 1 + 1 + 1 + 2 5 + 1 + 7
1 @8 p+ ]' p N1 day = 86400000 milliseconds 4 {' w1 g8 M: k6 `( c" ?
*/ class Tuple { public long startTime; public long endTime; public int value; } 6 x; D$ v. [. P) I' T
6 _- j* v/ U$ e9 k% A
7 b# [9 Y3 ~2 h3 x7 n
|