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.
deffairRations(B):# automatic NO if the amount of odd-numbered values in B is also oddodd_inds=[ifori,oinenumerate(B)ifo%2==1]print(odd_inds)if(len(odd_inds)%2)==0:result=str(sum([2*(odd_inds[2*i-1]-odd_inds[2*i])foriinrange(0,len(odd_inds)//2)]))else:result='NO'returnresult
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 →
In Python 3: