Jessica's JavaScriptmas Challenge

11. Avoid Obstacles


Create an array of integers. Each number in your array represents the coordinates of an obstacle on a straight line.

Find the smallest number that can 'jump' through your array without hitting an obstacle.

Example: The result of the array [5, 3, 6, 7, 9] would be 4.

Click for further explanation of example


A jump of 1 creates the jump sequence: 1, 2, 3, 4, 5, etc., meaning it will hit all obstacles.

A jump of 2 creates the sequence: 2, 4, 6, 8, 10, etc, meaning it hits the obstacle at coordinate 6.

A jump of 3 creates the sequence: 3, 6, 9, 12, 15, etc, meaning it hits the obtacles at coordintes 3, 6, and 9.

A jump of 4 creates the sequence: 4, 8, 12, 16, 18, etc, meaning it does not hit any of the obstacles.



Array of Integers: []




*Note: Numbers with decimal places will be rounded down.




Smallest jump to avoid all obstacles: