Skip to content

Aptitude

Sathiyanarayanan S edited this page Jul 20, 2020 · 8 revisions

Find the minimum number of coins required for a given amount with a given set of coins?

This can be solved using Linear Programming.

Let

d1, d2, . . . dn is the denomination of coins.

c1, c2, . . . cn is the final count of coins

LP Equation


Parking Lot problem.

Mary and Tom park their car in an empty parking lot with n >= 2 consecutive parking spaces (i.e. n spaces in a row, where only one car fits in each space). Mary and Tom pick parking spaces at random; of course, they must each choose a different space. (All pairs of distinct parking spaces are equally likely.) What is the probability that there is at most one empty space between them?

Solution

1st car can be placed in n ways

2nd car can be placed in (n-1) ways

Therefore total possibilities are n(n-1)

For n = 3 the probability is always 1

For n = 4,

If fist car is parked in 1st or 4th slot, 2nd car can be placed in 2 ways to satisfy the condition = 1 (2) + 1 (2)

If fist car is parked in 2nd or 3rd slot (last but one), 2nd car can be placed in 3 ways to satisfy the condition = 1 (3) + 1 (3)

P = (4 + 6) / (4 * 3) = 10/12

Generalizing n >= 4 First and Last slot = 2 ways Last but one = 3 ways For every other slot (n - 4) * 4

P = (2 + 2 + 3 + 3 + (n-4)4) / (n(n-1)) = (4n - 6) / (n(n-1))


Four ants are in the corners of a square, one in each corner. Each have two possible direction in which they can walk. What is the probability that ants won't collide with each other?

Each ant have two possible actions, which leads to a total of 16 (4^2) possible actions. If all ants walk in same direction, they won't collide, which can happen in two ways (cw or ccw). So probability of not colliding is 2/16


Using the following statements, answer the question

  1. It is common that most of the ML experts are PhDs
  2. In industries ML experts hold various degrees
  3. You are meeting a Scholar with PhD.

What is the probability that the Scholar is ML expert? Use variables when necessary.

P(ML) Probability of a person being ML Expert

P(PhD) Probability of a person having PhD

According to 1st statement P(PhD | ML) is close to one

Need to Compute P(ML | PhD)

Using bayes theorem P(ML | PhD) = P (PhD | ML) * P(ML) / P(PhD)

Clone this wiki locally