title: Number of Binary Search Trees of a given Height
body: <p>How can I find the number of BSTs upto a given height h and discard all the BSTs with height greater than h for a given set of unique numbers?</p>
  
  <p>I have worked out the code using a recursive approach</p>
  
  <pre><code>static int bst(int h,int n){
      if(h==0&amp;&amp;n==0)return 1;
      else if(h==0&amp;&amp;n==1)return 1;
      else if(h==0&amp;&amp;n&gt;1)return 0;
      else if(h&gt;0&amp;&amp;n==0)return 1;
      else{
          int sum=0;
          for(int i=1;i&lt;=n;i++)
              sum+=bst(h-1,i-1)*bst(h-1,n-i);
          return sum;
      }
  }
  </code></pre>