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.
Good thimking...but loop will be upto (n-1),,and in the IF statement logic should be changed because if B[i]=1 then condition will not be satisfied but 1 is odd.....
Don't need to sum the array,after distribution if (n-1)th value is odd then print NO.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Fair Rations
You are viewing a single comment's thread. Return to all comments →
Good thimking...but loop will be upto (n-1),,and in the IF statement logic should be changed because if B[i]=1 then condition will not be satisfied but 1 is odd..... Don't need to sum the array,after distribution if (n-1)th value is odd then print NO.