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

 

andersoniii.edwin@cusd80.com > combination
prev  |  next  |  chance

Combinations -- Remember from your algebra daze -- A Combination is an UN-ordered Combination (where you remind yourself that order DOES NOT matter.) Sometimes you will see it written 7C5 or in function notation C(7,5). If you have SEVEN (UN-distinguishable) objects and you want to order them in groups of FIVE. The "formula is 7!/(5!*(7-5)!)" ... You can write a helper method to calculate factorial - call it twice and find the quotient ... OR you can recognize 7!/(5!*2!) = (7*6*5*4*3*2*1)/(5*4*3*2*1 * 2*1) = (7*6)/2 = 21


combination(7, 5) → 21
combination(3, 2) → 3
combination(5, 1) → 5

...Save, Compile, Run (ctrl-enter)

public int combination(int num1, int num2){ }

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: 102

Copyright Nick Parlante 2017 - privacy