Sort by

recency

|

1281 Discussions

|

  • + 0 comments

    def chocolateFeast(n, c, m): count = n//c k=count while(k>=m): count += (k//m) k=((k)//m)+ (k%m) return count to hire personal care contract manufacturer

  • + 0 comments

    def chocolateFeast(n, c, m): count = n//c k=count while(k>=m): count += (k//m) k=((k)//m)+ (k%m) return count notes ai

  • + 0 comments

    Here is my easy c++ solution , you can watch the explanation here : https://youtu.be/RZti_qPbiAA

    int chocolateFeast(int n, int c, int m) {
        int result = 0, wrappers = 0;
        while( n >= c){
            result ++;
            wrappers ++;
            n -= c;
            if(wrappers == m){
                result ++;
                wrappers = 1;
            }
        }
        return result;
    }
    
  • + 0 comments

    def chocolateFeast(n, c, m): count = n//c k=count while(k>=m): count += (k//m) k=((k)//m)+ (k%m) return count

  • + 0 comments

    Java: b for bars, w for wrappers

     public static int chocolateFeast(int n, int c, int m) {
            int b = n/c;
            int w = b;
            
            while (w >= m) {
                b += w/m;
                w = w%m + w/m;
            }
            
            return b;
        }