900. Automorphic Number

Given a positive integer N, determine whether it is an Automorphic Number.

A number is called an Automorphic Number if the square of the number ends with the number itself.

Example 1:

Input: N = 76

Output: true

Explanation: 76 * 76 = 5776 → ends in 76

Example 2:

Input: N = 25

Output: true

Explanation: 25 * 25 = 625 → ends in 25

Now Your Turn!

Pick the correct output for the given input

Input: N = 7

Still unsure what the problem is asking ?

Let’s go through a few more examples, step by step, to make it clearer.

Constraints:

  • 1 ≤ N ≤ 10⁶
0
class Solution {
public:
bool isAutomorphic(int n) {
// Your code goes here
}
};
Test Case

Input:

N