Pre initializing for dp [ 0 ] & dp [ 1 ]
dp [ 0 ] = Math . max ( arr1 [ 0 ] , arr2 [ 0 ] ) ; dp [ 1 ] = Math . max ( Math . max ( arr1 [ 1 ] , arr2 [ 1 ] ) , Math . max ( arr1 [ 0 ] , arr2 [ 0 ] ) ) ; let index = 2 ; while ( index < length ) {