Minimum days required to cure N persons | Function to find minimum count of days required to give a cure such that the high risk person and risk person does not get a dose on same day . ; Stores count of persons whose age is less than or equal to 10 and greater than or equal to 60. ; Stores the count of persons whose age is in the range [ 11 , 59 ] ; Traverse the array arr [ ] ; If age less than or equal to 10 or greater than or equal to 60 ; Update risk ; Update normal_risk ; Calculate days to cure risk and normal_risk persons ; Prthe days ; Driver Code ; Given array ; Size of the array ; Given P
def daysToCure ( arr , N , P ) : NEW_LINE INDENT risk = 0 NEW_LINE normal_risk = 0 NEW_LINE for i in range ( N ) : NEW_LINE INDENT if ( arr [ i ] >= 60 or arr [ i ] <= 10 ) : NEW_LINE INDENT risk += 1 NEW_LINE DEDENT else : NEW_LINE INDENT normal_risk += 1 NEW_LINE DEDENT DEDENT days = ( risk // P ) + ( risk % P > 0 ) + ( normal_risk // P ) + ( normal_risk % P > 0 ) NEW_LINE print ( days ) NEW_LINE DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT arr = [ 9 , 80 , 27 , 72 , 79 ] NEW_LINE N = len ( arr ) NEW_LINE P = 2 NEW_LINE daysToCure ( arr , N , P ) NEW_LINE DEDENT