Topic: Data Science.
Companies who previously asked this: -
Objective: Two friends A and B meet at a party on a new year day. As they met after a long time, B wanted A to guess his birthday, but A was unable to guess B’s birthday. B decided to give some hints as below:
The day before yesterday I was 25, and next year I will be 28.
The above condition can be true for only one day in the year.
Short Answer: December 31.
Let's lay out the data we have so far:
Friend A and Friend B met on new year day, let’s assume the date is January 1, 2020.
If yesterday of a new year day is December 31, 2019, the day before yesterday will be December 30, 2019.
Therefore, on December 30, 2019, Friend B was 25, and on the present-day, i.e. January 1, 2020, B is already 26.
Since the condition can be true for only one day in the year.
Therefore, Friend B will be 27 on December 31, 2020. Same year!
The next year, on December 31, 2021, his age will be 28.
Therefore, Friend B's birthday is on December 31.