Driver code
let arr1 = [ 8 , 15 , 3 , 7 ] ; let n = arr1 . length ; document . write ( " " + optimalStrategyOfGame ( arr1 , n ) + " " ) ; let arr2 = [ 2 , 2 , 2 , 2 ] ; n = arr2 . length ; document . write ( " " + optimalStrategyOfGame ( arr2 , n ) + " " ) ; let arr3 = [ 20 , 30 , 2 , 2 , 2 , 10 ] ; n = arr3 . length ; document . write ( " " + optimalStrategyOfGame ( arr3 , n ) ) ;