You are viewing a single comment's thread. Return to all comments →
// Write your code here int arr[]=new int[k]; for(int i=0;i
int max=Math.min(arr[0],1);
for(int i=1;i<=k/2;i++) { if(i!=k-i) { max+=Math.max(arr[i],arr[k-i]); } else { max++; } } return max;
Seems like cookies are disabled on this browser, please enable them to open this website
Non-Divisible Subset
You are viewing a single comment's thread. Return to all comments →
// Write your code here int arr[]=new int[k]; for(int i=0;i
int max=Math.min(arr[0],1);
for(int i=1;i<=k/2;i++) { if(i!=k-i) { max+=Math.max(arr[i],arr[k-i]); } else { max++; } } return max;