Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions lessons/LuckyNumbers.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
class Solution
{
// Complete the function
// n: Input n
// Return True if the given number is a lucky number else return False
public static boolean isLucky(int n)
{
// Your code here
for(int i=2; i<=n; i++){
if(n%i==0) return false;
n = n - n/i;
}
return true;
}
}