diff options
| -rw-r--r-- | the-grandest-staircase-of-them-all/Solution.java | 5 | ||||
| -rw-r--r-- | the-grandest-staircase-of-them-all/constraints.txt | 21 | ||||
| -rw-r--r-- | the-grandest-staircase-of-them-all/readme.txt | 70 | ||||
| -rw-r--r-- | the-grandest-staircase-of-them-all/solution.py | 2 |
4 files changed, 98 insertions, 0 deletions
diff --git a/the-grandest-staircase-of-them-all/Solution.java b/the-grandest-staircase-of-them-all/Solution.java new file mode 100644 index 0000000..1556936 --- /dev/null +++ b/the-grandest-staircase-of-them-all/Solution.java @@ -0,0 +1,5 @@ +public class Solution { + public static int solution(int n) { + // Your code here + } +} diff --git a/the-grandest-staircase-of-them-all/constraints.txt b/the-grandest-staircase-of-them-all/constraints.txt new file mode 100644 index 0000000..f201987 --- /dev/null +++ b/the-grandest-staircase-of-them-all/constraints.txt @@ -0,0 +1,21 @@ +Java +==== +Your code will be compiled using standard Java 8. All tests will be run by calling the solution() method inside the Solution class + +Execution time is limited. + +Wildcard imports and some specific classes are restricted (e.g. java.lang.ClassLoader). You will receive an error when you verify your solution if you have used a blacklisted class. + +Third-party libraries, input/output operations, spawning threads or processes and changes to the execution environment are not allowed. + +Your solution must be under 32000 characters in length including new lines and and other non-printing characters. + +Python +====== +Your code will run inside a Python 2.7.13 sandbox. All tests will be run by calling the solution() function. + +Standard libraries are supported except for bz2, crypt, fcntl, mmap, pwd, pyexpat, select, signal, termios, thread, time, unicodedata, zipimport, zlib. + +Input/output operations are not allowed. + +Your solution must be under 32000 characters in length including new lines and and other non-printing characters. diff --git a/the-grandest-staircase-of-them-all/readme.txt b/the-grandest-staircase-of-them-all/readme.txt new file mode 100644 index 0000000..e13478c --- /dev/null +++ b/the-grandest-staircase-of-them-all/readme.txt @@ -0,0 +1,70 @@ +The Grandest Staircase Of Them All +================================== + +With the LAMBCHOP doomsday device finished, Commander Lambda is preparing to debut on the galactic stage -- but in order to make a grand entrance, Lambda needs a grand staircase! As the Commander's personal assistant, you've been tasked with figuring out how to build the best staircase EVER. + +Lambda has given you an overview of the types of bricks available, plus a budget. You can buy different amounts of the different types of bricks (for example, 3 little pink bricks, or 5 blue lace bricks). Commander Lambda wants to know how many different types of staircases can be built with each amount of bricks, so they can pick the one with the most options. + +Each type of staircase should consist of 2 or more steps. No two steps are allowed to be at the same height - each step must be lower than the previous one. All steps must contain at least one brick. A step's height is classified as the total amount of bricks that make up that step. +For example, when N = 3, you have only 1 choice of how to build the staircase, with the first step having a height of 2 and the second step having a height of 1: (# indicates a brick) + +# +## +21 + +When N = 4, you still only have 1 staircase choice: + +# +# +## +31 + +But when N = 5, there are two ways you can build a staircase from the given bricks. The two staircases can have heights (4, 1) or (3, 2), as shown below: + +# +# +# +## +41 + +# +## +## +32 + +Write a function called solution(n) that takes a positive integer n and returns the number of different staircases that can be built from exactly n bricks. n will always be at least 3 (so you can have a staircase at all), but no more than 200, because Commander Lambda's not made of money! + +Languages +========= + +To provide a Java solution, edit Solution.java +To provide a Python solution, edit solution.py + +Test cases +========== +Your code should pass the following test cases. +Note that it may also be run against hidden test cases not shown here. + +-- Java cases -- +Input: +Solution.solution(3) +Output: + 1 + +Input: +Solution.solution(200) +Output: + 487067745 + +-- Python cases -- +Input: +solution.solution(200) +Output: + 487067745 + +Input: +solution.solution(3) +Output: + 1 + +Use verify [file] to test your solution and see how it does. When you are finished editing your code, use submit [file] to submit your answer. If your solution passes the test cases, it will be removed from your home folder. diff --git a/the-grandest-staircase-of-them-all/solution.py b/the-grandest-staircase-of-them-all/solution.py new file mode 100644 index 0000000..744b41d --- /dev/null +++ b/the-grandest-staircase-of-them-all/solution.py @@ -0,0 +1,2 @@ +def solution(n): + # Your code here |
