Question: upGrad Coding Round | Calculate Triple Factor Modulo | Jan 13th | Recent Online Assessment 2026 | Triple Factorial Math Problem
0
Entering edit mode

Question: Triple Factor

Problem Statement:

Mark wants to find the triple factorial of a given number N.

A triple factorial of a number N is the product of positive numbers less than or equal to that number and congruent to N modulo 3.

It means N!!! = N * (N-3) * (N-6) *... * (x+3) * x, where x is the smallest positive number which is congruent to N modulo 3.

Print the triple factorial for a given number N.

Note:

  • The triple factorial of 0 is 1 by definition.
  • Since the answer can be quite large, print the answer modulo 10^9+7.

Function Description:

In the provided code snippet, implement the provided tripleFactorial(...) method to print the triple factorial for a given number N. You can write your code in the space below the phrase "WRITE YOUR LOGIC HERE".

There will be multiple test cases running so the Input and Output should match exactly as provided.

The base Output variable result is set to a default value of -404 which can be modified. Additionally, you can add or remove these output variables.

Input Format:

  • The first line contains an integer, N.

Sample Test Case:

Input:

10

Expected Output:

280

(Explanation for your understanding: 10*7*4*1 = 280)

ADD COMMENTlink 20 hours ago admin 1.8k

Login before adding your answer.

Similar Posts
Loading Similar Posts