# Puzzle 1) The Magical Elephant

Submitted by Amit Shukla, on August 04, 2017

**Puzzle**

There is a pet shop in Delhi. There is a magical elephant in the shop. This elephant doubles in size every day. Abhigyan is interested in this elephant and he bought a baby elephant from the shop. In 10 days the size of elephant is enough to cover its room. Now you have to tell that how many days it takes to cover the room if Abhigyan brought 2 magic elephants?

**Important points of puzzle:**

**"Magical elephant"**doubles in size each day.- One elephant cover Abhigyan’s room in 10 days.
- If he buys 2 magical elephants.
- How many days it needs to cover its room.

**Answer**

**9 Days.**

**Reason**

Cover the room with 2 elephants will take only one less day than cover the room with one elephant. Because, if one elephant takes 10 days to cover the room, it means that it covers half of the room in 9 days. Hence in 9 days each of the elephant covers half of the room. So, it takes 9 days to cover a room.

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