# Puzzle 19) Anuj and Train

Submitted by Amit Shukla, on August 18, 2017

**Puzzle**

Anuj lives 40 km far from his work place. He commonly uses local trains to travel between his home and his work place. One day Anuj late for his train If Anuj walks at the rate of 5 km / h, he misses the train by 6 minutes. However, if he walks at the rate of 6 km / h, he reaches the station 6 minutes before the arrival of the train. Find the distance between his house and station.

**Important points of puzzle:**

- Anuj lives 40 km far from his work place.
- He uses local train to travel between work place and home.
- One day Anuj late for his train.
- If he walks at the rate of 5 km / h, he misses train by 6 minutes.
- If he walks with 6 km / h, he reached 6 minutes before the arrival time.
- Find the distance between his home and station.

**Answer**

**6 km**

**Reason**

Let the required distance be **x km**.

Then the difference between time taken @ 5kmph & @ 6kmph is 12 minutes i.e. 1/5 hour. Therefore, X/5 – X/6 = 1/5

6x – 5x = 6

x = 6 km.

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.