• + 0 comments

    This is pretty much the same solution I came up with:

    def fairRations(B):  
        counting = False
        count = 0
        for b in B:
            if counting:
                count += 2
            if b % 2:
                counting = not counting
        else:
            if counting:
                return "NO"
    
        return count