Please solve the programming task below using a self-contained code snippet in a markdown code block.

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.
 
Please complete the following python code precisely:
```python
class Solution:
    def numTrees(self, n: int) -> int:
```