-
-
Notifications
You must be signed in to change notification settings - Fork 445
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
added Unique Binary Search Tree with dynamic programming #210
base: master
Are you sure you want to change the base?
Conversation
Can you please check this? @akashgk |
// Given an integer n, return the number of structurally unique BST's (binary search trees) | ||
// which has exactly n nodes of unique values from 1 to n. | ||
|
||
class UniqueBST { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this class is not serving any purpose. we can remove it.
// which has exactly n nodes of unique values from 1 to n. | ||
|
||
class UniqueBST { | ||
int solve(int i, List<int> dp) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you add some comments to explain the algorithm
test('Test Case 1: Input 3, Output - 5', () { | ||
expect(uniqueBST.numTrees(3), 5); | ||
}); | ||
|
||
test('Test Case 2: Input 1, Output - 1', () { | ||
expect(uniqueBST.numTrees(1), 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you please add more test cases ?
Welcome to Dart community
Describe your change:
Checklist:
Fixes: #{$ISSUE_NO}
.