11. Lucky Numbers
My Approach
Time and Auxiliary Space Complexity
Code (C++)
class Solution {
public:
bool isLucky(int n) {
int cnt = 2;
while(cnt <= n){
if(n % cnt == 0)
return false;
n -= n/cnt;
++cnt;
}
return true;
}
};Contribution and Support
Last updated