Whoever understand this is a god ✅ JavaScript | Combinations
FYI, I wrote this solutions and got accepted (just 4 sec before end time) in biweekly contest 86. I understand the code is very brute force. Anyway I\'m trying 
FYI, I wrote this solutions and got accepted (just 4 sec before end time) in biweekly contest 86. I understand the code is very brute force. Anyway I\'m trying to improve my skills. So, ya enjoy reading my solution and if you understand it, now only god, you and I know it :)\n```\n/**\n * @param {number[][]} mat\n * @param {number} cols\n * @return {number}\n */\nfunction getCombinations(n, k) {\n    const ans = [];\n    const arr = [];\n    \n    function dfs(i) {\n        arr.push(i);\n        \n        if (arr.length === k) {\n            ans.push(Array.from(arr));\n            arr.pop();\n            return;\n        }\n        \n        for (let j = i + 1; j < n; j++) {\n            dfs(j);\n        }\n        \n        arr.pop();\n    }\n    \n    for (let i = 0; i < n; i++) {\n        dfs(i);\n    }\n    \n    return ans;\n}\n\nvar maximumRows = function(mat, cols) {\n    const m = mat.length;\n    const n = mat[0].length;\n    \n    let min = 0; // to store no. of rows with all 0\'s\n    let ans = 0;\n    \n    const map = {}; // to store rows with column numbers having 1\'s. From ex 1 :- {1: [0, 2], 2: [1, 2]}\n    \n    for (let i = 0; i < m; i++) {\n        for (let j = 0; j < n; j++) {\n            if (mat[i][j]) {\n                if (map[i]) {\n                    map[i].push(j); // at row i, jth column is having 1\n                } else {\n                    map[i] = [j];\n                }\n            }\n        }\n        if (!map[i]) { // if all values in row i are 0\'s\n            min++;\n        }\n    }\n\t\n\t// I need more practice on bit masking so I choose backtracking way to get combinations \n    // https://leetcode.com/problems/combinations/discuss/2523710/JavaScript-or-TC-O(n!)-or-SC-O(n)\n    const combinations = getCombinations(n, cols); \n    const rows = Object.values(map);\n    \n\t// loop through each combination and see if rows having cell value 1 is chosen or not\n    for (const comb of combinations) {\n         // assigned min because min contains the count of rows with all 0\'s (which indicates covered)\n\t\tlet combAns = min;\n        for (const row of rows) {\n            // count to check if we reached end of row (all 1\'s cell of this row are in chosen column combination\n\t\t\tlet count = 0; \n            for (let i = 0; i < row.length; i++) {\n\t\t\t// row[i] holds the cell with value 1, and if that doesn\'t include in the chosen combination, we break the loop. So, this row is not covered.\n                if (!comb.includes(row[i])) { \n                    break;\n                } else {\n                    count++;\n                }\n            }\n            if (count === row.length) {\n                combAns++;\n            }\n        }\n\t\t// once we have rows count (combAns) covered by this combination (comb), we take max \n        ans = Math.max(ans, combAns);\n    }\n    \n    return ans;\n};\n```
['JavaScript']