Пожалуйста, прочтите новое правило об ограничении использования AI-инструментов. ×

Find the minimum waiting time of people

Правка en1, от preetham, 2019-07-14 10:54:21

There are $$$ n $$$ people who are living in their own houses $$$ h_1, h_2, h_3 \dots , h_n $$$ located on the X-axis. A boy who can move with a speed of $$$ 1 unit/sec $$$, needs to visit all the houses. We need to find the minimum waiting time of the people (sum of waiting time of all the people)?

The initial position of the boy is $$$ x $$$

$$$ Constraints : 1 <= n <= 1000, -10^6 <= h_i , x <= 10^6 $$$

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский preetham 2019-07-14 10:54:21 448 Initial revision (published)