DEV Community

Cover image for 5 new challenges
Ilya Nevolin
Ilya Nevolin

Posted on

5 new challenges

I've added 5 new challenges to our ranked mode: 4 hard and one medium.
These challenges are related to combinatorics and matrix operations. Can you solve them? Give it your best shot @ https://nevolin.be/codr/

Preview:

function backtrack(list, tempList, nums, start) {
    list.push([...tempList]);
    for(let i = start; i < nums.length; i++) {
        tempList.push(nums[i]);
        backtrack(list, tempList, nums, i + 1);
        tempList.pop();
    }
}

function subsets(nums) {
    const list = [];
    backtrack(list, [], nums, 0);
    return list;
}

let out = subsets([2, 3, 1]);
// out.length == ?
Enter fullscreen mode Exit fullscreen mode

Top comments (0)