Showing:
Handle Score
@Ibrahim Nash 5761
@akhayrutdinov 5111
@mb1973 4989
@Quandray 4944
@saiujwal13083 4506
@sanjay05 3762
@marius_valentin_dragoi 3516
@sushant_a 3459
@verma_ji 3341
@KshamaGupta 3318
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


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)

Constraints:
1 <= n <= 10000