summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorn1c00o <git.n1c00o@gmail.com>2021-10-06 18:16:48 +0200
committern1c00o <git.n1c00o@gmail.com>2021-10-06 18:16:48 +0200
commitaf0d281cbe4691994e2242e1ed9da881b46f7f6d (patch)
treeb7e0af0e8280c3150b00194f3dcc5a41573d6fd7
parent9251ee473fd504cac01663b2d9b38332433266d5 (diff)
Add result for skipping-work
-rw-r--r--skipping-work/Solution.java5
-rw-r--r--skipping-work/constraints.txt21
-rw-r--r--skipping-work/readme.txt45
-rw-r--r--skipping-work/solutions.py10
4 files changed, 81 insertions, 0 deletions
diff --git a/skipping-work/Solution.java b/skipping-work/Solution.java
new file mode 100644
index 0000000..6d8d38a
--- /dev/null
+++ b/skipping-work/Solution.java
@@ -0,0 +1,5 @@
+public​ ​class​ ​Solution​ ​{
+​ ​​ ​​ ​​ ​public​ ​static​ ​int​ ​solution(int[]​ ​x,​ ​int[]​ ​y)​ ​{
+​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​//​ ​Your​ ​code​ ​here
+​ ​​ ​​ ​​ ​}
+}
diff --git a/skipping-work/constraints.txt b/skipping-work/constraints.txt
new file mode 100644
index 0000000..f201987
--- /dev/null
+++ b/skipping-work/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/skipping-work/readme.txt b/skipping-work/readme.txt
new file mode 100644
index 0000000..1ec7d94
--- /dev/null
+++ b/skipping-work/readme.txt
@@ -0,0 +1,45 @@
+Skipping Work
+=============
+
+Commander Lambda is all about efficiency, including using her the bunny workers for manual labor. But no one's been properly monitoring the labor shifts for a while and they've gotten quite mixed up. You've been given the task of fixing them, but after you wrote up new shifts you realized that some bunny workers had been transferred to a different area and aren't available for their assigned shifts. Manually sorting through each shift list to compare against work area lists will take forever -- remember, Commander Lambda loves efficiency!
+
+Given two almost identical lists of worker IDs x and y where one of the lists contains an additional ID, write a function solution(x, y) that compares the lists and returns the additional ID.
+
+For example, given the lists x = [13, 5, 6, 2, 5] and y = [5, 2, 5, 13], the function solution(x, y) would return 6 because the list x contains the integer 6 and the list y doesn't. Given the lists x = [14, 27, 1, 4, 2, 50, 3, 1] and y = [2, 4, -4, 3, 1, 1, 14, 27, 50], the function solution(x, y) would return -4 because the list y contains the integer -4 and the list x doesn't.
+
+In each test case, the lists x and y will always contain n non-unique integers where n is at least 1 but never more than 99, and one of the lists will contain an additional unique integer which should be returned by the function. The same n non-unique integers will be present on both lists, but they might appear in a different order like in the examples above. Commander Lambda likes to keep the numbers short, so every worker ID will be between -1000 and 1000.
+
+Languages
+=========
+
+To provide a Python solution, edit solution.py
+To provide a Java solution, edit Solution.java
+
+Test cases
+==========
+Your code should pass the following test cases.
+Note that it may also be run against hidden test cases not shown here.
+
+-- Python cases --
+Input:
+solution.solution([13, 5, 6, 2, 5], [5, 2, 5, 13])
+Output:
+ 6
+
+Input:
+solution.solution([14, 27, 1, 4, 2, 50, 3, 1], [2, 4, -4, 3, 1, 1, 14, 27, 50])
+Output:
+ -4
+
+-- Java cases --
+Input:
+Solution.solution({13, 5, 6, 2, 5}, {5, 2, 5, 13})
+Output:
+ 6
+
+Input:
+Solution.solution({14, 27, 1, 4, 2, 50, 3, 1}, {2, 4, -4, 3, 1, 1, 14, 27, 50})
+Output:
+ -4
+
+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/skipping-work/solutions.py b/skipping-work/solutions.py
new file mode 100644
index 0000000..85d7c47
--- /dev/null
+++ b/skipping-work/solutions.py
@@ -0,0 +1,10 @@
+def​ ​solution(x,​ ​y):
+​ ​​ ​​ ​​ ​# x and y are two list of integers
+ for el in x:
+ if not el in y:
+ return el
+ for el in y:
+ if not el in x:
+ return el
+
+