Element in a Series
Easy Accuracy: 57.14% Submissions: 7 Points: 2

Consider a series of numbers composed of only digits 4 and 7 such as 4, 7, 44, 47, 74,...... 44744,.. etc. Given a number N, we need to find N-th number in the series.

Example 1:

Input:
N = 3

Output:
44

Explanation:
First term = 4
Second term = 7
Third term = 44

Example 2:

Input:
N = 5

Output:
74

Explanation:
First term = 4
Second term = 7
Third term = 44
Fourth term = 47
Fifth term = 74


You don't need to read input or print anything. Your task is to complete the function NthTermOfSeries() which takes an integer N as an input parameter and return Nth term of the series.

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

Constraints:
1 <= N <= 1000