Minimum number of cuts required to pay salary from N length Gold Bar | Python Implementation to find the minimum number of cuts to pay the worker . ; Function to find the minimum number of cuts to pay the worker . ; Nearest Integer to the Log value of the number N ; Driver Code ; Cuts Required in the Length of 15
import math NEW_LINE def pay ( n ) : NEW_LINE INDENT cuts = int ( math . log ( n , 2 ) ) NEW_LINE return cuts NEW_LINE DEDENT if __name__ == " _ _ main _ _ " : NEW_LINE INDENT n = 5 NEW_LINE cuts = pay ( n ) NEW_LINE print ( cuts ) NEW_LINE n = 15 NEW_LINE cuts = pay ( n ) NEW_LINE print ( cuts ) NEW_LINE DEDENT