In this java tutorial, we will learn to choose the minimum step size to travel over the positive integer number line such that we don't encounter a single obstacle

**Introduction:**

An array of positive integers, which indicates obstacles over the number line.

Let an array be a[] such that 0<a[i]<Z+ , where Z+ is any positive integer

**Example:**

Let a[]={2,3,5,7,11,12,13}

**[email protected]@[email protected]@[email protected]@[email protected]**

** **In the above representation the symbol '@' indicates the presence of an obstacle.

That number is chosen as a step for which the modulo with every single element of the array is not equal to zero.

For the above example, the minimum step size to avoid all the obstacles is 8.

(by means of jumping over the number line starting from 0 with that step size)

**Input/Output Constraints:**

** **Input

2<= input array.length <=1000

1<= input array[i]<=1000

Output

return the integer with a minimum step size

**Output:**

enter the no of obstacles in an array 7

enter the value of nodes which are assumed as an obstacle on the number line 2 3 5 7 11 12 13

The minimum step size that avoids all the obstacles is 8

Submitted by Matam Deekshith (deekshithmatam)

- College Enquiry System using Flask in Python
- ATM Project using Java-Beginner level
- Bank Application in Java
- Age Calculator using Java
- BitMasking basic operations in Java
- Authentication with Firebase in Android Studio using a Phone Number in Java
- Card Number Detailer using C++
- Basic calculator using C++

Download packets of source code on Coders Packet