Given a sequence of integers, there are a few sequences
which result in balanced
binary search trees i.e., AVL trees. Write a program that
takes a sequence of integers
as input and outputs the number of such sequences that
result in the balanced binary
search trees.
Input Format:
Single line contains sequence of integers terminated by -1.
Output format:
Print the number of AVL tree possible from that input sequence.
Sample Input:
1 2 3 -1
Sample Output:
2


No Answer is Posted For this Question
Be the First to Post Answer

Post New Answer

More Puzzles Interview Questions

Makayla had $1.19 in change. None of the coins was a dollar. Nicole ask her for change for a dollar, but Makayla could not make change. What coins did she have?

2 Answers  


a circle is drawn...roughly in paper...the interviewer asked me to find centre point of circle?the radius,circumference is not known?how to find it?

19 Answers   Accenture, HCL, Infosys, Manhattan,


If 5/2 artists make 5/2 paintings using 5/2 canvases in 5/2 days then how many artists r required to make 25 paintings using 25 canvases in 25 days?

7 Answers  


Yesterday in a party, I asked Mr. Shah his birthday. With a mischievous glint in his eyes he replied. "The day before yesterday I was 83 years old and next year I will be 86." Can you figure out what is the Date of Birth of Mr. Shah? Assume that the current year is 2000.

6 Answers  


if u love someone u can arrange these 10 letters in 5 words I H O M U R E Y N A

41 Answers   DQ Entertainment, Era Infra Engineering, Infosys,






You have 2 identical glass bulbs with you. Bulb manufacturer has mentioned that each bulb might withstand a drop of 200 Feet at maximum. Your task is to find the height at which the bulb breaks ofcourse with minimum number of iterations. Assume that you have 200 blocks of 1 foot each which can be stacked one by one to create a 200 Feet structure to carry out the test.

10 Answers   Wipro,


Amit, Bhavin, Himanshu and Rakesh are sitting around a table. ? The Electonics Engineer is sitting to the left of the Mechanical Engineer. ? Amit is sitting opposite to Computer Engineer. ? Himanshu likes to play Computer Games. ? Bhavin is sitting to the right of the Chemical Engineer. Can you figure out everyone's profession?

3 Answers  


Given two bucket of large capacity. There are 100 black ball and 100 white ball. Distribute the balls among two bucket such that probability of choosing a white ball is maximum.

3 Answers   Oracle,


A big cube painted with yellow colour in all sides. if you cut it into 1000 cubes with same dimension. than how many cubes were without painted anyside. explain it?

12 Answers   eBay, eClerx, Sitel, Wipro,


In the village called TALAJA, only three TV channels are available - Moon Plus, Mony and Mee TV. Out of 4000 TV viewers in the village, 1500 watch Moon TV, 2000 watch Mony and 2500 watch Mee TV. Amongst these, 500 viewers watch Moon Plus and Mony, 800 watch Moon Plus and Mee TV, and 1000 watch Mony and Mee TV. How many viewers watch all three channels?

2 Answers  


Assume for a moment that the earth is a perfectly uniform sphere of radius 6400 km. Suppose a thread equal to the length of the circumference of the earth was placed along the equator, and drawn to a tight fit. Now suppose that the length of the thread is increased by 12 cm, and that it is pulled away uniformly in all directions. By how many cm. will the thread be separated from the earth's surface?

4 Answers  


12 members were present at a board meeting. Each member shook hands with all of the other members before & after the meeting. How many hand shakes were there?

8 Answers   Arena,


Categories