diff options
| author | n1c00o <git.n1c00o@gmail.com> | 2021-10-06 19:07:50 +0200 |
|---|---|---|
| committer | n1c00o <git.n1c00o@gmail.com> | 2021-10-06 19:07:50 +0200 |
| commit | d6af7a2c4f3342a69e1cd0507654d811dcbe11ee (patch) | |
| tree | 10347d053c4821907be4974550c495414c397cbe | |
| parent | 41349211cbd067492938eab837b6e6ce08f758ae (diff) | |
Add files of please-pass-the-coded-messages
| -rw-r--r-- | please-pass-the-coded-messages/Solution.java | 5 | ||||
| -rw-r--r-- | please-pass-the-coded-messages/constraints.txt | 21 | ||||
| -rw-r--r-- | please-pass-the-coded-messages/readme.txt | 41 | ||||
| -rw-r--r-- | please-pass-the-coded-messages/solution.py | 2 |
4 files changed, 69 insertions, 0 deletions
diff --git a/please-pass-the-coded-messages/Solution.java b/please-pass-the-coded-messages/Solution.java new file mode 100644 index 0000000..1368a85 --- /dev/null +++ b/please-pass-the-coded-messages/Solution.java @@ -0,0 +1,5 @@ +public class Solution { + public static int solution(int[] l) { + // Your code here + } +} diff --git a/please-pass-the-coded-messages/constraints.txt b/please-pass-the-coded-messages/constraints.txt new file mode 100644 index 0000000..f201987 --- /dev/null +++ b/please-pass-the-coded-messages/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/please-pass-the-coded-messages/readme.txt b/please-pass-the-coded-messages/readme.txt new file mode 100644 index 0000000..bd4d964 --- /dev/null +++ b/please-pass-the-coded-messages/readme.txt @@ -0,0 +1,41 @@ +Please Pass the Coded Messages +============================== + +You need to pass a message to the bunny workers, but to avoid detection, the code you agreed to use is... obscure, to say the least. The bunnies are given food on standard-issue plates that are stamped with the numbers 0-9 for easier sorting, and you need to combine sets of plates to create the numbers in the code. The signal that a number is part of the code is that it is divisible by 3. You can do smaller numbers like 15 and 45 easily, but bigger numbers like 144 and 414 are a little trickier. Write a program to help yourself quickly create large numbers for use in the code, given a limited number of plates to work with. + +You have L, a list containing some digits (0 to 9). Write a function solution(L) which finds the largest number that can be made from some or all of these digits and is divisible by 3. If it is not possible to make such a number, return 0 as the solution. L will contain anywhere from 1 to 9 digits. The same digit may appear multiple times in the list, but each element in the list may only be used once. + +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, 1, 4, 1}) +Output: + 4311 + +Input: +Solution.solution({3, 1, 4, 1, 5, 9}) +Output: + 94311 + +-- Python cases -- +Input: +solution.solution([3, 1, 4, 1]) +Output: + 4311 + +Input: +solution.solution([3, 1, 4, 1, 5, 9]) +Output: + 94311 + +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/please-pass-the-coded-messages/solution.py b/please-pass-the-coded-messages/solution.py new file mode 100644 index 0000000..586841e --- /dev/null +++ b/please-pass-the-coded-messages/solution.py @@ -0,0 +1,2 @@ +def solution(l): + # Your code here |
