Find the minimum possible health of the winning player | Python3 implementation of the approach ; Function to return the minimum possible health of the last player ; Find the GCD of the array elements ; Driver code
from math import gcd NEW_LINE def minHealth ( health , n ) : NEW_LINE INDENT __gcd = 0 ; NEW_LINE for i in range ( n ) : NEW_LINE INDENT __gcd = gcd ( __gcd , health [ i ] ) ; NEW_LINE DEDENT return __gcd ; NEW_LINE DEDENT if __name__ == " _ _ main _ _ " : NEW_LINE INDENT health = [ 5 , 6 , 1 , 2 , 3 , 4 ] ; NEW_LINE n = len ( health ) ; NEW_LINE print ( minHealth ( health , n ) ) ; NEW_LINE DEDENT