Public
Edited
Dec 28, 2021
1 fork
1 star
Insert cell
Insert cell
Insert cell
Insert cell
function choose(n, k) {
if(k > n / 2) return choose(n, n - k); //Recall that c(5,2) is the same as c(5,3)
let res = 1;
for(let i = 1; i <= k; i++) {
res *= (n + 1 - i) / i;
}
return res;
}
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more