nikunjsoni

96

May 8th, 2021
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.18 KB | None | 0 0
  1. class Solution {
  2. public:
  3.     int numTrees(int n) {
  4.         long long ans = 1;
  5.         for(int i=0; i<n; i++)
  6.             ans = (ans*2*(2*i+1))/(i+2);
  7.         return ans;
  8.     }
  9. };
Advertisement
Add Comment
Please, Sign In to add comment