Trimorphic Number
Basic Accuracy: 18.33% Submissions: 120 Points: 1

Given a number N, the task is to check whether the number is Trimorphic number or not. A number is called Trimorphic number if and only if its cube ends in the same digits as the number itself. In other words, number appears at the end of its cube.

Example 1:

Input: N = 1
Output: 1
Explaination: 13 = 1. So the cube here is ending with
the number.

Example 2:

Input: N = 2
Output: 0
Explaination: 23 = 8. The cube is not ending with the
number at it's end.

Example 3:

Input: N = 24
Output: 1
Explaination: 243 = 13824. The cube is ending with 24.

You do not need to read input or print anything, Your task is to complete the function isTrimorphic() which takes N as input parameter and returns 1 if the number is trimorphic, otherwise, returns 0.

Expected Time Complexity: O(LogN)
Expected Auxiliary Space: O(1)

Constraints:
1 < N < 10000

We are replacing the old Disqus forum with the new Discussions section given below.