Code360 powered by Coding Ninjas X Naukri.com. Code360 powered by Coding Ninjas X Naukri.com
Table of contents
1.
Introduction
2.
Problem Statement
3.
Approach
4.
Frequently Asked Questions
4.1.
What is the definition of a puzzle?
4.2.
What are the benefits of puzzle-solving?
4.3.
Do software companies frequently ask for puzzles?
4.4.
What are some of the most common interview questions and puzzles?
4.5.
Will you be asked puzzles in interviews all of the time?
5.
Conclusion
Last Updated: Mar 27, 2024

# Daughters' Ages

Master Python: Predicting weather forecasts
Speaker
Ashwin Goyal
Product Manager @

## Introduction

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.

## Problem Statement

At Fairway on the upper west side, two MIT math grads run into each other. They hadn't seen each other in more than 20 years.

First: "How have you been?"

Second: "fantastic! I married and have three daughters."

First: "Is that true? What are their ages?"

Second: "Well, the sum of their ages equals the number on that building over there, and the product of their ages equals 72."

First: "All right, okay.. oh wait.. hmm, I still don't know"

Second: "Oh sorry, the oldest one has only recently begun to play the piano."

First: "fantastic! My eldest is of the same age!"

What are the ages of the daughters?

Respond with daughterâ€™s ages sorted in ascending order and concatenated together. No spaces.

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
Bootcamp

## Approach

Now, we will see a solution approach to the daughters' ages puzzle. The first hint he gave was the product of the ages of three girls as 72. So we will encounter all the possibilities of ages which gives 72 as their product and that are -

1 * 1 * 72 = 72

1 * 2 * 36 = 72

1 * 3 * 24 = 72

1 * 4 * 18 = 72

1 * 6 * 12 = 72

1 * 8 * 9 = 72

2 * 2 * 18 = 72

2 * 3 * 12 = 72

2 * 4 * 9 = 72

2 * 6 * 6 = 72

3 * 3 * 8 = 72

3 * 4 * 6 = 72

Now the second hint was that the sum of the ages of all three daughters is the number on a building they were referring to. So possibilities can be-

1 + 1 + 72 = 72

1 + 2 + 36 = 39

1 + 3 + 24 = 28

1 + 4 + 18 = 23

1 + 6 + 12 = 19

1 + 8 + 9 = 18

2 + 2 + 18 = 22

2 + 3 + 12 = 17

2 + 4 + 9 = 15

2 + 6 + 6 = 14

3 + 3 + 8 = 14

3 + 4 + 6 = 13

But here, if we see, all the sums are unique except 14 which confused the second man as he couldnâ€™t find out with the second hint due to two possibilities. Now, we have two patterns for the Daughters' Ages. Still, we can't clearly say the daughters' ages, but the oldest one just started to play the piano, looking at the third hint. The oldest daughter is single, not twins, as the same age means born as twins.

so our final answer will be 3 + 3 + 8 = 14

The ages of the daughters are - 3, 3, 8

So, this is the approach to solve the daughters' ages puzzle.

Check out this problem - 8 Queens Problem

## Frequently Asked Questions

### What is the definition of a puzzle?

A puzzle is a game that uses words, toys, questions, and other items to help us improve our problem-solving skills.

### What are the benefits of puzzle-solving?

People's problem-solving skills improve when they solve puzzles. It also helps a person's logic.

### Do software companies frequently ask for puzzles?

Since problem-solving is an essential part of programming, all software firm applicants are regularly put to the test using puzzle problems. As a result, it's not uncommon for software companies to ask candidates to solve riddles during their interviews.

### What are some of the most common interview questions and puzzles?

The following are some of the most common interview questions:
Bag of Coins Puzzle
Crossing the Bridge Puzzle
Heaven or Hell Puzzle
Gold Bar Cut Puzzle
Three Mislabeled Jars
Man Fell in Well Puzzle

### Will you be asked puzzles in interviews all of the time?

While most interviewers do not specifically request puzzles, they are common, and some interviews may even contain specialized puzzle-solving sections. It's always good to be prepared if anything unexpected occurs.

## Conclusion

In this article, we have extensively discussed the problem of daughters' ages with the solution.

We hope that this blog has helped you enhance your knowledge regarding encryption and if you would like to learn more, check out our articles on Camel and the Banana Puzzle and The Full Pyramid Of Odd Number Pattern

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 Interview Puzzles, 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.

Do upvote our blog to help other ninjas grow.

Happy Learning!

Live masterclass