|Already a master of the classical Snake games, you are looking for a new challenge. This time, you are controlling a snake that can move left or right, on a single axis. Your goal is to move it from startLocation to endLocation in a minimum amount of time. When you start the game, the snake has a speed of one unit of space per one unit of time. But whenever it encounters a magic orb, its speed doubles.
You are given a int orbs, where each element denotes the location of an orb. The orbs are always placed at integer coordinates, and can be treated as points. An orb can only be used once; it loses its magical powers after being used. You can assume the snake movement is continuous, which means that it cannot skip any intermediate points on the axis. Determine the minimum time needed to reach endLocation.
|-||Your return value must have an absolute or relative error less than 1e-9.|
|-||orbs will contain between 0 and 50 elements, inclusive.|
|-||startLocation and endLocation will each be between 0 and 1000000000, inclusive.|
|-||Each element in orbs will be between 0 and 1000000000, inclusive.|
|-||All elements in orbs will be distinct, and also different from startLocation and endLocation .|