about | help | code help+videos | done | prefs |
The factorial of a number n, is the product of all the integers from 1 up to n. For example, the factorial of 5 is 1*2*3*4*5 = 120. It sure would be nice if this was just a factorial question! However, this is a "strange factorial" question! So what is a "strange factorial"? To calculate a "strange factorial" you have to be given an array of integers to use in the chain of multiplication. For example, given 'multOrder' = {4,2,5,1,3,1} the "strange factorial" of 4 would be found by multiplying 4*2*5*1 to get 40. As a precondition, you may assume that 'factNum' will be at most the total number of elements in the array. quiz2022_03_09_SLHL_strangeFactorial([5, -4, 3, -2, 1, 1, 2, 3, 4, 3, 2, 1, 2, 3, 4, 5, 6, 7], 12) → 17280 quiz2022_03_09_SLHL_strangeFactorial([5, -4, 3, -2, 1, 1, 2, 3, 4, 3, 2, 1, 2, 3, 4, 5, 6, 7], 3) → -60 quiz2022_03_09_SLHL_strangeFactorial([5, -4, 3, -2, 1, 1, 2, 3, 4, 3, 2, 1, 2, 3, 4, 5, 6, 7], 6) → 120 ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 230
Copyright Nick Parlante 2017 - privacy