id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

jebbert@volusia.k12.fl.us > quiz2022_03_09_SLHL_strangeFactorial
prev  |  next  |  chance

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)

public int quiz2022_03_09_SLHL_strangeFactorial(int[] multOrder, int factNum) { }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Difficulty: 230

Copyright Nick Parlante 2017 - privacy