• + 0 comments
    fun chocolateFeast(money: Int, cost: Int, m: Int): Int {
        // Write your code here
        var total = 0
        var eaten = 0
        total = money / cost
        eaten = total
        var wrappers = total
        do{
            total+=wrappers / m
            wrappers = wrappers % m
            wrappers = wrappers + (total - eaten)
            eaten = total
        }while(wrappers >= m)
        return total
    }