text: Minimize total time taken by two persons to visit N cities such that none of them meet | Function to find the minimum time to visit all the cities such that both the person never meets ; Initialize sum as 0 ; Find the maximum element ; Traverse the array ; Increment sum by arr [ i ] ; Prvar maximum of 2 * T and sum ; Driver code ; Function Call
code: function minimumTime ( arr , n ) { var sum = 0 ; var T = Math . max ( ... arr ) ; for ( i = 0 ; i < n ; i ++ ) { sum += arr [ i ] ; } document . write ( Math . max ( 2 * T , sum ) ) ; } var arr = [ 2 , 8 , 3 ] ; var N = arr . length ; minimumTime ( arr , N ) ;