JavaScript Permutations n choose k | Sololearn: Learn to code for FREE!
+ 1

JavaScript Permutations n choose k

I want to implement python like permutations in JavaScript such that if I have array [1,2,3,4] and I call permutations ([1, 2, 3, 4], 2) it should return all possible permutations of 2 elements from the passed array. I have only managed to return all length array permutations.

29th Jan 2019, 7:39 AM
Dan Rhamba
Dan Rhamba - avatar
1 Answer
29th Jan 2019, 8:23 AM
Mert Yazıcı
Mert Yazıcı - avatar