Ratio of Boys and Girls Solution
Assume there is N number of couples, so there would be N boys. The number of girls can be calculated by the following method.
Number of girls = 0*(Probability of 0 girls) + 1*(Probability of 1 girl) + 2*(Probability of 2 girls) + …
Number of girls = 0*(N*1/2) + 1*(N*1/2*1/2) + 2*(N*1/2*1/2*1/2) + …
Number of girls = 0 + N/4 + 2*N/8 + 3*N/16 + …
Number of girls = N
Using mathematical formulas, it becomes apparent if you sum up the first 4-5 terms.
The proportion of boys to girls is 1:1.
As such, the answer would be 1.00.
Check out this problem - 8 Queens Problem
Frequently Asked Questions
What is a puzzle?
A puzzle is a game of words, toys, questions, etc. that helps in increasing our problem-solving ability.
What are the advantages of solving puzzles?
Solving puzzles enhance the problem-solving skills of a person. It also improves the logic building of a person.
Why are puzzles asked in an interview?
There are no such mandatory rules to ask puzzle or logical questions in IT interviews. But it's a regular habit of most the pro-interviewers to ask puzzles or logical questions, just to check the interviewee's presence of mind and problem-solving ability.
What are some tips for preparing for a puzzle interview?
Practice, always keep a pen and paper with you and elaborate your approach.
Name some common puzzles asked in the interview.
Crossing the bridge, Hand Shakes at the party, Bag of coins, Clock angle puzzle, Measuring time by burning ropes, and many more.
Conclusion
In this article, we discussed the interview-based puzzle. The puzzle is based on the ratio of boys and girls in a given town. We also discussed the solution to the given puzzle in the article above.
Recommended Readings:
For more information, refer to Free Interview Preparation resources.
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!