• + 3 comments

    any comments on to improve this pthon code to use greedy algorithm I time out for the later cases. Thanks

    N, M = map(int,raw_input().split()) lst = [0]*N

    for _ in range(M): a, b, k = [int(n) for n in raw_input().split(" ")]

    for i in range(a-1,b): 
        lst[i] += k
    

    print max(lst)