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; } }
原文:https://www.cnblogs.com/kkwt/p/14776858.html