Big Numbers Series
Medium Accuracy: 0.0% Submissions: 0 Points: 4

Given a series of numbers 0  1  4  18  96  600  4320 …., and series starting from zeroth term. Given n, find the nth value of the series.

Example 1:

Input: n = 4
Output: 96

Example 2:

Input: n = 2
Output: 4


Your Task:
You don't need to read or print anything, Your task is to complete the function NthTerm() which takes n as input parameter and returns the nth value of the given series modulo 109 + 7.


Expected Time Complexity: O(n)
Expected Space Complexity: O(1)

1 <= n <= 10000

to report an issue on this page.


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


All Submissions

My Submissions:

Login to access your submissions.

Big Numbers Series

Output Window