This commit is contained in:
2025-09-15 21:12:04 +08:00
commit 3f58f483ff
144 changed files with 5298 additions and 0 deletions

16
greed/lcs01.h Normal file
View File

@@ -0,0 +1,16 @@
int leastMinutes(int n){
int i = 1;
int j = 1;
while(j < n){
j <<= 1;
i++;
}
return i;
}
#include <cmath>
int leastMinutes(int n) {
if (n <= 0) return 0;
return static_cast<int>(std::ceil(std::log2(n))) + 1;
}