首页 > 其他 > 详细

力扣1860

时间:2021-05-17 15:44:32      阅读:14      评论:0      收藏:0      [点我收藏+]
class Solution {
    public int[] memLeak(int memory1, int memory2) {
        int time=1;
        int memory=1;
        int[] a;
        while(memory<=memory1||memory<=memory2){
            if(memory1==memory2){
                memory1-=memory;
                time++;
                memory++;
                continue;
            }
            if(memory<=memory1&&memory1>memory2){
                memory1-=memory;
                time++;
                memory++;
                continue;
            }
            if(memory<=memory2&&memory2>memory1){
                memory2-=memory;
                time++;
                memory++;
                continue;
            }
        }
        a= new int[]{time,memory1,memory2};
        return a;
    }
}

 

力扣1860

原文:https://www.cnblogs.com/kkwt/p/14776858.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!