Driver code
int main ( ) { int arr1 [ ] = { 10 , 5 , 2 , 7 , 10 } ; int n1 = sizeof ( arr1 ) / sizeof ( arr1 [ 0 ] ) ; cout << minTime ( arr1 , n1 ) << endl ; int arr2 [ ] = { 10 , 5 , 7 , 10 } ; int n2 = sizeof ( arr2 ) / sizeof ( arr2 [ 0 ] ) ; cout << minTime ( arr2 , n2 ) << endl ; int arr3 [ ] = { 10 , 5 , 2 , 4 , 8 , 6 , 7 , 10 } ; int n3 = sizeof ( arr3 ) / sizeof ( arr3 [ 0 ] ) ; cout << minTime ( arr3 , n3 ) << endl ; return 0 ; }