diff options
| author | n1c00o <git.n1c00o@gmail.com> | 2021-10-08 20:39:25 +0200 |
|---|---|---|
| committer | n1c00o <git.n1c00o@gmail.com> | 2021-10-08 20:39:25 +0200 |
| commit | ab001463885936b63c18094de7d203bb6efc1cfc (patch) | |
| tree | 40652d1c32cb1a7d47190ded752f9d9ba8be67a0 | |
| parent | e712e3990f77d7d1eb0e6bf98b7670aa992a2630 (diff) | |
Add solution for the-grandest-staircase-of-them-all
| -rw-r--r-- | the-grandest-staircase-of-them-all/Solution.java | 8 | ||||
| -rw-r--r-- | the-grandest-staircase-of-them-all/solution.py | 7 |
2 files changed, 10 insertions, 5 deletions
diff --git a/the-grandest-staircase-of-them-all/Solution.java b/the-grandest-staircase-of-them-all/Solution.java index 1556936..9bcc338 100644 --- a/the-grandest-staircase-of-them-all/Solution.java +++ b/the-grandest-staircase-of-them-all/Solution.java @@ -1,5 +1,5 @@ -public class Solution { - public static int solution(int n) { - // Your code here - } +public class Solution { + public static int solution(int n) { + // Your code here + } } diff --git a/the-grandest-staircase-of-them-all/solution.py b/the-grandest-staircase-of-them-all/solution.py index 744b41d..d4e5499 100644 --- a/the-grandest-staircase-of-them-all/solution.py +++ b/the-grandest-staircase-of-them-all/solution.py @@ -1,2 +1,7 @@ def solution(n): - # Your code here + t = [1] + [0]*n + for s in range(1, n + 1): + for h in range(n, s - 1, -1): + t[h] += t[h - s] + + return t[-1] - 1 |
