human
Maximum number of segments of lengths a , b and c | function to find the maximum number of segments.
stores the maximum number of segments each index can have.
.
0 th index will have 0 segments base case.
traverse for all possible segments till n.
conditions if ( i + a <= n ) : avoid buffer overflow.
if ( i + b <= n ) : avoid buffer overflow.
if ( i + c <= n ) : avoid buffer overflow.
Driver code"
How can the above be solved in Python?
 Give me a code to maximum number of segments of lengths a , b and c and the other steps required?
assistant
#Here is code to maximum number of segments of lengths a , b and c and the other steps required.
 def maximumSegments ( n , a , b , c ) :
	dp = [ - 1 ] * ( n + 10 )
/ * initialize with - 1 * /
	dp [ 0 ] = 0
	for i in range ( 0 , n ) :
		if ( dp [ i ] != - 1 ) :
			dp [ i + a ] = max ( dp [ i ] + 1 , dp [ i + a ] )
			dp [ i + b ] = max ( dp [ i ] + 1 , dp [ i + b ] )
			dp [ i + c ] = max ( dp [ i ] + 1 , dp [ i + c ] )
	return dp [ n ]
n = 7
a = 5
b = 2
c = 5
print ( maximumSegments ( n , a , b , c ) )