Solution
The numbers are 2 and 2. Let's understand how:
Sarika might have got 4, which means the numbers can be either 1 + 3 or 2 + 2. So, as there were two possibilities she was not sure of the numbers.
Priya might have also got 4, so again there are two possibilities: 1*4 and 2*2.
Now, if the numbers were 1 and 3, Priya would have got 3 and she would have been sure of the numbers, but since that was not the case, Sarika was sure that the numbers are 2 and 2.
Now, Priya knows that numbers cannot be 1 and 4, because then there are only two possibilities of getting the sum as 5 which is 1+4, 2+3.
In both these cases, Sarika cannot guess the number depending on Priya’s earlier answer, as their product will be 4 and 6. Hence, more than one possibility is occurring.
Thus, in the end, Priya also got to know that the numbers are 2 and 2.
Also read palindrome number in python.
Frequently Asked Questions
How do you prepare a puzzle?
→ Start with thinking about the puzzle you are being asked.
→ Ask for more clarification.
→ Understand and explain your reasoning.
→ Take more test cases and check your logic.
→ Then finally, give your solution.
What are Guesstimate Interview Questions?
Guesstimate questions include asking candidates to guess or estimate a number based on limited information. Successfully solving guesstimate interview questions requires general knowledge, logical thinking, mental maths, and problem-solving skills.
What does wild guess mean?
Wild guess is based on taking a guess without any knowledge or information regarding the thing.
Conclusion
This article discussed an interview puzzle popularly known as Two Numbers which can be asked of you in your job interviews.
For more such interview puzzles, refer to the Interview Puzzles available and take a look at Test Series and Topic-Wise Problems for placement preparation.
Recommended Readings:
Do check out The Interview guide for Product Based Companies as well as some of the Popular Interview Problems from Top companies like Amazon, Adobe, Google, etc. on Coding Ninjas Studio.
Also check out some of the Guided Paths on topics such as Data Structure and Algorithms, Competitive Programming, Operating Systems, Computer Networks, DBMS, System Design, etc. as well as some Contests, Test Series, Interview Bundles, and some Interview Experiences curated by top Industry Experts only on Coding Ninjas Studio.
Happy Coding!