# Puzzle 4) Rohan and Traffic light

Submitted by Amit Shukla, on August 05, 2017

**Puzzle**

In Delhi a boy named Rohan lives. Rohan have a tea stall in Delhi which is run by his father. One day his father told Rohan to sit in the shop for a day. There are three traffic lights in front of its tea stall. The first light changes after 30 seconds, second light changes after 45 second and third light changes after 60 seconds. Rohan observes that after some time all three lights changes simultaneously. If the lights first switched on at 12: 00 PM, then you have to tell after how much time the lights changes simultaneously?

**Important points of puzzle:**

- There are three traffic light in front of Rohan’s tea stall.
- First light changes after 30 seconds, second after 45 seconds and third after 60 seconds.
- Rohan observes that after some time all the light changes simultaneously.
- If lights switched on at 12: 00 PM.
- After how much time all three lights changes simultaneously.

**Answer**

3 Minutes.

**Reason**

We can find the time interval by taking LCM of 30, 45 and 60. The LCM of 30, 45 and 60 is 180. Which means that all three lights changes simultaneously after 180 Seconds. Hence the answer is 3 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.