DatasetRepo commited on
Commit
bc331f9
·
verified ·
1 Parent(s): 198b7b2

7b7f3927df79d4d2c8ddcafeca2454d630848762383516f5f1d449d76bbb4d37

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +1 -0
  2. equal_row_and_column_pairs/scala_tests/MySuite.scala +12 -0
  3. escape_the_spreading_fire/.DS_Store +0 -0
  4. escape_the_spreading_fire/haskell_tests/Main.hs +27 -0
  5. escape_the_spreading_fire/java_tests/Main.java +25 -0
  6. escape_the_spreading_fire/meta.json +0 -0
  7. escape_the_spreading_fire/ocaml_tests/main.ml +29 -0
  8. escape_the_spreading_fire/scala_tests/MySuite.scala +16 -0
  9. execution_of_all_suffix_instructions_staying_in_a_grid/.DS_Store +0 -0
  10. execution_of_all_suffix_instructions_staying_in_a_grid/haskell_tests/Main.hs +27 -0
  11. execution_of_all_suffix_instructions_staying_in_a_grid/java_tests/Main.java +25 -0
  12. execution_of_all_suffix_instructions_staying_in_a_grid/meta.json +654 -0
  13. execution_of_all_suffix_instructions_staying_in_a_grid/ocaml_tests/main.ml +29 -0
  14. execution_of_all_suffix_instructions_staying_in_a_grid/scala_tests/MySuite.scala +16 -0
  15. existence_of_a_substring_in_a_string_and_its_reverse/haskell_tests/Main.hs +44 -0
  16. existence_of_a_substring_in_a_string_and_its_reverse/java_tests/Main.java +24 -0
  17. existence_of_a_substring_in_a_string_and_its_reverse/meta.json +52 -0
  18. existence_of_a_substring_in_a_string_and_its_reverse/ocaml_tests/main.ml +45 -0
  19. existence_of_a_substring_in_a_string_and_its_reverse/scala_tests/MySuite.scala +36 -0
  20. extra_characters_in_a_string/java_tests/Main.java +21 -0
  21. faulty_keyboard/.DS_Store +0 -0
  22. faulty_keyboard/haskell_tests/Main.hs +24 -0
  23. faulty_keyboard/java_tests/Main.java +21 -0
  24. faulty_keyboard/meta.json +67 -0
  25. faulty_keyboard/ocaml_tests/main.ml +26 -0
  26. faulty_keyboard/scala_tests/MySuite.scala +12 -0
  27. find_a_good_subset_of_the_matrix/haskell_tests/Main.hs +0 -0
  28. find_a_good_subset_of_the_matrix/java_tests/Main.java +24 -0
  29. find_a_good_subset_of_the_matrix/meta.json +0 -0
  30. find_a_good_subset_of_the_matrix/ocaml_tests/main.ml +0 -0
  31. find_a_good_subset_of_the_matrix/scala_tests/MySuite.scala +0 -0
  32. find_a_safe_walk_through_a_grid/haskell_tests/Main.hs +45 -0
  33. find_a_safe_walk_through_a_grid/java_tests/Main.java +25 -0
  34. find_a_safe_walk_through_a_grid/meta.json +0 -0
  35. find_a_safe_walk_through_a_grid/ocaml_tests/main.ml +50 -0
  36. find_a_safe_walk_through_a_grid/scala_tests/MySuite.scala +44 -0
  37. find_all_good_indices/.DS_Store +0 -0
  38. find_all_good_indices/haskell_tests/Main.hs +24 -0
  39. find_all_good_indices/java_tests/Main.java +21 -0
  40. find_all_good_indices/meta.json +3 -0
  41. find_all_good_indices/ocaml_tests/main.ml +26 -0
  42. find_all_good_indices/scala_tests/MySuite.scala +12 -0
  43. find_all_k_distant_indices_in_an_array/.DS_Store +0 -0
  44. find_all_k_distant_indices_in_an_array/haskell_tests/Main.hs +24 -0
  45. find_all_k_distant_indices_in_an_array/java_tests/Main.java +21 -0
  46. find_all_k_distant_indices_in_an_array/meta.json +0 -0
  47. find_all_k_distant_indices_in_an_array/ocaml_tests/main.ml +26 -0
  48. find_all_k_distant_indices_in_an_array/scala_tests/MySuite.scala +12 -0
  49. find_all_possible_stable_binary_arrays_i/haskell_tests/Main.hs +45 -0
  50. find_all_possible_stable_binary_arrays_i/java_tests/Main.java +25 -0
.gitattributes CHANGED
@@ -113,3 +113,4 @@ divide_an_array_into_subarrays_with_minimum_cost_ii/meta.json filter=lfs diff=lf
113
  divide_array_into_arrays_with_max_difference/meta.json filter=lfs diff=lfs merge=lfs -text
114
  divide_intervals_into_minimum_number_of_groups/meta.json filter=lfs diff=lfs merge=lfs -text
115
  eat_pizzas/meta.json filter=lfs diff=lfs merge=lfs -text
 
 
113
  divide_array_into_arrays_with_max_difference/meta.json filter=lfs diff=lfs merge=lfs -text
114
  divide_intervals_into_minimum_number_of_groups/meta.json filter=lfs diff=lfs merge=lfs -text
115
  eat_pizzas/meta.json filter=lfs diff=lfs merge=lfs -text
116
+ find_all_good_indices/meta.json filter=lfs diff=lfs merge=lfs -text
equal_row_and_column_pairs/scala_tests/MySuite.scala ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ class MySuite extends munit.FunSuite {
3
+
4
+ test("test1") {
5
+ assertEquals(Main.equalPairs(List(List(3,2,1),List(1,7,6),List(2,7,7))), 1)
6
+ }
7
+
8
+ test("test2") {
9
+ assertEquals(Main.equalPairs(List(List(3,1,2,2),List(1,4,4,5),List(2,4,2,2),List(2,4,2,2))), 3)
10
+ }
11
+
12
+ }
escape_the_spreading_fire/.DS_Store ADDED
Binary file (6.15 kB). View file
 
escape_the_spreading_fire/haskell_tests/Main.hs ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ module Main where
3
+ import Test.HUnit
4
+
5
+ --Program start
6
+
7
+ --Program end
8
+
9
+ -- Test cases
10
+
11
+ test1 :: Test
12
+ test1 = TestCase (assertEqual "for (maximumMinutes [[0,2,0,0,0,0,0],[0,0,0,2,2,1,0],[0,2,0,0,1,2,0],[0,0,2,2,2,0,2],[0,0,0,0,0,0,0]])," 3 (maximumMinutes [[0,2,0,0,0,0,0],[0,0,0,2,2,1,0],[0,2,0,0,1,2,0],[0,0,2,2,2,0,2],[0,0,0,0,0,0,0]]))
13
+
14
+ test2 :: Test
15
+ test2 = TestCase (assertEqual "for (maximumMinutes [[0,0,0,0],[0,1,2,0],[0,2,0,0]])," (-1) (maximumMinutes [[0,0,0,0],[0,1,2,0],[0,2,0,0]]))
16
+
17
+ test3 :: Test
18
+ test3 = TestCase (assertEqual "for (maximumMinutes [[0,0,0],[2,2,0],[1,2,0]])," 1000000000 (maximumMinutes [[0,0,0],[2,2,0],[1,2,0]]))
19
+
20
+
21
+ -- Grouping test cases
22
+ tests :: Test
23
+ tests = TestList [TestLabel "Test1" test1, TestLabel "Test2" test2]
24
+
25
+ -- Running the tests
26
+ main :: IO Counts
27
+ main = runTestTT tests
escape_the_spreading_fire/java_tests/Main.java ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import static org.junit.jupiter.api.Assertions.*;
3
+ import org.junit.jupiter.api.Test;
4
+ import java.util.List;
5
+ import java.util.Arrays;
6
+ import java.util.ArrayList;
7
+ public class Main {
8
+ //Program start
9
+
10
+ //Program end
11
+
12
+ @Test
13
+ public void test1() {
14
+ assertEquals(3, maximumMinutes(new ArrayList<>(Arrays.asList(new ArrayList<>(Arrays.asList(0,2,0,0,0,0,0)),new ArrayList<>(Arrays.asList(0,0,0,2,2,1,0)),new ArrayList<>(Arrays.asList(0,2,0,0,1,2,0)),new ArrayList<>(Arrays.asList(0,0,2,2,2,0,2)),new ArrayList<>(Arrays.asList(0,0,0,0,0,0,0))))));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals(-1, maximumMinutes(new ArrayList<>(Arrays.asList(new ArrayList<>(Arrays.asList(0,0,0,0)),new ArrayList<>(Arrays.asList(0,1,2,0)),new ArrayList<>(Arrays.asList(0,2,0,0))))));
19
+ }
20
+ @Test
21
+ public void test3() {
22
+ assertEquals(1000000000, maximumMinutes(new ArrayList<>(Arrays.asList(new ArrayList<>(Arrays.asList(0,0,0)),new ArrayList<>(Arrays.asList(2,2,0)),new ArrayList<>(Arrays.asList(1,2,0))))));
23
+ }
24
+
25
+ }
escape_the_spreading_fire/meta.json ADDED
The diff for this file is too large to render. See raw diff
 
