其他分享
首页 > 其他分享> > leetcode#887. 鸡蛋掉落(感觉是最简单的解法)

leetcode#887. 鸡蛋掉落(感觉是最简单的解法)

作者:互联网

这道有点难度,看了这位大大的题解才会做:https://leetcode-cn.com/problems/super-egg-drop/solution/887-by-ikaruga/
真的很精彩,学习了

class Solution {
public:
    int calF(int k,int T){
        if(k==1||T==1){
            return T+1;
        }
        return calF(k-1,T-1)+calF(k,T-1);
    }

    int superEggDrop(int k, int n) {
        int T=1;
        while(calF(k,T)<n+1){
            T++;
        }
        return T;
    }
};

标签:return,int,题解,解法,887,leetcode,calF
来源: https://blog.csdn.net/weixin_37551036/article/details/115253930