### Interview Puzzles-4

Ankit and Tejas divided a bag of Apples between them.
Tejas said, "It's not fair! You have 3 times as many Apples I have." Ankit said, "OK, I will give you one Apple for each year of your age." Tejas replied, "Still not fair. Now, you have twice as many Apples as I have." "Dear, that's fair enough as I am twice older than you.", said Ankit.
Ankit went to Kitchen to drink water. While Ankit was in Kitchen, Tejas took apples from Ankit's pile equal to Ankit's age.
Who have more apples now?

At the end, Ankit and Tejas, both have the same number of apples.
Let's assume that initially Tejas got N apples and his age is T years. Hence, initially Ankit got 3N apples and his age is 2T years.
Operation Ankit's Apples Tejas's Apples
Initially 3N N
Ankit gave T apples to Tejas
(equals age of Tejas) 3N - T N + T
Tejas took 2T apples from Ankit's pile
(equals age of Ankit) 3N - 3T N + 3T
It is given that after Ankit gave T apples to Tejas, Ankit had twice as many apples as Tejas had.
3N - T = 2*(N + T)
3N - T = 2N + 2T
N = 3T
From the table, at the end Ankit have (3N - 3T) apples and Tejas have (N + 3T) apples. Substituting N = 3T, we get
Ankit's apples = 3N - 3T = 9T - 3T = 6T
Tejas's apples = N + 3T = 3T + 3T = 6T
Thus, at the end Ankit and Tejas, both have the same number of apples.