escape_the_spreading_fire/ocaml_tests/main.ml ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ module Main = struct
3
+ open OUnit2
4
+
5
+ (* Program start *)
6
+
7
+ (* Program end *)
8
+
9
+ (* Test cases *)
10
+
11
+ let test1 _ = assert_equal 3 (maximumMinutes [[0;2;0;0;0;0;0];[0;0;0;2;2;1;0];[0;2;0;0;1;2;0];[0;0;2;2;2;0;2];[0;0;0;0;0;0;0]])
12
+
13
+ let test2 _ = assert_equal (-1) (maximumMinutes [[0;0;0;0];[0;1;2;0];[0;2;0;0]])
14
+
15
+ let test3 _ = assert_equal 1000000000 (maximumMinutes [[0;0;0];[2;2;0];[1;2;0]])
16
+
17
+
18
+ (* Grouping test cases *)
19
+ let suite = "Test Suite for maximumMinutes" >::: [
20
+
21
+ "test1" >:: test1;
22
+ "test2" >:: test2;
23
+ "test3" >:: test3;
24
+ ]
25
+
26
+
27
+ (* Running the tests *)
28
+ let () = run_test_tt_main suite
29
+ end
escape_the_spreading_fire/scala_tests/MySuite.scala ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ class MySuite extends munit.FunSuite {
3
+
4
+ test("test1") {
5
+ assertEquals(Main.maximumMinutes(List(List(0,2,0,0,0,0,0),List(0,0,0,2,2,1,0),List(0,2,0,0,1,2,0),List(0,0,2,2,2,0,2),List(0,0,0,0,0,0,0))), 3)
6
+ }
7
+
8
+ test("test2") {
9
+ assertEquals(Main.maximumMinutes(List(List(0,0,0,0),List(0,1,2,0),List(0,2,0,0))), -1)
10
+ }
11
+
12
+ test("test3") {
13
+ assertEquals(Main.maximumMinutes(List(List(0,0,0),List(2,2,0),List(1,2,0))), 1000000000)
14
+ }
15
+
16
+ }
execution_of_all_suffix_instructions_staying_in_a_grid/.DS_Store ADDED
Binary file (6.15 kB). View file
 
