• + 3 comments
    def chocolateFeast(n, c, m):
     ch=n//c
     wr=ch
     while(wr>=m):
        ch+=wr//m
        wr=wr//m+wr%m
     return ch
    

    try this out with time comlexity less than O(n) :)