MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn moreOpportunities for recent engineering grads.

Apply Today**New to MATLAB?**

For inputs *n* and *k* (in that order), output the number of ways that k objects can be chosen from amongst n distinct objects. [The order of the selected objects is irrelevant.]

For example, suppose you have 4 blocks: red, green, blue, yellow. How many ways are there to select 2 of them? There are 6 ways: RG, RB, RY, GB, GY, BY. [Remember the ordering is irrelevant, so GR is equivalent to RG, and therefore does not count as a distinct choice.]

So, function(4,2) ---> 6.

236 correct solutions
191 incorrect solutions

Last solution submitted on Apr 13, 2015

1 player likes this problem

1 Comment

Franck Dernoncourt
on 30 Jan 2012

Let me import my Statistics Toolbox!
;)

2 Comments