summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorn1c00o <git.n1c00o@gmail.com>2021-10-08 20:39:25 +0200
committern1c00o <git.n1c00o@gmail.com>2021-10-08 20:39:25 +0200
commitab001463885936b63c18094de7d203bb6efc1cfc (patch)
tree40652d1c32cb1a7d47190ded752f9d9ba8be67a0
parente712e3990f77d7d1eb0e6bf98b7670aa992a2630 (diff)
Add solution for the-grandest-staircase-of-them-all
-rw-r--r--the-grandest-staircase-of-them-all/Solution.java8
-rw-r--r--the-grandest-staircase-of-them-all/solution.py7
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