We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Non-Divisible Subset
Non-Divisible Subset
Sort by
recency
|
815 Discussions
|
Please Login in order to post a comment
Solution in Python 3
Wordy but get the job done.
// 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;
The fact that the hardest part on this thing was remembering how mods work other than checking if smt is divisible xd