Leaderboard
Showing:
Handle Score
@Ibrahim Nash 6420
@blackshadows 6380
@mb1973 5704
@Quandray 5245
@akhayrutdinov 5111
@saiujwal13083 5046
@sanjay05 3762
@kirtidee18 3673
@mantu_singh 3530
@marius_valentin_dragoi 3523
@sushant_a 3459
Complete Leaderboard
Factorial Number
Basic Accuracy: 52.51% Submissions: 181 Points: 1

For a given number N, find whether it is a factorial number or not. A Factorial number is a number which is equal to the factorial value of other numbers.
 

Example 1:

Input:
N = 6
Output:
1
Explanation:
6 is factorial of 3

Example 2:

Input:
N = 5
Output:
0
Explanation:
no number's factorial is 5.


Your Task:
You don't need to read input or print anything. Your task is to complete the function isFactorial() which takes an integer N as input parameters and returns 1 if N is a factorial number, or 0 otherwise.

 

Expected Time Complexity: O(log N)
Expected Space Complexity: O(1)

 

Constraints:
1 <= N <= 100000

to report an issue on this page.

Editorial

We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?

Yes

All Submissions

My Submissions:

Login to access your submissions.

Factorial Number

Output Window