# Puzzle 8) Birds and Branches

Submitted by Amit Shukla, on August 09, 2017

**Puzzle**

Some birds settle on the branch of tree. First, they sat in a manner that each bird sit on one branch. That means each branch contain a single bird. In this case a single bird left to sit or a single bird don’t get space to sit. Next day birds are sitting in a manner that two birds were sitting in a single branch. In this day a branch remains empty. Now you have to find out the minimum number of birds and branches.

**Important points of puzzle:**

- Some birds settle on the branch of tree.
- First, they sat in a manner that each bird sits in a single branch.
- In this manner one single bird left to sit.
- On next day they sit in a manner that on each branch two bird sits.
- In this manner one branch remains empty.
- Now you have to find the minimum number if birds and minimum number of branch.

**Answer**

4 Birds and 3 Branches.

**Reason**

The reason behind this is that when each bird sit on a single branch then one extra bird left. When they sat two to a branch then one extra branch left. If there were 3 branches and 4 birds, then if each bird sit in single branch then one bird left and if two birds were sit on a single branch then one branch left. Hence the correct answer of this problem is 4 Birds and 3 Branches.

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.