execution_of_all_suffix_instructions_staying_in_a_grid/haskell_tests/Main.hs ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ module Main where
3
+ import Test.HUnit
4
+
5
+ --Program start
6
+
7
+ --Program end
8
+
9
+ -- Test cases
10
+
11
+ test1 :: Test
12
+ test1 = TestCase (assertEqual "for (executeInstructions 3 [0,1] \"RRDDLU \")," [1,5,4,3,1,0] (executeInstructions 3 [0,1] "RRDDLU"))
13
+
14
+ test2 :: Test
15
+ test2 = TestCase (assertEqual "for (executeInstructions 2 [1,1] \"LURD \")," [4,1,0,0] (executeInstructions 2 [1,1] "LURD"))
16
+
17
+ test3 :: Test
18
+ test3 = TestCase (assertEqual "for (executeInstructions 1 [0,0] \"LRUD \")," [0,0,0,0] (executeInstructions 1 [0,0] "LRUD"))
19
+
20
+
21
+ -- Grouping test cases
22
+ tests :: Test
23
+ tests = TestList [TestLabel "Test1" test1, TestLabel "Test2" test2]
24
+
25
+ -- Running the tests
26
+ main :: IO Counts
27
+ main = runTestTT tests
execution_of_all_suffix_instructions_staying_in_a_grid/java_tests/Main.java ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import static org.junit.jupiter.api.Assertions.*;
3
+ import org.junit.jupiter.api.Test;
4
+ import java.util.List;
5
+ import java.util.Arrays;
6
+ import java.util.ArrayList;
7
+ public class Main {
8
+ //Program start
9
+
10
+ //Program end
11
+
12
+ @Test
13
+ public void test1() {
14
+ assertEquals(new ArrayList<>(Arrays.asList(1,5,4,3,1,0)), executeInstructions(3, new ArrayList<>(Arrays.asList(0,1)), new ArrayList<>(Arrays.asList(0,1)), s = "RRDDLU"));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals(new ArrayList<>(Arrays.asList(4,1,0,0)), executeInstructions(2, new ArrayList<>(Arrays.asList(1,1)), new ArrayList<>(Arrays.asList(1,1)), s = "LURD"));
19
+ }
20
+ @Test
21
+ public void test3() {
22
+ assertEquals(new ArrayList<>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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "id": 2239,
3
+ "name": "execution_of_all_suffix_instructions_staying_in_a_grid",
4
+ "difficulty": "Medium",
5
+ "link": "https://leetcode.com/problems/execution-of-all-suffix-instructions-staying-in-a-grid/",
6
+ "date": "1639872000000",
7
+ "task_description": "There is an `n x n` grid, with the top-left cell at `(0, 0)` and the bottom-right cell at `(n - 1, n - 1)`. You are given the integer `n` and an integer array `startPos` where `startPos = [startrow, startcol]` indicates that a robot is initially at cell `(startrow, startcol)`. You are also given a **0-indexed** string `s` of length `m` where `s[i]` is the `ith` instruction for the robot: `'L'` (move left), `'R'` (move right), `'U'` (move up), and `'D'` (move down). The robot can begin executing from any `ith` instruction in `s`. It executes the instructions one by one towards the end of `s` but it stops if either of these conditions is met: The next instruction will move the robot off the grid. There are no more instructions left to execute. Return _an array_ `answer` _of length_ `m` _where_ `answer[i]` _is **the number of instructions** the robot can execute if the robot **begins executing from** the_ `ith` _instruction in_ `s`. **Example 1:** ``` **Input:** n = 3, startPos = [0,1], s = \"RRDDLU\" **Output:** [1,5,4,3,1,0] **Explanation:** Starting from startPos and beginning execution from the ith instruction: - 0th: \"**R**RDDLU\". Only one instruction \"R\" can be executed before it moves off the grid. - 1st: \"**RDDLU**\". All five instructions can be executed while it stays in the grid and ends at (1, 1). - 2nd: \"**DDLU**\". All four instructions can be executed while it stays in the grid and ends at (1, 0). - 3rd: \"**DLU**\". All three instructions can be executed while it stays in the grid and ends at (0, 0). - 4th: \"**L**U\". Only one instruction \"L\" can be executed before it moves off the grid. - 5th: \"U\". If moving up, it would move off the grid. ``` **Example 2:** ``` **Input:** n = 2, startPos = [1,1], s = \"LURD\" **Output:** [4,1,0,0] **Explanation:** - 0th: \"**LURD**\". - 1st: \"**U**RD\". - 2nd: \"RD\". - 3rd: \"D\". ``` **Example 3:** ``` **Input:** n = 1, startPos = [0,0], s = \"LRUD\" **Output:** [0,0,0,0] **Explanation:** No matter which instruction the robot begins execution from, it would move off the grid. ``` **Constraints:** `m == s.length` `1 <= n, m <= 500` `startPos.length == 2` `0 <= startrow, startcol < n` `s` consists of `'L'`, `'R'`, `'U'`, and `'D'`.",
8
+ "public_test_cases": [
9
+ {
10
+ "label": "Example 1",
11
+ "input": "n = 3, startPos = [0,1], s = \"RRDDLU\"",
12
+ "output": "[1,5,4,3,1,0] "
13
+ },
14
+ {
15
+ "label": "Example 2",
16
+ "input": "n = 2, startPos = [1,1], s = \"LURD\"",
17
+ "output": "[4,1,0,0] "
18
+ },
19
+ {
20
+ "label": "Example 3",
21
+ "input": "n = 1, startPos = [0,0], s = \"LRUD\"",
22
+ "output": "[0,0,0,0] "
23
+ }
24
+ ],
25
+ "private_test_cases": [
26
+ {
27
+ "input": [
28
+ 443,
29
+ [
30
+ 420,
31
+ 284
32
+ ],
33
+ "\"UDDLURURLUUUUULUUDUDLUDLDRULLRDDUUDRLRUDURRULDRDLULRLRRULURLURRLULLDRRDLDLUDUDLURUULLDDRLLLDUULDDUURLURLDDUL\""
34
+ ],
35
+ "output": [
36
+ 108,
37
+ 107,
38
+ 106,
39
+ 105,
40
+ 104,
41
+ 103,
42
+ 102,
43
+ 101,
44
+ 100,
45
+ 99,
46
+ 98,
47
+ 97,
48
+ 96,
49
+ 95,
50
+ 94,
51
+ 93,
52
+ 92,
53
+ 91,
54
+ 90,
55
+ 89,
56
+ 88,
57
+ 87,
58
+ 86,
59
+ 85,
60
+ 84,
61
+ 83,
62
+ 82,
63
+ 81,
64
+ 80,
65
+ 79,
66
+ 78,
67
+ 77,
68
+ 76,
69
+ 75,
70
+ 74,
71
+ 73,
72
+ 72,
73
+ 71,
74
+ 70,
75
+ 69,
76
+ 68,
77
+ 67,
78
+ 66,
79
+ 65,
80
+ 64,
81
+ 63,
82
+ 62,
83
+ 61,
84
+ 60,
85
+ 59,
86
+ 58,
87
+ 57,
88
+ 56,
89
+ 55,
90
+ 54,
91
+ 53,
92
+ 52,
93
+ 51,
94
+ 50,
95
+ 49,
96
+ 48,
97
+ 47,
98
+ 46,
99
+ 45,
100
+ 44,
101
+ 43,
102
+ 42,
103
+ 41,
104
+ 40,
105
+ 39,
106
+ 38,
107
+ 37,
108
+ 36,
109
+ 35,
110
+ 34,
111
+ 33,
112
+ 32,
113
+ 31,
114
+ 30,
115
+ 29,
116
+ 28,
117
+ 27,
118
+ 26,
119
+ 25,
120
+ 24,
121
+ 23,
122
+ 22,
123
+ 21,
124
+ 20,
125
+ 19,
126
+ 18,
127
+ 17,
128
+ 16,
129
+ 15,
130
+ 14,
131
+ 13,
132
+ 12,
133
+ 11,
134
+ 10,
135
+ 9,
136
+ 8,
137
+ 7,
138
+ 6,
139
+ 5,
140
+ 4,
141
+ 3,
142
+ 2,
143
+ 1
144
+ ]
145
+ },
146
+ {
147
+ "input": [
148
+ 326,
149
+ [
150
+ 184,
151
+ 253
152
+ ],
153
+ "\"DRRRRDRLULLLLLLRLURULLDDLLDDRDUDRULDULUURUDLRDULUUURLDDLDDRLURLUURLLLUDLDLRDDULULDURUDRLRRRDURLURUUUDULDRULRDURUDLDRUDUULUUURUDDLULUUUDLDDLDLULDLUDRDDDURLLLRRRLLDLLURULUDRLURDDRURRRRRLRUULLLLDLLDRLDRRRRRDURUDULURDUDDDRDLULURRRRDRRULRRRRUUULRLURRULUDRRULUURLDULRDRLRURURLLRUDDRDDLDDDDRUDLDULLLUDLURDLUULRULULUURLRDDLUULUUULRULDLRDDRRLDLDLRDRDLULLDDLLRURLDRRRUURDLDDRLRRUUUULURLRDRDDUDUULDLURLULDRLULDULDDUDLLUURUUUUULULLRURRRRLDUUDLLDDRDLULULDDULDLRULDDRDLDLURDURRRRLLUDLULRRRUUDDUDDRLRLUDDU\""
154
+ ],
155
+ "output": [
156
+ 490,
157
+ 489,
158
+ 488,
159
+ 487,
160
+ 486,
161
+ 485,
162
+ 484,
163
+ 483,
164
+ 482,
165
+ 481,
166
+ 480,
167
+ 479,
168
+ 478,
169
+ 477,
170
+ 476,
171
+ 475,
172
+ 474,
173
+ 473,
174
+ 472,
175
+ 471,
176
+ 470,
177
+ 469,
178
+ 468,
179
+ 467,
180
+ 466,
181
+ 465,
182
+ 464,
183
+ 463,
184
+ 462,
185
+ 461,
186
+ 460,
187
+ 459,
188
+ 458,
189
+ 457,
190
+ 456,
191
+ 455,
192
+ 454,
193
+ 453,
194
+ 452,
195
+ 451,
196
+ 450,
197
+ 449,
198
+ 448,
199
+ 447,
200
+ 446,
201
+ 445,
202
+ 444,
203
+ 443,
204
+ 442,
205
+ 441,
206
+ 440,
207
+ 439,
208
+ 438,
209
+ 437,
210
+ 436,
211
+ 435,
212
+ 434,
213
+ 433,
214
+ 432,
215
+ 431,
216
+ 430,
217
+ 429,
218
+ 428,
219
+ 427,
220
+ 426,
221
+ 425,
222
+ 424,
223
+ 423,
224
+ 422,
225
+ 421,
226
+ 420,
227
+ 419,
228
+ 418,
229
+ 417,
230
+ 416,
231
+ 415,
232
+ 414,
233
+ 413,
234
+ 412,
235
+ 411,
236
+ 410,
237
+ 409,
238
+ 408,
239
+ 407,
240
+ 406,
241
+ 405,
242
+ 404,
243
+ 403,
244
+ 402,
245
+ 401,
246
+ 400,
247
+ 399,
248
+ 398,
249
+ 397,
250
+ 396,
251
+ 395,
252
+ 394,
253
+ 393,
254
+ 392,
255
+ 391,
256
+ 390,
257
+ 389,
258
+ 388,
259
+ 387,
260
+ 386,
261
+ 385,
262
+ 384,
263
+ 383,
264
+ 382,
265
+ 381,
266
+ 380,
267
+ 379,
268
+ 378,
269
+ 377,
270
+ 376,
271
+ 375,
272
+ 374,
273
+ 373,
274
+ 372,
275
+ 371,
276
+ 370,
277
+ 369,
278
+ 368,
279
+ 367,
280
+ 366,
281
+ 365,
282
+ 364,
283
+ 363,
284
+ 362,
285
+ 361,
286
+ 360,
287
+ 359,
288
+ 358,
289
+ 357,
290
+ 356,
291
+ 355,
292
+ 354,
293
+ 353,
294
+ 352,
295
+ 351,
296
+ 350,
297
+ 349,
298
+ 348,
299
+ 347,
300
+ 346,
301
+ 345,
302
+ 344,
303
+ 343,
304
+ 342,
305
+ 341,
306
+ 340,
307
+ 339,
308
+ 338,
309
+ 337,
310
+ 336,
311
+ 335,
312
+ 334,
313
+ 333,
314
+ 332,
315
+ 331,
316
+ 330,
317
+ 329,
318
+ 328,
319
+ 327,
320
+ 326,
321
+ 325,
322
+ 324,
323
+ 323,
324
+ 322,
325
+ 321,
326
+ 320,
327
+ 319,
328
+ 318,
329
+ 317,
330
+ 316,
331
+ 315,
332
+ 314,
333
+ 313,
334
+ 312,
335
+ 311,
336
+ 310,
337
+ 309,
338
+ 308,
339
+ 307,
340
+ 306,
341
+ 305,
342
+ 304,
343
+ 303,
344
+ 302,
345
+ 301,
346
+ 300,
347
+ 299,
348
+ 298,
349
+ 297,
350
+ 296,
351
+ 295,
352
+ 294,
353
+ 293,
354
+ 292,
355
+ 291,
356
+ 290,
357
+ 289,
358
+ 288,
359
+ 287,
360
+ 286,
361
+ 285,
362
+ 284,
363
+ 283,
364
+ 282,
365
+ 281,
366
+ 280,
367
+ 279,
368
+ 278,
369
+ 277,
370
+ 276,
371
+ 275,
372
+ 274,
373
+ 273,
374
+ 272,
375
+ 271,
376
+ 270,
377
+ 269,
378
+ 268,
379
+ 267,
380
+ 266,
381
+ 265,
382
+ 264,
383
+ 263,
384
+ 262,
385
+ 261,
386
+ 260,
387
+ 259,
388
+ 258,
389
+ 257,
390
+ 256,
391
+ 255,
392
+ 254,
393
+ 253,
394
+ 252,
395
+ 251,
396
+ 250,
397
+ 249,
398
+ 248,
399
+ 247,
400
+ 246,
401
+ 245,
402
+ 244,
403
+ 243,
404
+ 242,
405
+ 241,
406
+ 240,
407
+ 239,
408
+ 238,
409
+ 237,
410
+ 236,
411
+ 235,
412
+ 234,
413
+ 233,
414
+ 232,
415
+ 231,
416
+ 230,
417
+ 229,
418
+ 228,
419
+ 227,
420
+ 226,
421
+ 225,
422
+ 224,
423
+ 223,
424
+ 222,
425
+ 221,
426
+ 220,
427
+ 219,
428
+ 218,
429
+ 217,
430
+ 216,
431
+ 215,
432
+ 214,
433
+ 213,
434
+ 212,
435
+ 211,
436
+ 210,
437
+ 209,
438
+ 208,
439
+ 207,
440
+ 206,
441
+ 205,
442
+ 204,
443
+ 203,
444
+ 202,
445
+ 201,
446
+ 200,
447
+ 199,
448
+ 198,
449
+ 197,
450
+ 196,
451
+ 195,
452
+ 194,
453
+ 193,
454
+ 192,
455
+ 191,
456
+ 190,
457
+ 189,
458
+ 188,
459
+ 187,
460
+ 186,
461
+ 185,
462
+ 184,
463
+ 183,
464
+ 182,
465
+ 181,
466
+ 180,
467
+ 179,
468
+ 178,
469
+ 177,
470
+ 176,
471
+ 175,
472
+ 174,
473
+ 173,
474
+ 172,
475
+ 171,
476
+ 170,
477
+ 169,
478
+ 168,
479
+ 167,
480
+ 166,
481
+ 165,
482
+ 164,
483
+ 163,
484
+ 162,
485
+ 161,
486
+ 160,
487
+ 159,
488
+ 158,
489
+ 157,
490
+ 156,
491
+ 155,
492
+ 154,
493
+ 153,
494
+ 152,
495
+ 151,
496
+ 150,
497
+ 149,
498
+ 148,
499
+ 147,
500
+ 146,
501
+ 145,
502
+ 144,
503
+ 143,
504
+ 142,
505
+ 141,
506
+ 140,
507
+ 139,
508
+ 138,
509
+ 137,
510
+ 136,
511
+ 135,
512
+ 134,
513
+ 133,
514
+ 132,
515
+ 131,
516
+ 130,
517
+ 129,
518
+ 128,
519
+ 127,
520
+ 126,
521
+ 125,
522
+ 124,
523
+ 123,
524
+ 122,
525
+ 121,
526
+ 120,
527
+ 119,
528
+ 118,
529
+ 117,
530
+ 116,
531
+ 115,
532
+ 114,
533
+ 113,
534
+ 112,
535
+ 111,
536
+ 110,
537
+ 109,
538
+ 108,
539
+ 107,
540
+ 106,
541
+ 105,
542
+ 104,
543
+ 103,
544
+ 102,
545
+ 101,
546
+ 100,
547
+ 99,
548
+ 98,
549
+ 97,
550
+ 96,
551
+ 95,
552
+ 94,
553
+ 93,
554
+ 92,
555
+ 91,
556
+ 90,
557
+ 89,
558
+ 88,
559
+ 87,
560
+ 86,
561
+ 85,
562
+ 84,
563
+ 83,
564
+ 82,
565
+ 81,
566
+ 80,
567
+ 79,
568
+ 78,
569
+ 77,
570
+ 76,
571
+ 75,
572
+ 74,
573
+ 73,
574
+ 72,
575
+ 71,
576
+ 70,
577
+ 69,
578
+ 68,
579
+ 67,
580
+ 66,
581
+ 65,
582
+ 64,
583
+ 63,
584
+ 62,
585
+ 61,
586
+ 60,
587
+ 59,
588
+ 58,
589
+ 57,
590
+ 56,
591
+ 55,
592
+ 54,
593
+ 53,
594
+ 52,
595
+ 51,
596
+ 50,
597
+ 49,
598
+ 48,
599
+ 47,
600
+ 46,
601
+ 45,
602
+ 44,
603
+ 43,
604
+ 42,
605
+ 41,
606
+ 40,
607
+ 39,
608
+ 38,
609
+ 37,
610
+ 36,
611
+ 35,
612
+ 34,
613
+ 33,
614
+ 32,
615
+ 31,
616
+ 30,
617
+ 29,
618
+ 28,
619
+ 27,
620
+ 26,
621
+ 25,
622
+ 24,
623
+ 23,
624
+ 22,
625
+ 21,
626
+ 20,
627
+ 19,
628
+ 18,
629
+ 17,
630
+ 16,
631
+ 15,
632
+ 14,
633
+ 13,
634
+ 12,
635
+ 11,
636
+ 10,
637
+ 9,
638
+ 8,
639
+ 7,
640
+ 6,
641
+ 5,
642
+ 4,
643
+ 3,
644
+ 2,
645
+ 1
646
+ ]
647
+ }
648
+ ],
649
+ "haskell_template": "executeInstructions :: Int -> [Int] -> String -> [Int]\nexecuteInstructions n startPos s ",
650
+ "ocaml_template": "let executeInstructions (n: int) (startPos: int list) (s: string) : int list = ",
651
+ "scala_template": "def executeInstructions(n: Int,startPos: List[Int],s: String): List[Int] = { \n \n}",
652
+ "java_template": "public static List<Integer> executeInstructions(int n, List<Integer> startPos, String s) {\n\n}",
653
+ "python_template": "class Solution(object):\n def executeInstructions(self, n, startPos, s):\n \"\"\"\n :type n: int\n :type startPos: List[int]\n :type s: str\n :rtype: List[int]\n \"\"\"\n "
654
+ }
execution_of_all_suffix_instructions_staying_in_a_grid/ocaml_tests/main.ml ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ module Main = struct
3
+ open OUnit2
4
+
5
+ (* Program start *)
6
+
7
+ (* Program end *)
8
+
9
+ (* Test cases *)
10
+
11
+ let test1 _ = assert_equal [1;5;4;3;1;0] (executeInstructions 3 [0;1] [0;1]; s = "RRDDLU")
12
+
13
+ let test2 _ = assert_equal [4;1;0;0] (executeInstructions 2 [1;1] [1;1]; s = "LURD")
14
+
15
+ let test3 _ = assert_equal [0;0;0;0] (executeInstructions 1 [0;0] [0;0]; s = "LRUD")
16
+
17
+
18
+ (* Grouping test cases *)
19
+ let suite = "Test Suite for executeInstructions" >::: [
20
+
21
+ "test1" >:: test1;
22
+ "test2" >:: test2;
23
+ "test3" >:: test3;
24
+ ]
25
+
26
+
27
+ (* Running the tests *)
28
+ let () = run_test_tt_main suite
29
+ end
execution_of_all_suffix_instructions_staying_in_a_grid/scala_tests/MySuite.scala ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ class MySuite extends munit.FunSuite {
3
+
4
+ test("test1") {
5
+ assertEquals(Main.executeInstructions(3,List(0,1),List(0,1), s = "RRDDLU"), List(1,5,4,3,1,0))
6
+ }
7
+
8
+ test("test2") {
9
+ assertEquals(Main.executeInstructions(2,List(1,1),List(1,1), s = "LURD"), List(4,1,0,0))
10
+ }
11
+
12
+ test("test3") {
13
+ assertEquals(Main.executeInstructions(1,List(0,0),List(0,0), s = "LRUD"), List(0,0,0,0))
14
+ }
15
+
16
+ }
existence_of_a_substring_in_a_string_and_its_reverse/haskell_tests/Main.hs ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ module Main where
3
+ import Test.HUnit
4
+
5
+ --Program start
6
+ isSubstringPresent :: String -> Bool
7
+ isSubstringPresent s = undefined
8
+
9
+ --Program end
10
+
11
+ -- Test cases
12
+
13
+ test1 :: Test
14
+ test1 = TestCase (assertEqual "for (isSubstringPresent \"leetcode \")," True (isSubstringPresent "leetcode"))
15
+
16
+ test2 :: Test
17
+ test2 = TestCase (assertEqual "for (isSubstringPresent \"abcba \")," True (isSubstringPresent "abcba"))
18
+
19
+ test3 :: Test
20
+ test3 = TestCase (assertEqual "for (isSubstringPresent \"abcd \")," False (isSubstringPresent "abcd"))
21
+
22
+ test4 :: Test
23
+ test4 = TestCase (assertEqual "for (isSubstringPresent \"uxsctyrjpymbmowyhjugwqiyfz \")," True (isSubstringPresent "uxsctyrjpymbmowyhjugwqiyfz"))
24
+
25
+ test5 :: Test
26
+ test5 = TestCase (assertEqual "for (isSubstringPresent \"mjbjrlhtmbfafzgxuiiuqjjukaertatzsumrttlpwvntukmraxebvbneehxlfeascvgxoxiickvgh \")," True (isSubstringPresent "mjbjrlhtmbfafzgxuiiuqjjukaertatzsumrttlpwvntukmraxebvbneehxlfeascvgxoxiickvgh"))
27
+
28
+ test6 :: Test
29
+ test6 = TestCase (assertEqual "for (isSubstringPresent \"zdpvhedjhpeatpvukfiidelttveyqcqpfinzdeighewhjoezedryyjziedqnqaalsxanruqlcbthagibvnf \")," True (isSubstringPresent "zdpvhedjhpeatpvukfiidelttveyqcqpfinzdeighewhjoezedryyjziedqnqaalsxanruqlcbthagibvnf"))
30
+
31
+ test7 :: Test
32
+ test7 = TestCase (assertEqual "for (isSubstringPresent \"hsbidztoxjgtphpwuybauqmupodiafuekqqtsjabfrxmttlngfupfxdntydd \")," True (isSubstringPresent "hsbidztoxjgtphpwuybauqmupodiafuekqqtsjabfrxmttlngfupfxdntydd"))
33
+
34
+ test8 :: Test
35
+ test8 = TestCase (assertEqual "for (isSubstringPresent \"ccnfapqdgtksfhrqtmkttoziggdhiahutwjaywewmgcpjuzsy \")," True (isSubstringPresent "ccnfapqdgtksfhrqtmkttoziggdhiahutwjaywewmgcpjuzsy"))
36
+
37
+
38
+ -- Grouping test cases
39
+ tests :: Test
40
+ tests = TestList [TestLabel "Test1" test1, TestLabel "Test2" test2, TestLabel "Test3" test3, TestLabel "Test4" test4, TestLabel "Test5" test5, TestLabel "Test6" test6, TestLabel "Test7" test7]
41
+
42
+ -- Running the tests
43
+ main :: IO Counts
44
+ main = runTestTT tests
existence_of_a_substring_in_a_string_and_its_reverse/java_tests/Main.java ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import static org.junit.jupiter.api.Assertions.*;
3
+ import org.junit.jupiter.api.Test;
4
+ import java.util.List;
5
+ import java.util.Arrays;
6
+ public class Main {
7
+ //Program start
8
+
9
+ //Program end
10
+
11
+ @Test
12
+ public void test1() {
13
+ assertEquals(true, isSubstringPresent("leetcode"));
14
+ }
15
+ @Test
16
+ public void test2() {
17
+ assertEquals(true, isSubstringPresent("abcba"));
18
+ }
19
+ @Test
20
+ public void test3() {
21
+ assertEquals(false, isSubstringPresent("abcd"));
22
+ }
23
+
24
+ }
existence_of_a_substring_in_a_string_and_its_reverse/meta.json ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "id": 3353,
3
+ "name": "existence_of_a_substring_in_a_string_and_its_reverse",
4
+ "difficulty": "Easy",
5
+ "link": "https://leetcode.com/problems/existence-of-a-substring-in-a-string-and-its-reverse/",
6
+ "date": "2024-03-10 00:00:00",
7
+ "task_description": "Given a** **string `s`, find any substring of length `2` which is also present in the reverse of `s`. Return `true`_ if such a substring exists, and _`false`_ otherwise._ **Example 1:** **Input: **s = \"leetcode\" **Output: **true **Explanation:** Substring `\"ee\"` is of length `2` which is also present in `reverse(s) == \"edocteel\"`. **Example 2:** **Input: **s = \"abcba\" **Output: **true **Explanation:** All of the substrings of length `2` `\"ab\"`, `\"bc\"`, `\"cb\"`, `\"ba\"` are also present in `reverse(s) == \"abcba\"`. **Example 3:** **Input: **s = \"abcd\" **Output: **false **Explanation:** There is no substring of length `2` in `s`, which is also present in the reverse of `s`. **Constraints:** `1 <= s.length <= 100` `s` consists only of lowercase English letters.",
8
+ "public_test_cases": [
9
+ {
10
+ "label": "Example 1",
11
+ "input": "s = \"leetcode\"",
12
+ "output": "true "
13
+ },
14
+ {
15
+ "label": "Example 2",
16
+ "input": "s = \"abcba\"",
17
+ "output": "true "
18
+ },
19
+ {
20
+ "label": "Example 3",
21
+ "input": "s = \"abcd\"",
22
+ "output": "false "
23
+ }
24
+ ],
25
+ "private_test_cases": [
26
+ {
27
+ "input": "uxsctyrjpymbmowyhjugwqiyfz",
28
+ "output": true
29
+ },
30
+ {
31
+ "input": "mjbjrlhtmbfafzgxuiiuqjjukaertatzsumrttlpwvntukmraxebvbneehxlfeascvgxoxiickvgh",
32
+ "output": true
33
+ },
34
+ {
35
+ "input": "zdpvhedjhpeatpvukfiidelttveyqcqpfinzdeighewhjoezedryyjziedqnqaalsxanruqlcbthagibvnf",
36
+ "output": true
37
+ },
38
+ {
39
+ "input": "hsbidztoxjgtphpwuybauqmupodiafuekqqtsjabfrxmttlngfupfxdntydd",
40
+ "output": true
41
+ },
42
+ {
43
+ "input": "ccnfapqdgtksfhrqtmkttoziggdhiahutwjaywewmgcpjuzsy",
44
+ "output": true
45
+ }
46
+ ],
47
+ "haskell_template": "isSubstringPresent :: String -> Bool\nisSubstringPresent s ",
48
+ "ocaml_template": "let isSubstringPresent (s: string) : bool = ",
49
+ "scala_template": "def isSubstringPresent(s: String): Boolean = { \n \n}",
50
+ "java_template": "class Solution {\n public boolean isSubstringPresent(String s) {\n \n }\n}",
51
+ "python_template": "class Solution(object):\n def isSubstringPresent(self, s):\n \"\"\"\n :type s: str\n :rtype: bool\n \"\"\"\n "
52
+ }
existence_of_a_substring_in_a_string_and_its_reverse/ocaml_tests/main.ml ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ module Main = struct
3
+ open OUnit2
4
+
5
+ (* Program start *)
6
+ let isSubstringPresent (s: string) : bool = failwith "Not implemented"
7
+
8
+ (* Program end *)
9
+
10
+ (* Test cases *)
11
+
12
+ let test1 _ = assert_equal true (isSubstringPresent "leetcode")
13
+
14
+ let test2 _ = assert_equal true (isSubstringPresent "abcba")
15
+
16
+ let test3 _ = assert_equal false (isSubstringPresent "abcd")
17
+
18
+ let test4 _ = assert_equal false (isSubstringPresent "uxsctyrjpymbmowyhjugwqiyfz")
19
+
20
+ let test5 _ = assert_equal false (isSubstringPresent "mjbjrlhtmbfafzgxuiiuqjjukaertatzsumrttlpwvntukmraxebvbneehxlfeascvgxoxiickvgh")
21
+
22
+ let test6 _ = assert_equal false (isSubstringPresent "zdpvhedjhpeatpvukfiidelttveyqcqpfinzdeighewhjoezedryyjziedqnqaalsxanruqlcbthagibvnf")
23
+
24
+ let test7 _ = assert_equal false (isSubstringPresent "hsbidztoxjgtphpwuybauqmupodiafuekqqtsjabfrxmttlngfupfxdntydd")
25
+
26
+ let test8 _ = assert_equal false (isSubstringPresent "ccnfapqdgtksfhrqtmkttoziggdhiahutwjaywewmgcpjuzsy")
27
+
28
+
29
+ (* Grouping test cases *)
30
+ let suite = "Test Suite for isSubstringPresent" >::: [
31
+
32
+ "test1" >:: test1;
33
+ "test2" >:: test2;
34
+ "test3" >:: test3;
35
+ "test4" >:: test4;
36
+ "test5" >:: test5;
37
+ "test6" >:: test6;
38
+ "test7" >:: test7;
39
+ "test8" >:: test8;
40
+ ]
41
+
42
+
43
+ (* Running the tests *)
44
+ let () = run_test_tt_main suite
45
+ end
existence_of_a_substring_in_a_string_and_its_reverse/scala_tests/MySuite.scala ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ class MySuite extends munit.FunSuite {
3
+
4
+ test("test1") {
5
+ assertEquals(Main.isSubstringPresent("leetcode"), true)
6
+ }
7
+
8
+ test("test2") {
9
+ assertEquals(Main.isSubstringPresent("abcba"), true)
10
+ }
11
+
12
+ test("test3") {
13
+ assertEquals(Main.isSubstringPresent("abcd"), false)
14
+ }
15
+
16
+ test("test4") {
17
+ assertEquals(Main.isSubstringPresent(",u,x,s,c,t,y,r,j,p,y,m,b,m,o,w,y,h,j,u,g,w,q,i,y,f,z,"), true)
18
+ }
19
+
20
+ test("test5") {
21
+ assertEquals(Main.isSubstringPresent(",m,j,b,j,r,l,h,t,m,b,f,a,f,z,g,x,u,i,i,u,q,j,j,u,k,a,e,r,t,a,t,z,s,u,m,r,t,t,l,p,w,v,n,t,u,k,m,r,a,x,e,b,v,b,n,e,e,h,x,l,f,e,a,s,c,v,g,x,o,x,i,i,c,k,v,g,h,"), true)
22
+ }
23
+
24
+ test("test6") {
25
+ assertEquals(Main.isSubstringPresent(",z,d,p,v,h,e,d,j,h,p,e,a,t,p,v,u,k,f,i,i,d,e,l,t,t,v,e,y,q,c,q,p,f,i,n,z,d,e,i,g,h,e,w,h,j,o,e,z,e,d,r,y,y,j,z,i,e,d,q,n,q,a,a,l,s,x,a,n,r,u,q,l,c,b,t,h,a,g,i,b,v,n,f,"), true)
26
+ }
27
+
28
+ test("test7") {
29
+ assertEquals(Main.isSubstringPresent(",h,s,b,i,d,z,t,o,x,j,g,t,p,h,p,w,u,y,b,a,u,q,m,u,p,o,d,i,a,f,u,e,k,q,q,t,s,j,a,b,f,r,x,m,t,t,l,n,g,f,u,p,f,x,d,n,t,y,d,d,"), true)
30
+ }
31
+
32
+ test("test8") {
33
+ assertEquals(Main.isSubstringPresent(",c,c,n,f,a,p,q,d,g,t,k,s,f,h,r,q,t,m,k,t,t,o,z,i,g,g,d,h,i,a,h,u,t,w,j,a,y,w,e,w,m,g,c,p,j,u,z,s,y,"), true)
34
+ }
35
+
36
+ }
extra_characters_in_a_string/java_tests/Main.java ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import static org.junit.jupiter.api.Assertions.*;
3
+ import org.junit.jupiter.api.Test;
4
+ import java.util.List;
5
+ import java.util.Arrays;
6
+ import java.util.ArrayList;
7
+ public class Main {
8
+ //Program start
9
+
10
+ //Program end
11
+
12
+ @Test
13
+ public void test1() {
14
+ assertEquals(1, minExtraChar("leetscode", new ArrayList<>(Arrays.asList("leet","code","leetcode"))));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals(3, minExtraChar("sayhelloworld", new ArrayList<>(Arrays.asList("hello","world"))));
19
+ }
20
+
21
+ }
faulty_keyboard/.DS_Store ADDED
Binary file (6.15 kB). View file
 
faulty_keyboard/haskell_tests/Main.hs ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ module Main where
3
+ import Test.HUnit
4
+
5
+ --Program start
6
+
7
+ --Program end
8
+
9
+ -- Test cases
10
+
11
+ test1 :: Test
12
+ test1 = TestCase (assertEqual "for (finalString \"string \")," "rtsng" (finalString "string"))
13
+
14
+ test2 :: Test
15
+ test2 = TestCase (assertEqual "for (finalString \"poiinter \")," "ponter" (finalString "poiinter"))
16
+
17
+
18
+ -- Grouping test cases
19
+ tests :: Test
20
+ tests = TestList [TestLabel "Test1" test1]
21
+
22
+ -- Running the tests
23
+ main :: IO Counts
24
+ main = runTestTT tests
faulty_keyboard/java_tests/Main.java ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import static org.junit.jupiter.api.Assertions.*;
3
+ import org.junit.jupiter.api.Test;
4
+ import java.util.List;
5
+ import java.util.Arrays;
6
+ import java.util.ArrayList;
7
+ public class Main {
8
+ //Program start
9
+
10
+ //Program end
11
+
12
+ @Test
13
+ public void test1() {
14
+ assertEquals("string", finalString("string"));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals("poiinter", finalString("poiinter"));
19
+ }
20
+
21
+ }
faulty_keyboard/meta.json ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "id": 2886,
3
+ "name": "faulty_keyboard",
4
+ "difficulty": "Easy",
5
+ "link": "https://leetcode.com/problems/faulty-keyboard/",
6
+ "date": "1690675200000",
7
+ "task_description": "Your laptop keyboard is faulty, and whenever you type a character `'i'` on it, it reverses the string that you have written. Typing other characters works as expected. You are given a **0-indexed** string `s`, and you type each character of `s` using your faulty keyboard. Return _the final string that will be present on your laptop screen._ **Example 1:** ``` **Input:** s = \"string\" **Output:** \"rtsng\" **Explanation:** After typing first character, the text on the screen is \"s\". After the second character, the text is \"st\". After the third character, the text is \"str\". Since the fourth character is an 'i', the text gets reversed and becomes \"rts\". After the fifth character, the text is \"rtsn\". After the sixth character, the text is \"rtsng\". Therefore, we return \"rtsng\". ``` **Example 2:** ``` **Input:** s = \"poiinter\" **Output:** \"ponter\" **Explanation:** After the first character, the text on the screen is \"p\". After the second character, the text is \"po\". Since the third character you type is an 'i', the text gets reversed and becomes \"op\". Since the fourth character you type is an 'i', the text gets reversed and becomes \"po\". After the fifth character, the text is \"pon\". After the sixth character, the text is \"pont\". After the seventh character, the text is \"ponte\". After the eighth character, the text is \"ponter\". Therefore, we return \"ponter\". ``` **Constraints:** `1 <= s.length <= 100` `s` consists of lowercase English letters. `s[0] != 'i'`",
8
+ "public_test_cases": [
9
+ {
10
+ "label": "Example 1",
11
+ "input": "s = \"string\"",
12
+ "output": "\"rtsng\" "
13
+ },
14
+ {
15
+ "label": "Example 2",
16
+ "input": "s = \"poiinter\"",
17
+ "output": "\"ponter\" "
18
+ }
19
+ ],
20
+ "private_test_cases": [
21
+ {
22
+ "input": "fthtrjraadnxaavpidvrmcvhrjulljiytrssvvoaugtuytmaakajjzzehdgjtmxgww",
23
+ "output": "jllujrhvcmrvdfthtrjraadnxaavpytrssvvoaugtuytmaakajjzzehdgjtmxgww"
24
+ },
25
+ {
26
+ "input": "saoaoheiyquznlsoyrysvcwdkeoz",
27
+ "output": "ehoaoasyquznlsoyrysvcwdkeoz"
28
+ },
29
+ {
30
+ "input": "kkiecfxxrzewdbqrrpqmxqowvxbpctkbtdwgkgjycrwhicklybiulayzzhyydpapolrqqkumlpsahzspmoszxhicozzukryr",
31
+ "output": "hxzsompszhasplmukqqrlopapdyyhzzyaluhwrcyjgkgwdtbktcpbxvwoqxmqprrqbdwezrxxfcekkcklybcozzukryr"
32
+ },
33
+ {
34
+ "input": "ekjuiofnvcvtmffzezlsuhgltucurnlflnnqkwzovjjcwksnysxsvlvfqijexrcyzeyrnn",
35
+ "output": "qfvlvsxsynskwcjjvozwkqnnlflnrucutlghuslzezffmtvcvnfoekjujexrcyzeyrnn"
36
+ },
37
+ {
38
+ "input": "nhmcopmsc",
39
+ "output": "nhmcopmsc"
40
+ },
41
+ {
42
+ "input": "ocltrauelljhtjoxrarexttzhevkniytm",
43
+ "output": "nkvehzttxerarxojthjlleuartlcoytm"
44
+ },
45
+ {
46
+ "input": "uziexwopilmyzmfluzathbnqsrezntbughcooemenpjxjmhznogwmfumrhaqfpoeteyqjroirgofwqpslbkglvrjvjeqdxmzl",
47
+ "output": "orjqyeteopfqahrmufmwgonzhmjxjpnemeoochgubtnzersqnbhtazulfmzymlzuexwoprgofwqpslbkglvrjvjeqdxmzl"
48
+ },
49
+ {
50
+ "input": "yzaggfowfgrhvxkvvfvnaplueorscjwndccisnluweaizaicxnnujjhmuhgkhfaubfqli",
51
+ "output": "lqfbuafhkghumhjjunnxcaewulnsyzaggfowfgrhvxkvvfvnaplueorscjwndccza"
52
+ },
53
+ {
54
+ "input": "qgnyaibnyhujjgnlhnedoafmtawfeu",
55
+ "output": "ayngqbnyhujjgnlhnedoafmtawfeu"
56
+ },
57
+ {
58
+ "input": "gogiihelgvuykuwopmtowttivgfrrgkzvckerrwkhvyutifobihyxkfpfyuzcerasunjlwnhgkso",
59
+ "output": "bofttwotmpowukyuvglehgogvgfrrgkzvckerrwkhvyuthyxkfpfyuzcerasunjlwnhgkso"
60
+ }
61
+ ],
62
+ "haskell_template": "finalString :: String -> String\nfinalString s ",
63
+ "ocaml_template": "let finalString (s: string) : string = ",
64
+ "scala_template": "def finalString(s: String): String = { \n \n}",
65
+ "java_template": "public static String finalString(String s) {\n\n}",
66
+ "python_template": "class Solution(object):\n def finalString(self, s):\n \"\"\"\n :type s: str\n :rtype: str\n \"\"\"\n "
67
+ }
faulty_keyboard/ocaml_tests/main.ml ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ module Main = struct
3
+ open OUnit2
4
+
5
+ (* Program start *)
6
+
7
+ (* Program end *)
8
+
9
+ (* Test cases *)
10
+
11
+ let test1 _ = assert_equal "rtsng" (finalString "string")
12
+
13
+ let test2 _ = assert_equal "ponter" (finalString "poiinter")
14
+
15
+
16
+ (* Grouping test cases *)
17
+ let suite = "Test Suite for finalString" >::: [
18
+
19
+ "test1" >:: test1;
20
+ "test2" >:: test2;
21
+ ]
22
+
23
+
24
+ (* Running the tests *)
25
+ let () = run_test_tt_main suite
26
+ end
faulty_keyboard/scala_tests/MySuite.scala ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ class MySuite extends munit.FunSuite {
3
+
4
+ test("test1") {
5
+ assertEquals(Main.finalString("string"), "rtsng")
6
+ }
7
+
8
+ test("test2") {
9
+ assertEquals(Main.finalString("poiinter"), "ponter")
10
+ }
11
+
12
+ }
find_a_good_subset_of_the_matrix/haskell_tests/Main.hs ADDED
The diff for this file is too large to render. See raw diff
 
