MaxSubArry Find

Run Settings
LanguageJavaScript
Language Version
Run Command
function maxSubArry(arr,num){ let j = 1; let max = -Infinity; for(i=0;i<arr.length-num+1;i++){ var temp = 0; for(j=0;j<num;j++){ temp = temp+arr[i+j]; } if(temp>max){ max=temp; } console.log(temp,max); } return max; } console.log(maxSubArry([2,6,9,2,1,8,5,6,3],[3]));
Editor Settings
Theme
Key bindings
Full width
Lines