Code360 powered by Coding Ninjas X Code360 powered by Coding Ninjas X
Table of contents
Problem Statement
Frequently Asked Questions
How do you prepare a puzzle?
What are Guesstimate Interview Questions?
What does wild guess mean?
Last Updated: Mar 27, 2024

Two Numbers

Author Mehak Goel
0 upvote
Master Python: Predicting weather forecasts
Ashwin Goyal
Product Manager @
Interview Puzzles


Puzzles are good exercise for the brain. They help in enhancing the cognitive abilities of the brain helping with Problem Solving and related skills. There are numerous types of puzzles; each one having a logic inherent to itself which helps in cracking it. A good puzzle well is actually like a good mystery that we may have read about or watched on TV. It has the finest of hints which help in reaching its solution.

The following article discusses one such puzzle so let's get right to it.

Check out this problem - Check If A String Is Palindrome

Problem Statement

Rahul has 2 numbers. He reveals the sum of the integers to Sarika and the product of those numbers to Priya. Now there is this conversation between Sarika and Priya. 

Sarika: I'm not sure what the numbers are. 

Priya: Neither am I. 

Sarika: But now, I am sure what the numbers are.

Priya: Yeah, me too.

What are those two integers? 

  • Assume Sarika and Priya are very intelligent in mathematics.
  • Both the numbers are greater than 0. 
  • Both Sarika and Priya are very honest.

Also check out Addition of Two Numbers in Java here.

Get the tech career you deserve, faster!
Connect with our expert counsellors to understand how to hack your way to success
User rating 4.7/5
1:1 doubt support
95% placement record
Akash Pal
Senior Software Engineer
326% Hike After Job Bootcamp
Himanshu Gusain
Programmer Analyst
32 LPA After Job Bootcamp
After Job


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.


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! 

Previous article
Two Pills Each Day
Next article
Min Elevator Trips
Live masterclass