A train leaves the station 1 hour before the scheduled time. The driver decreases its speed by 50 km/hr. At the next station 300 km away the train reached on time. Find the original speed of the train.

100

150

125

200

Answer: 150 km/hr

Let the normal speed of the train =x km/hr.

Then the normal time to cover 300 km =300/x.

Now it takes 1 hour more. So, the new time taken = 1+(300/x)=(x+300)/x.

∴ the new speed =300÷((x+300)/x) km/hr= 300x/(x+300) km/hr..
But the new speed is (x=50) km/hr.

⇒300x/(x+300)=x−50

⇒x2−50x−15000=0

⇒(x−150)(x+100)=0⇒x=(150,−100) km/hr.
We reject the negative value as the train always runs in the same direction.

∴x=150
So, the normal speed of the train =150 km/hr.

Coding Question

You are given an integer N. You have to count how many possible combinations of numbers from 1 to N (excluding 1 and N). which are dividing the number N and after multiplication exactly equal to the value N.

For Example: Let suppose, I have a number 12 and the number that divides 12 between 1 to 12 are 2, 3, 4, 6 we can form N by multiply 26, 34 and 223. So, there are 3 possible combinations for number 12. Note: We will not consider 1 and N we will try to find the combinations in between them.

Sample Input:

3

12

8

32

Sample Output:

3

2

6

Explanation:

For test case 1: For value 12 we have 3 combinations in total.

[ [2, 6], [2, 2, 3], [3, 4] ]

For test case 2: For value 8 we have only 2 combinations: