you water dispenser dispense cold warm hot water every second fill 2 cup different type water 1 cup type waterYou give 0indexed integer array length 3 amount0 amount1 amount2 denote number cold warm hot water cup need fill respectively return minimum number second need fill cup Example 1Input 142output 4explanation one way fill cup isSecond 1 Fill cold cup warm cupsecond 2 Fill warm cup hot cupSecond 3 Fill warm cup hot cupSecond 4 Fill warm cupit prove 4 minimum number second neededExample 2input 544output 7explanation one way fill cup isSecond 1 Fill cold cup hot cupSecond 2 Fill cold cup warm cupsecond 3 Fill cold cup warm cupsecond 4 Fill warm cup hot cupSecond 5 Fill cold cup hot cupSecond 6 Fill cold cup warm cupsecond 7 Fill hot cupexample 3input 500output 5explanation every second fill cold cup constraintsamountlength 30 amounti 100