Code360 powered by Coding Ninjas X Naukri.com. Code360 powered by Coding Ninjas X Naukri.com
Table of contents
1.
Introduction
2.
Puzzle Description
3.
Solution 1
4.
Solution 2
5.
Frequently Asked Questions
5.1.
What is lateral thinking?
5.2.
A race track has five lanes. You are to find the 3 fastest horses out of a total of 25. How many races would have to be conducted to find the three fastest horses?
5.3.
What do you understand by analytical skills?
6.
Conclusion
Last Updated: Mar 27, 2024

Spider's web

Author Urwashi Priya
1 upvote
Master Python: Predicting weather forecasts
Speaker
Ashwin Goyal
Product Manager @

Introduction

Puzzles are a really good measure of one's analytical skills and lateral thinking. Many product-based companies ask the puzzles to help them filter candidates based on their real-world problem-solving skills to approach a problem they have not seen before.

A puzzle may have multiple solutions, where the interviewer is generally interested in the candidate's approach to not only solving the puzzle but the approach to building and thinking creatively for the solution to the puzzle.

On the same note, we are going to discuss a very interesting puzzle commonly asked in interviews.

Puzzle Description

A spider builds a web for itself. The work he does on day 1 gets doubled on day 2. The work keeps doubling every day compared to the previous day. If the spider builds the entire web in 15 days, then in how many days does it complete building 25% of the web?

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

Solution 1

In the question, it is given that if 1% of work is done on day 1, then on day 2 it would be 2% and in the following days, it will increase by 4%, 8%, 16% and so on.

Now we are already provided that the total work gets completed in 15 days. So we can easily figure out that if 100% of work is done on the 15th day, then on the 14th day only 50% of work is done. Similarly, we can arrive at our answer that on the 13th day 25% of the work is done

Solution 2

Let the work done in first day be x and second day be 2x etc.

Day - Work done on the day | Total work done
1 - x x
2 - 2x 3x
3 -  4x 7x
4 -  8x 15x
5 -  16x 31x
6 -  32x 63 x
7 -  64x 127x
8 -  128x 255x
9 -  256x 511x
10 -  512x 1023x
11 -  1024x 2047x
12 -  2048x 4095x
13 -  4096x 8191x
14 -  8192x 16383x
15 - 16384x 32767x

 

32767x amount of work is done in 15 days. 25% of the work is 32767/4 = 8191.75x. 8191.75x of the work is completed in 13 days.

Check out this problem - 8 Queens Problem

Frequently Asked Questions

What is lateral thinking?

Lateral thinking is a technique of solving problems by logical reasoning and creative ideas.

A race track has five lanes. You are to find the 3 fastest horses out of a total of 25. How many races would have to be conducted to find the three fastest horses?

First, we have to conduct 5 races taking 5 horses each, then we need to convert another 1 race for all winners. This race decides the top 3 horses.

What do you understand by analytical skills?

It refers to the ability of thinking and working with data, figuring out patterns and drawing conclusions. 

Conclusion

This article taught us how to solve the spider’s web puzzle.

We hope you could easily take away all critical and conceptual techniques by walking over the given examples. 

Refer to our Guided Path on Coding Ninjas Studio to upskill yourself in Data Structures and AlgorithmsCompetitive ProgrammingJavaScriptSystem DesignMachine learning and many more! If you want to test your competency in coding, you may check out the mock test series and participate in the contests hosted on Coding Ninjas Studio! But if you have just started your learning process and are looking for questions asked by tech giants like Amazon, Microsoft, Uber, etc; you must look at the problemsinterview experiences, and interview bundle for placement preparations.

Now, we strongly recommend you to understand the other related concepts in puzzles and enhance your learning. You can get a wide range of topics similar to this on interview puzzles

It's not the end. Learn and explore more.

Previous article
Celebrity Problem
Next article
Ratio of Boys and Girls
Live masterclass