human
Minimum minutes needed to make the time palindromic | Function to get the required minutes.
Storing hour and minute value in integral form.
Keep iterating till first digit hour becomes equal to second digit of minute and second digit of hour becomes equal to first digit of minute.
If mins is 60 , increase hour , and reinitilialized to 0.
If hours is 60 , reinitialized to 0.
Return the required time.
Given Time as a string.
Function call"
Solution in Python:
 ... Write me a code to minimum minutes needed to make the time palindromic and the other steps required?
assistant
#Here is code to minimum minutes needed to make the time palindromic and the other steps required.
 def get_palindrome_time ( str ) :
	hh = ( ( ord ( str [ 0 ] ) - 48 ) * 10 + ( ord ( str [ 1 ] ) - 48 ) )
	mm = ( ( ord ( str [ 3 ] ) - 48 ) * 10 + ( ord ( str [ 4 ] ) - 48 ) )
	requiredTime = 0
	while ( hh % 10 != mm // 10 or hh // 10 != mm % 10 ) :
		mm += 1
		if ( mm == 60 ) :
			mm = 0
			hh += 1
		if ( hh == 24 ) :
			hh = 0
		requiredTime += 1 ;
	return requiredTime
if __name__ == " _ _ main _ _ " :
	str = "05:39" ;
	print ( get_palindrome_time ( str ) ) ;