commit 6ac531cbbe54bb63d7e644f849a200f93b792df5 parent 993559985758d2f1ef654a61a54f9a5e076e7924 Author: AndrewLockVI <andrewlaack1@gmail.com> Date: Mon, 15 May 2023 10:21:34 -0500 Completed pascals triangle using dart and recursion Diffstat:
| M | pascals-triangle/pascals-triangle.dart | | | 8 | +++++--- |
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/pascals-triangle/pascals-triangle.dart b/pascals-triangle/pascals-triangle.dart @@ -1,8 +1,10 @@ //Given a number of rows return the values contained in each -//row of pascals triangle. This solution is a brute force recursion +//row of pascals triangle. This solution is the optimal solution using recursion //solution with a time complexity of O(n^2) -//Time: 346ms Beats: 5.81% -//Memory: 141.3MB Beats: 22.9% +//There is no reason to use DP in this because there is no request to create multiple +//triangles. As such there is no recomputing. +//Time: 258ms Beats: 73.26% +//Memory: 140.2MB Beats: 88.37% class Solution { List<List<int>> generate(int numRows) { if(numRows == 1){