# Puzzle 12) Ayush and Basket

Submitted by Amit Shukla, on August 10, 2017

**Puzzle**

A naughty boy Ayush watches Sachin Tendulkar’s innings and act according to number of runs scored by Sachin Tendulkar. Ayush have a basket which he used to put some fruits. As we know that Ayush acts according to number of runs scored by Sachin Tendulkar in an innings. The details of above information are given as follow:

**1 Run** – Place an orange in the basket.

**2 Runs** – Place a Mango in the basket.

**3 Runs** – Place a pear in the basket.

**4 Runs** – Remove a pear and a Mango from the basket.

One a fine at the start of match, the basket is empty. The sequence of number scored by Sachin Tendulkar is 11232411234232341121314. At the end of innings how many more number of oranges were there as compared to mangoes, inside the basket?

**Important points of puzzle:**

- Ayush watches Sachin Tendulkar’s innings.
- Ayush act according to run scored by Sachin Tendulkar.
- Ayush have a basket in which he stores fruits according to the run scored by Sachin in an innings.
- The details of action of Ayush according to Sachin’s score is given above.
- One fine day Sachin scores 11232411234232341121314.
- At starting of match the basket is empty.
- Now find how more number of oranges were there in basket at the end of innings as compared to mangoes.

**Answer**

**6.**

**Reason**

In these types of problems, you have to calculate the data manually. In this case at the end of inning 6 oranges are more than total number of mangoes. Hence the answer is 6.

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.