MCPcopy Index your code
hub / github.com/careercup/CtCI-6th-Edition-JavaScript / makeTest

Function makeTest

chapter06/6.10 - Poison/poison.js:15–27  ·  view source on GitHub ↗
(array)

Source from the content-addressed store, hash-verified

13};
14
15var makeTest = function(array) {
16 var tests = {};
17 for (var i = 0; i < array.length; i++) {
18 array[i].forEach((test) => {
19 if (tests[test] === undefined) {
20 tests[test] = [i + 1];
21 } else {
22 tests[test].push(i + 1);
23 }
24 });
25 }
26 return tests;
27};
28
29console.log(makeTest(genCombinations())); // 1024 combinations

Callers 1

poison.jsFile · 0.85

Calls 1

pushMethod · 0.45

Tested by

no test coverage detected