Pre initializing for dp [ 0 ] & dp [ 1 ]
dp [ 0 ] = max ( arr1 [ 0 ] , arr2 [ 0 ] ) NEW_LINE dp [ 1 ] = max ( max ( arr1 [ 1 ] , arr2 [ 1 ] ) , max ( arr1 [ 0 ] , arr2 [ 0 ] ) ) NEW_LINE index = 2 NEW_LINE while ( index < length ) : NEW_LINE