## Epic Systems Interview Question

Software Engineer / Developers**Country:**United States

**Interview Type:**Written Test

Let the movement of person A in time t be described by A(t)

Let the movement of person B in time t be described by B(t)

Deduce A(t) and B(t) from problem statement:

A(t) = 5*t + 1

B(t) = -10*t + 106

Because at time t=0

Person A is at building 1, so A(0) = 1

Person B is at building 106, so B(0) = 106

By inspection Person A must be traversing in increasing building number, and Person B in decreasing building number, hence the sign in the equations.

When the 2 persons meet, A(t) = B(t)

Or:

5t + 1 = -10t + 106

15t = 105

t = 7

So at t=7 min they 2 people meet, and the location is given by

A(t=7) = B(t=7) = 5*7 + 1 = 36

At 36th building @ 8th minute.

```
Time A @ B @
1 1 106
2 6 96
3 11 86
4 16 76
5 21 66
6 26 56
7 31 46
8 36 36
```

The question mentioned "Person A is in building 1 and person B is in building 106" . I suppose this is the state at minute-0 and time starts from here. So, they will meet when 7 minutes would've just completely passed.

Time A @ B @

0 1 106

1 6 96

2 11 86

3 16 76

4 21 66

5 26 56

6 31 46

7 36 36

Assuming A and B are going towards each other,

at time t, A is at 1+5t, B is at 106-10t

They meet when 1+5t = 106-10t,

which is at t=7

Replace t in the equations, that's building 36.

there are 106-1 = 105 buildings distance from A to B or B to A.

when both meet, their total distance must equal 105. Hence we have this equation:

```
5P + 10P = 105
<=> P = 105/15 = 7
```

A passes 35 buildings,

B passes 70 buildings,

they met at building number 36.

At start : A-------------------------------B

when meet: ----------AB--------------------

Let buildings covered by A when they meet = x

Then buildings covered by B when they meet = 105 -x

Both of them will meet each each other exactly after travelling the same time T.

we have Speeds of A and B as,

Sa = 5 building/minute

Sb = 10 building/minute

Time = Distance x Speed, as the time taken is same we could equate Ta and Tb

Ta = Tb

x/5 = (105 - x)/10;

x = 35;

So they meet at 36th building.

Based on this statement

"The buildings of an office are numbered sequentially. Person A is in building 1 and person B is in building 106. If A crosses 5 offices in a minute and B crosses 10 offices in a minute, at which office number will they both meet?"

I don't know what number the offices are to give a proper answer, as far as what building they would meet at could be answered however but not asked for in this question.

Distance between two building is 106-1 = 105.

- Rakesh Roy April 26, 2014Relative Speed (two people moving towards each other) = 10+5 = 15.

Time taken = 105/15 = 7

At the end of seventh minute A would have travelled 7*5 = 35 building. Initially A was in building 1, so they meet at #36.