find_a_good_subset_of_the_matrix/java_tests/Main.java ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import static org.junit.jupiter.api.Assertions.*;
3
+ import org.junit.jupiter.api.Test;
4
+ import java.util.List;
5
+ import java.util.Arrays;
6
+ public class Main {
7
+ //Program start
8
+
9
+ //Program end
10
+
11
+ @Test
12
+ public void test1() {
13
+ assertEquals(Arrays.asList(0,1), goodSubsetofBinaryMatrix(Arrays.asList(Arrays.asList(0,1,1,0),Arrays.asList(0,0,0,1),Arrays.asList(1,1,1,1))));
14
+ }
15
+ @Test
16
+ public void test2() {
17
+ assertEquals(Arrays.asList(0), goodSubsetofBinaryMatrix(Arrays.asList(Arrays.asList(0))));
18
+ }
19
+ @Test
20
+ public void test3() {
21
+ assertEquals([], goodSubsetofBinaryMatrix(Arrays.asList(Arrays.asList(1,1,1),Arrays.asList(1,1,1))));
22
+ }
23
+
24
+ }
find_a_good_subset_of_the_matrix/meta.json ADDED
The diff for this file is too large to render. See raw diff
 
find_a_good_subset_of_the_matrix/ocaml_tests/main.ml ADDED
The diff for this file is too large to render. See raw diff
 
