Here two programs for spark developers :

**Question 1:**

Mr. Bolt is in his 60’s and loves traveling. He recently visited a country famous for its pens. He has ‘A’ grandchildren. He went to open Pen shop to purchase pens for them. The shop keeper showed him ‘a’ varieties of pens each variety containing ‘b[i ]’ pens.

He has to select city ‘c’ varieties of pens in a set in such a way that all the ‘A’ grandchildren get the same number of pens. If there are more than one such sets, the one with the minimum number of pens per child should be returned.

**Inputs:**

input 1: Value of ‘X’

input 2: Value of ‘c’

input 3: Value of ‘a’

input 4: Values in the array ‘b’

**Output:**

Return the minimum number of pens each grandchild should get. Return -1 if no solution possible

**Example:**

**Inputs:**

input 1 : 5

input 2 : 3

input 3: 5

input 4 : {1,2,3,4,5}

**Output**: 2

Explanation : He can purchase pens in two sets {2,3,45} and {1,4,5}. The sum of each set is 10. Therefore, he will be able to give 2 pens to each of his grandchildren.

**Question 2:**

You just got a new job but your new office has a different rule. They allow taking interval breaks in between tasks if there is no task available but the problem is that the tasks com randomly and sometimes it may be required to do them simultaneously.

On your first day, you are given a list of tasks with their starting and ending time. Find out the total time you will get the breaks. Assurance ending time to be greater than starting time.

**Input:**

Input 1: No.of tasks

Input 2: 2-d array in for [10,11] representing starting and ending time period of the task

**Output:**

Your function must return an integer representing the total break time

**Example:**

input 1: 4

input 2: { (6,8)(1,9)(2,4)(4,7)}

**Output:** 0

Above Programs are related to Spark using SCALA, Java, Python and R languages for Spark developers.