-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathacm.js
36 lines (33 loc) · 800 Bytes
/
acm.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
function acmTeam(topic) {
let arr = [];
let members = topic.length;
let combinations = 0;
arr[combinations]=[];
for(let i = 0; i < members-1; i++){
for(let j = i+1; j < members - i; j++){
for(let item in topic[j]){
if(topic[i][item]==='1' || topic[j][item]==='1'){
console.log(i,j,item*1+1,arr[combinations]);
arr[combinations].push((item*1)+1);
}
}
combinations++;
arr[combinations]=[];
}
}
let maxSize = (Math.max.apply(null, arr.flatMap(e=> e.length)));
console.log(" T=",arr.reduce(equalsMax,0));
return maxSize;
function (t,e) => {
if(e===maxSize){
return t += 1;
}
}
}
let arr = [
"10101",
"11100",
"11010",
"00101"
]
console.log(acmTeam(arr));