find_a_good_subset_of_the_matrix/scala_tests/MySuite.scala ADDED
The diff for this file is too large to render. See raw diff
 
find_a_safe_walk_through_a_grid/haskell_tests/Main.hs ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ module Main where
3
+ import Test.HUnit
4
+
5
+ --Program start
6
+
7
+ --Program end
8
+
9
+ -- Test cases
10
+
11
+ test1 :: Test
12
+ test1 = TestCase (assertEqual "for (findSafeWalk [[0,1,0,0,0],[0,1,0,1,0],[0,0,0,1,0]] 1)," True (findSafeWalk [[0,1,0,0,0],[0,1,0,1,0],[0,0,0,1,0]] 1))
13
+
14
+ test2 :: Test
15
+ test2 = TestCase (assertEqual "for (findSafeWalk [[0,1,1,0,0,0],[1,0,1,0,0,0],[0,1,1,1,0,1],[0,0,1,0,1,0]] 3)," False (findSafeWalk [[0,1,1,0,0,0],[1,0,1,0,0,0],[0,1,1,1,0,1],[0,0,1,0,1,0]] 3))
16
+
17
+ test3 :: Test
18
+ test3 = TestCase (assertEqual "for (findSafeWalk [[1,1,1],[1,0,1],[1,1,1]] 5)," True (findSafeWalk [[1,1,1],[1,0,1],[1,1,1]] 5))
19
+
20
+ test4 :: Test
21
+ test4 = TestCase (assertEqual "for (findSafeWalk [[1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1], [0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0], [0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1,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 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0]] 3))
37
+
38
+
39
+ -- Grouping test cases
40
+ tests :: Test
41
+ tests = TestList [TestLabel "Test1" test1, TestLabel "Test2" test2, TestLabel "Test3" test3, TestLabel "Test4" test4, TestLabel "Test5" test5, TestLabel "Test6" test6, TestLabel "Test7" test7, TestLabel "Test8" test8, TestLabel "Test9" test9]
42
+
43
+ -- Running the tests
44
+ main :: IO Counts
45
+ main = runTestTT tests
find_a_safe_walk_through_a_grid/java_tests/Main.java ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import static org.junit.jupiter.api.Assertions.*;
3
+ import org.junit.jupiter.api.Test;
4
+ import java.util.List;
5
+ import java.util.Arrays;
6
+ import java.util.ArrayList;
7
+ public class Main {
8
+ //Program start
9
+
10
+ //Program end
11
+
12
+ @Test
13
+ public void test1() {
14
+ assertEquals(true, findSafeWalk(new ArrayList<>(Arrays.asList(new ArrayList<>(Arrays.asList(0,1,0,0,0)),new ArrayList<>(Arrays.asList(0,1,0,1,0)),new ArrayList<>(Arrays.asList(0,0,0,1,0)))), 1));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals(false, findSafeWalk(new ArrayList<>(Arrays.asList(new ArrayList<>(Arrays.asList(0,1,1,0,0,0)),new ArrayList<>(Arrays.asList(1,0,1,0,0,0)),new ArrayList<>(Arrays.asList(0,1,1,1,0,1)),new ArrayList<>(Arrays.asList(0,0,1,0,1,0)))), 3));
19
+ }
20
+ @Test
21
+ public void test3() {
22
+ assertEquals(true, findSafeWalk(new ArrayList<>(Arrays.asList(new ArrayList<>(Arrays.asList(1,1,1)),new ArrayList<>(Arrays.asList(1,0,1)),new ArrayList<>(Arrays.asList(1,1,1)))), 5));
23
+ }
24
+
25
+ }
find_a_safe_walk_through_a_grid/meta.json ADDED
The diff for this file is too large to render. See raw diff
 
find_a_safe_walk_through_a_grid/ocaml_tests/main.ml ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ module Main = struct
3
+ open OUnit2
4
+
5
+ (* Program start *)
6
+
7
+ (* Program end *)
8
+
9
+ (* Test cases *)
10
+
11
+ let test1 _ = assert_equal true (findSafeWalk [[0;1;0;0;0];[0;1;0;1;0];[0;0;0;1;0]] 1)
12
+
13
+ let test2 _ = assert_equal false (findSafeWalk [[0;1;1;0;0;0];[1;0;1;0;0;0];[0;1;1;1;0;1];[0;0;1;0;1;0]] 3)
14
+
15
+ let test3 _ = assert_equal true (findSafeWalk [[1;1;1];[1;0;1];[1;1;1]] 5)
16
+
17
+ let test4 _ = assert_equal false (findSafeWalk [[1; 1; 1; 0; 0; 0; 0; 1; 1; 1; 0; 0; 1; 1]; [0; 1; 0; 0; 0; 0; 0; 0; 0; 1; 1; 0; 1; 0]; [0; 0; 1; 1; 1; 0; 0; 0; 1; 1; 1; 1; 0; 1]; [0; 0; 0; 1; 0; 1; 1; 1; 1; 1; 1; 1; 0; 1]; [0; 1; 0; 0; 1; 0; 1; 1; 1; 0; 0; 1; 0; 1]; [0; 1; 1; 1; 1; 1; 1; 0; 0; 0; 1; 1; 0; 0]; [0; 0; 1; 0; 0; 0; 0; 1; 0; 1; 0; 0; 0; 1]; [0; 0; 1; 0; 1; 1; 0; 1; 1; 1; 1; 1; 1; 1]; [0; 0; 1; 0; 0; 1; 1; 1; 1; 0; 0; 0; 0; 0]; [0; 0; 1; 1; 1; 1; 0; 0; 1; 0; 0; 1; 0; 0]; [1; 1; 0; 0; 1; 1; 1; 1; 0; 0; 1; 0; 0; 0]; [1; 0; 0; 0; 0; 1; 1; 1; 1; 0; 1; 0; 0; 1]; [0; 1; 0; 1; 1; 0; 0; 0; 1; 0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; 0; 0; 1; 0; 0; 1; 1; 1; 0]; [0; 0; 0; 0; 0; 1; 1; 1; 0; 0; 1; 0; 0; 0; 0; 1; 0; 0; 0; 0; 0; 0; 1; 0]; [1; 1; 1; 0; 1; 0; 1; 0; 0; 1; 1; 1; 1; 0; 0; 1; 0; 0; 0; 1; 1; 0; 1; 1]; [1; 1; 1; 1; 1; 0; 0; 0; 0; 0; 1; 1; 1; 0; 0; 0; 1; 1; 0; 1; 0; 1; 1; 1]; [0; 1; 0; 0; 1; 0; 1; 1; 0; 1; 1; 0; 1; 1; 1; 0; 0; 0; 1; 0; 0; 0; 1; 1]; [1; 1; 0; 1; 0; 1; 0; 1; 0; 0; 0; 1; 0; 0; 1; 1; 1; 1; 1; 0; 1; 1; 1; 1]; [1; 1; 1; 1; 0; 1; 1; 0; 1; 0; 1; 0; 1; 0; 0; 0; 1; 0; 1; 1; 0; 0; 1; 1]; [1; 1; 0; 0; 0; 1; 0; 0; 0; 0; 0; 1; 1; 1; 1; 1; 1; 0; 0; 0; 0; 1; 0; 1]; [1; 0; 1; 0; 1; 0; 0; 1; 0; 1; 0; 1; 0; 1; 1; 1; 1; 0; 0; 1; 1; 1; 1; 0]; [0; 1; 1; 1; 0; 1; 0; 0; 1; 1; 0; 0; 0; 0; 0; 1; 1; 0; 0; 0; 1; 1; 1; 1]] 1)
30
+
31
+
32
+ (* Grouping test cases *)
33
+ let suite = "Test Suite for findSafeWalk" >::: [
34
+
35
+ "test1" >:: test1;
36
+ "test2" >:: test2;
37
+ "test3" >:: test3;
38
+ "test4" >:: test4;
39
+ "test5" >:: test5;
40
+ "test6" >:: test6;
41
+ "test7" >:: test7;
42
+ "test8" >:: test8;
43
+ "test9" >:: test9;
44
+ "test10" >:: test10;
45
+ ]
46
+
47
+
48
+ (* Running the tests *)
49
+ let () = run_test_tt_main suite
50
+ end
find_a_safe_walk_through_a_grid/scala_tests/MySuite.scala ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ class MySuite extends munit.FunSuite {
3
+
4
+ test("test1") {
5
+ assertEquals(Main.findSafeWalk(List(List(0,1,0,0,0),List(0,1,0,1,0),List(0,0,0,1,0)),1), true)
6
+ }
7
+
8
+ test("test2") {
9
+ assertEquals(Main.findSafeWalk(List(List(0,1,1,0,0,0),List(1,0,1,0,0,0),List(0,1,1,1,0,1),List(0,0,1,0,1,0)),3), false)
10
+ }
11
+
12
+ test("test3") {
13
+ assertEquals(Main.findSafeWalk(List(List(1,1,1),List(1,0,1),List(1,1,1)),5), true)
14
+ }
15
+
16
+ test("test4") {
17
+ assertEquals(Main.findSafeWalk(List(List(1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1), List(0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0), List(0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 0, 1), List(0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1), List(0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1), List(0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0), List(0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1), List(0, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1), List(0, 0, 1, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0), List(0, 0, 1, 1, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0), List(1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0), List(1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 1, 0, 0, 1), List(0, 1, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1), List(0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1), List(1, 1, 1, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1), List(1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 0, 0, 1, 0), List(1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0), List(1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1), List(1, 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 0, 1, 0), List(0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1), List(1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 1, 1, 0, 0), List(0, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0), List(0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0), List(1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0), List(0, 0, 1, 1, 0, 1, 0, 1, 0, 0, 1, 1, 0, 1), List(0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1), List(1, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 1), List(1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0), List(0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1)),1), false)
18
+ }
19
+
20
+ test("test5") {
21
+ assertEquals(Main.findSafeWalk(List(List(1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0), List(0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 1, 1, 1), List(1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1), List(0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 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, 1, 1, 1, 1, 1, 1), List(0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 1, 0, 0, 0, 0, 1, 1, 0), List(1, 1, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0)),3), false)
26
+ }
27
+
28
+ test("test7") {
29
+ assertEquals(Main.findSafeWalk(List(List(0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0), List(0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 1), List(1, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 0, 0, 1)),1), false)
30
+ }
31
+
32
+ test("test8") {
33
+ assertEquals(Main.findSafeWalk(List(List(1, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 0), List(0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1), List(1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0,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0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0), List(0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0), List(1, 1, 1, 0, 1, 0, 1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 1), List(1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1, 0, 1, 1, 1), List(0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1), List(1, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1), List(1, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1), List(1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 1), List(1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0), List(0, 1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1)),1), false)
42
+ }
43
+
44
+ }
find_all_good_indices/.DS_Store ADDED
Binary file (6.15 kB). View file
 
find_all_good_indices/haskell_tests/Main.hs ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ module Main where
3
+ import Test.HUnit
4
+
5
+ --Program start
6
+
7
+ --Program end
8
+
9
+ -- Test cases
10
+
11
+ test1 :: Test
12
+ test1 = TestCase (assertEqual "for (goodIndices [2,1,1,1,3,4,1] 2)," [2,3] (goodIndices [2,1,1,1,3,4,1] 2))
13
+
14
+ test2 :: Test
15
+ test2 = TestCase (assertEqual "for (goodIndices [2,1,1,2] 2)," [] (goodIndices [2,1,1,2] 2))
16
+
17
+
18
+ -- Grouping test cases
19
+ tests :: Test
20
+ tests = TestList [TestLabel "Test1" test1]
21
+
22
+ -- Running the tests
23
+ main :: IO Counts
24
+ main = runTestTT tests
find_all_good_indices/java_tests/Main.java ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import static org.junit.jupiter.api.Assertions.*;
3
+ import org.junit.jupiter.api.Test;
4
+ import java.util.List;
5
+ import java.util.Arrays;
6
+ import java.util.ArrayList;
7
+ public class Main {
8
+ //Program start
9
+
10
+ //Program end
11
+
12
+ @Test
13
+ public void test1() {
14
+ assertEquals(new ArrayList<>(Arrays.asList(2,3)), goodIndices(new ArrayList<>(Arrays.asList(2,1,1,1,3,4,1)), 2));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals([], goodIndices(new ArrayList<>(Arrays.asList(2,1,1,2)), 2));
19
+ }
20
+
21
+ }
find_all_good_indices/meta.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c7cec0ed9e824baa874423f7563156d5d945d55db2b8ca680a12b120243800a3
3
+ size 14673032
find_all_good_indices/ocaml_tests/main.ml ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ module Main = struct
3
+ open OUnit2
4
+
5
+ (* Program start *)
6
+
7
+ (* Program end *)
8
+
9
+ (* Test cases *)
10
+
11
+ let test1 _ = assert_equal [2;3] (goodIndices [2;1;1;1;3;4;1] 2)
12
+
13
+ let test2 _ = assert_equal [] (goodIndices [2;1;1;2] 2)
14
+
15
+
16
+ (* Grouping test cases *)
17
+ let suite = "Test Suite for goodIndices" >::: [
18
+
19
+ "test1" >:: test1;
20
+ "test2" >:: test2;
21
+ ]
22
+
23
+
24
+ (* Running the tests *)
25
+ let () = run_test_tt_main suite
26
+ end
find_all_good_indices/scala_tests/MySuite.scala ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ class MySuite extends munit.FunSuite {
3
+
4
+ test("test1") {
5
+ assertEquals(Main.goodIndices(List(2,1,1,1,3,4,1),2), List(2,3))
6
+ }
7
+
8
+ test("test2") {
9
+ assertEquals(Main.goodIndices(List(2,1,1,2),2), List())
10
+ }
11
+
12
+ }
find_all_k_distant_indices_in_an_array/.DS_Store ADDED
Binary file (6.15 kB). View file
 
find_all_k_distant_indices_in_an_array/haskell_tests/Main.hs ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ module Main where
3
+ import Test.HUnit
4
+
5
+ --Program start
6
+
7
+ --Program end
8
+
9
+ -- Test cases
10
+
11
+ test1 :: Test
12
+ test1 = TestCase (assertEqual "for (findKDistantIndices [3,4,9,1,3,9,5] 9 1)," [1,2,3,4,5,6] (findKDistantIndices [3,4,9,1,3,9,5] 9 1))
13
+
14
+ test2 :: Test
15
+ test2 = TestCase (assertEqual "for (findKDistantIndices [2,2,2,2,2] 2 2)," [0,1,2,3,4] (findKDistantIndices [2,2,2,2,2] 2 2))
16
+
17
+
18
+ -- Grouping test cases
19
+ tests :: Test
20
+ tests = TestList [TestLabel "Test1" test1]
21
+
22
+ -- Running the tests
23
+ main :: IO Counts
24
+ main = runTestTT tests
find_all_k_distant_indices_in_an_array/java_tests/Main.java ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import static org.junit.jupiter.api.Assertions.*;
3
+ import org.junit.jupiter.api.Test;
4
+ import java.util.List;
5
+ import java.util.Arrays;
6
+ import java.util.ArrayList;
7
+ public class Main {
8
+ //Program start
9
+
10
+ //Program end
11
+
12
+ @Test
13
+ public void test1() {
14
+ assertEquals(new ArrayList<>(Arrays.asList(1,2,3,4,5,6)), findKDistantIndices(new ArrayList<>(Arrays.asList(3,4,9,1,3,9,5)), 9, 1));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals(new ArrayList<>(Arrays.asList(0,1,2,3,4)), findKDistantIndices(new ArrayList<>(Arrays.asList(2,2,2,2,2)), 2, 2));
19
+ }
20
+
21
+ }
find_all_k_distant_indices_in_an_array/meta.json ADDED
The diff for this file is too large to render. See raw diff
 
find_all_k_distant_indices_in_an_array/ocaml_tests/main.ml ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ module Main = struct
3
+ open OUnit2
4
+
5
+ (* Program start *)
6
+
7
+ (* Program end *)
8
+
9
+ (* Test cases *)
10
+
11
+ let test1 _ = assert_equal [1;2;3;4;5;6] (findKDistantIndices [3;4;9;1;3;9;5] 9 1)
12
+
13
+ let test2 _ = assert_equal [0;1;2;3;4] (findKDistantIndices [2;2;2;2;2] 2 2)
14
+
15
+
16
+ (* Grouping test cases *)
17
+ let suite = "Test Suite for findKDistantIndices" >::: [
18
+
19
+ "test1" >:: test1;
20
+ "test2" >:: test2;
21
+ ]
22
+
23
+
24
+ (* Running the tests *)
25
+ let () = run_test_tt_main suite
26
+ end
find_all_k_distant_indices_in_an_array/scala_tests/MySuite.scala ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ class MySuite extends munit.FunSuite {
3
+
4
+ test("test1") {
5
+ assertEquals(Main.findKDistantIndices(List(3,4,9,1,3,9,5),9,1), List(1,2,3,4,5,6))
6
+ }
7
+
8
+ test("test2") {
9
+ assertEquals(Main.findKDistantIndices(List(2,2,2,2,2),2,2), List(0,1,2,3,4))
10
+ }
11
+
12
+ }
find_all_possible_stable_binary_arrays_i/haskell_tests/Main.hs ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ module Main where
3
+ import Test.HUnit
4
+
5
+ --Program start
6
+
7
+ --Program end
8
+
9
+ -- Test cases
10
+
11
+ test1 :: Test
12
+ test1 = TestCase (assertEqual "for (numberOfStableArrays 1 1 2)," 2 (numberOfStableArrays 1 1 2))
13
+
14
+ test2 :: Test
15
+ test2 = TestCase (assertEqual "for (numberOfStableArrays 1 2 1)," 1 (numberOfStableArrays 1 2 1))
16
+
17
+ test3 :: Test
18
+ test3 = TestCase (assertEqual "for (numberOfStableArrays 3 3 2)," 14 (numberOfStableArrays 3 3 2))
19
+
20
+ test4 :: Test
21
+ test4 = TestCase (assertEqual "for (numberOfStableArrays 185 61 88)," 860864455 (numberOfStableArrays 185 61 88))
22
+
23
+ test5 :: Test
24
+ test5 = TestCase (assertEqual "for (numberOfStableArrays 172 150 92)," 586645212 (numberOfStableArrays 172 150 92))
25
+
26
+ test6 :: Test
27
+ test6 = TestCase (assertEqual "for (numberOfStableArrays 164 135 131)," 656024746 (numberOfStableArrays 164 135 131))
28
+
29
+ test7 :: Test
30
+ test7 = TestCase (assertEqual "for (numberOfStableArrays 43 100 72)," 662247922 (numberOfStableArrays 43 100 72))
31
+
32
+ test8 :: Test
33
+ test8 = TestCase (assertEqual "for (numberOfStableArrays 177 160 175)," 242710847 (numberOfStableArrays 177 160 175))
34
+
35
+ test9 :: Test
36
+ test9 = TestCase (assertEqual "for (numberOfStableArrays 39 37 127)," 47480935 (numberOfStableArrays 39 37 127))
37
+
38
+
39
+ -- Grouping test cases
40
+ tests :: Test
41
+ tests = TestList [TestLabel "Test1" test1, TestLabel "Test2" test2, TestLabel "Test3" test3, TestLabel "Test4" test4, TestLabel "Test5" test5, TestLabel "Test6" test6, TestLabel "Test7" test7, TestLabel "Test8" test8, TestLabel "Test9" test9]
42
+
43
+ -- Running the tests
44
+ main :: IO Counts
45
+ main = runTestTT tests
find_all_possible_stable_binary_arrays_i/java_tests/Main.java ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import static org.junit.jupiter.api.Assertions.*;
3
+ import org.junit.jupiter.api.Test;
4
+ import java.util.List;
5
+ import java.util.Arrays;
6
+ import java.util.ArrayList;
7
+ public class Main {
8
+ //Program start
9
+
10
+ //Program end
11
+
12
+ @Test
13
+ public void test1() {
14
+ assertEquals(2, numberOfStableArrays(1, 1, 2));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals(1, numberOfStableArrays(1, 2, 1));
19
+ }
20
+ @Test
21
+ public void test3() {
22
+ assertEquals(14, numberOfStableArrays(3, 3, 2));
23
+ }
24
+
25
+ }