# Puzzle 15) Dark Phobia

Submitted by Abhishek Jain, on August 11, 2017

**Puzzle**

Four friends Amit, Abhigyan, Abhishek and Deepak want to get through a tunnel. Abhishek can make it in 1 minute, Amit in 2 minutes, Abhigyan in 4 minutes and Deepak in 5 minutes. Unluckily through the narrow tunnel not more than two persons can go at once, moving at the speed of the slower one. Will they all be able to make it if they have a torch that lasts only 12 minutes and they have darkness phobia?

**Important points of puzzle:**

- There is a dark tunnel and four friendswants to get through it.
- To cross the tunnel Abhishek, Amit, Abhigyan and Deepak take 1, 2, 4 and 5 minutesrespectively.
- At once not more than two persons can move through the tunnel.
- The two persons will move at the speed of the slower one.
- They have a torch which lasts only up to 12 minutes.
- Task: Will they be able to cross the tunnel in 12 minutes?

**Answer**

**Yes.**

**Reason**

**They make moves as:**

First, Abhishek and Amit will take 2 minutes.

Abhishek comes back = 1 minute => 1+2=3 minutes.

Then, Both Deepak and abhigyan go to amit – 5 minutes =>5+3= 8 minutes.

Amit comes back to Abhishek – 2 minutes => 2+8= 10 minutes.

And finally they both get to their friends - 2 minutes => 2+10=12 minutes.

TOP Interview Coding Problems/Challenges

- Run-length encoding (find/print frequency of letters in a string)
- Sort an array of 0's, 1's and 2's in linear time complexity
- Checking Anagrams (check whether two string is anagrams or not)
- Relative sorting algorithm
- Finding subarray with given sum
- Find the level in a binary tree with given sum K
- Check whether a Binary Tree is BST (Binary Search Tree) or not
- 1[0]1 Pattern Count
- Capitalize first and last letter of each word in a line
- Print vertical sum of a binary tree
- Print Boundary Sum of a Binary Tree
- Reverse a single linked list
- Greedy Strategy to solve major algorithm problems
- Job sequencing problem
- Root to leaf Path Sum
- Exit Point in a Matrix
- Find length of loop in a linked list
- Toppers of Class
- Print All Nodes that don't have Sibling
- Transform to Sum Tree
- Shortest Source to Destination Path

Comments and Discussions

**Ad:**
Are you a blogger? Join our Blogging forum.