# Puzzle 6) Magical Scarf

Submitted by Abhishek Jain, on August 05, 2017

**Puzzle**

A magic rectangular scarf shrinks its length to ½ and width 1/3 whenever its owner makes a wish. After three such wishes, its surface was 1 cm. What was the original width, if the original length was 4 cm?

**Important points of puzzle:**

- The Magical Scarf was rectangular in shape.
- After making a wish, its length and width get shrink by ½ and 1/3 respectively.
- Owner makes three wishes.
- After three wishes, Surface of the scarf gets reduce to 1 cm.
- Original length was 4 cm.
- TASK: You have to find out the original width of the Scarf.

**Answer**

54 cm

**Reason**

Let, the width of the scarf after three wishes be x’. Now, we have original length of the scarf =4 cm.

After three wishes, length of the scarf will be = 4/2=2/2=1/2

It is given that the surface of reduced scarf is 1 cm.

Therefore, Surface=x’ * length => x’=2*1=2.

The original length of the scarf= x’*3*3*3 = 2*3*3*3 = 54 cm.

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.