Leaderboard
Showing:
Adam Number
Basic Accuracy: 36.57% Submissions: 93 Points: 1

Given a number N, write a program to check whether given number is Adam Number or not.
Adam number is a number when reversed, the square of the number and the square of the reversed number should be numbers which are reverse of each other.

 

Example 1:

Input: 
N = 12
Output:
YES
Explanation:
122 = 144 and 212 = 441. 144 reversed 
gives 441, So, it's an Adam Number.

Example 1:

Input: 
N = 12
Output:
YES
Explanation:
142 = 196. 196 reversed gives 691,
which isn't equal to 412 So,
it's not an Adam Number.

 

Your Task:
You don't need to read input or print anything. Your task is to complete the function checkAdamOrNot() which takes an Integer N as input and returns the answer as "YES" if it is a Ada, number. Otherwise, returns "NO".

 

Expected Time Complexity: O(|N|)
Expected Auxiliary Space: O(1)

 

Constraints:
1 <= N <= 104

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.

Adam Number

Output Window