class Solution {
    public long numberOfWeeks(int[] milestones) {
        long max = 0;
        long sum = 0;
        for (int milestone : milestones) {
            sum += milestone;
            max = Math.max(max, milestone);
        }
        return sum / max >= 2 ? sum : (sum - max) * 2 + 1;
    }
}
//runtime:3 ms
//memory:47.5 MB
