AB
Size: a a a
AB
СМ
СМ
АК
М*
L
A
A
R
R
function getResult(heights) {
let result = 0;
if(heights[0]!=1) {
heights.unshift(1);
result--;
}
if(heights[heights.length-1]!=1) heights.push(1);
for(let i=1;ib-a).filter(a=>(a<=tgt && a!=0));
let max = Math.pow(actualFences.length, 2)-1;
for(let mask=1; mask(mask & (1 << i))).reduce((sum,a)=>sum+a) == tgt) return 1;
return 0;
}
fences = [0, 2, 4, 1, 6, 2];
A
СМ
СМ
МM