76beca8b91163d201b98ba1949b7709c095718eced70f58e1d134245783b2a54
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- .gitattributes +1 -0
- sorting_three_groups/meta.json +647 -0
- sorting_three_groups/ocaml_tests/main.ml +29 -0
- sorting_three_groups/scala_tests/MySuite.scala +16 -0
- special_array_i/haskell_tests/Main.hs +44 -0
- special_array_i/java_tests/Main.java +24 -0
- special_array_i/meta.json +284 -0
- special_array_i/ocaml_tests/main.ml +45 -0
- special_array_i/scala_tests/MySuite.scala +36 -0
- special_array_ii/java_tests/Main.java +21 -0
- special_permutations/haskell_tests/Main.hs +41 -0
- special_permutations/java_tests/Main.java +20 -0
- special_permutations/meta.json +110 -0
- special_permutations/ocaml_tests/main.ml +42 -0
- special_permutations/scala_tests/MySuite.scala +32 -0
- split_array_into_maximum_number_of_subarrays/haskell_tests/Main.hs +0 -0
- split_array_into_maximum_number_of_subarrays/java_tests/Main.java +20 -0
- split_array_into_maximum_number_of_subarrays/meta.json +0 -0
- split_array_into_maximum_number_of_subarrays/ocaml_tests/main.ml +0 -0
- split_array_into_maximum_number_of_subarrays/scala_tests/MySuite.scala +0 -0
- split_the_array/haskell_tests/Main.hs +41 -0
- split_the_array/java_tests/Main.java +20 -0
- split_the_array/meta.json +330 -0
- split_the_array/ocaml_tests/main.ml +42 -0
- split_the_array/scala_tests/MySuite.scala +32 -0
- split_the_array_to_make_coprime_products/.DS_Store +0 -0
- split_the_array_to_make_coprime_products/haskell_tests/Main.hs +24 -0
- split_the_array_to_make_coprime_products/java_tests/Main.java +21 -0
- split_the_array_to_make_coprime_products/meta.json +0 -0
- split_the_array_to_make_coprime_products/ocaml_tests/main.ml +26 -0
- split_the_array_to_make_coprime_products/scala_tests/MySuite.scala +12 -0
- steps_to_make_array_non_decreasing/haskell_tests/Main.hs +0 -0
- steps_to_make_array_non_decreasing/java_tests/Main.java +21 -0
- steps_to_make_array_non_decreasing/meta.json +3 -0
- steps_to_make_array_non_decreasing/ocaml_tests/main.ml +0 -0
- steps_to_make_array_non_decreasing/scala_tests/MySuite.scala +0 -0
- string_compression_iii/haskell_tests/Main.hs +0 -0
- string_compression_iii/java_tests/Main.java +20 -0
- string_compression_iii/meta.json +0 -0
- string_compression_iii/ocaml_tests/main.ml +0 -0
- string_compression_iii/scala_tests/MySuite.scala +0 -0
- string_transformation/haskell_tests/Main.hs +0 -0
- string_transformation/java_tests/Main.java +21 -0
- string_transformation/meta.json +0 -0
- string_transformation/ocaml_tests/main.ml +0 -0
- string_transformation/scala_tests/MySuite.scala +0 -0
- strong_password_checker_ii/haskell_tests/Main.hs +44 -0
- strong_password_checker_ii/java_tests/Main.java +24 -0
- strong_password_checker_ii/meta.json +52 -0
- strong_password_checker_ii/ocaml_tests/main.ml +45 -0
.gitattributes
CHANGED
|
@@ -280,3 +280,4 @@ sliding_subarray_beauty/meta.json filter=lfs diff=lfs merge=lfs -text
|
|
| 280 |
smallest_missing_non_negative_integer_after_operations/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 281 |
solving_questions_with_brainpower/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 282 |
sorted_gcd_pair_queries/meta.json filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 280 |
smallest_missing_non_negative_integer_after_operations/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 281 |
solving_questions_with_brainpower/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 282 |
sorted_gcd_pair_queries/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 283 |
+
steps_to_make_array_non_decreasing/meta.json filter=lfs diff=lfs merge=lfs -text
|
sorting_three_groups/meta.json
ADDED
|
@@ -0,0 +1,647 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"id": 2904,
|
| 3 |
+
"name": "sorting_three_groups",
|
| 4 |
+
"difficulty": "Medium",
|
| 5 |
+
"link": "https://leetcode.com/problems/sorting-three-groups/",
|
| 6 |
+
"date": "1691193600000",
|
| 7 |
+
"task_description": "You are given an integer array `nums`. Each element in `nums` is 1, 2 or 3. In each operation, you can remove an element from `nums`. Return the **minimum** number of operations to make `nums` **non-decreasing**. **Example 1:** **Input:** nums = [2,1,3,2,1] **Output:** 3 **Explanation:** One of the optimal solutions is to remove `nums[0]`, `nums[2]` and `nums[3]`. **Example 2:** **Input:** nums = [1,3,2,1,3,3] **Output:** 2 **Explanation:** One of the optimal solutions is to remove `nums[1]` and `nums[2]`. **Example 3:** **Input:** nums = [2,2,2,2,3,3] **Output:** 0 **Explanation:** `nums` is already non-decreasing. **Constraints:** `1 <= nums.length <= 100` `1 <= nums[i] <= 3` **Follow-up:** Can you come up with an algorithm that runs in `O(n)` time complexity?",
|
| 8 |
+
"public_test_cases": [
|
| 9 |
+
{
|
| 10 |
+
"label": "Example 1",
|
| 11 |
+
"input": "nums = [2,1,3,2,1]",
|
| 12 |
+
"output": "3 "
|
| 13 |
+
},
|
| 14 |
+
{
|
| 15 |
+
"label": "Example 2",
|
| 16 |
+
"input": "nums = [1,3,2,1,3,3]",
|
| 17 |
+
"output": "2 "
|
| 18 |
+
},
|
| 19 |
+
{
|
| 20 |
+
"label": "Example 3",
|
| 21 |
+
"input": "nums = [2,2,2,2,3,3]",
|
| 22 |
+
"output": "0 "
|
| 23 |
+
}
|
| 24 |
+
],
|
| 25 |
+
"private_test_cases": [
|
| 26 |
+
{
|
| 27 |
+
"input": [
|
| 28 |
+
2,
|
| 29 |
+
1,
|
| 30 |
+
3,
|
| 31 |
+
3,
|
| 32 |
+
3,
|
| 33 |
+
3,
|
| 34 |
+
3,
|
| 35 |
+
2,
|
| 36 |
+
1,
|
| 37 |
+
2,
|
| 38 |
+
1,
|
| 39 |
+
1,
|
| 40 |
+
3,
|
| 41 |
+
2,
|
| 42 |
+
3,
|
| 43 |
+
1,
|
| 44 |
+
3,
|
| 45 |
+
3,
|
| 46 |
+
1,
|
| 47 |
+
2,
|
| 48 |
+
1,
|
| 49 |
+
1,
|
| 50 |
+
1,
|
| 51 |
+
2,
|
| 52 |
+
2,
|
| 53 |
+
3,
|
| 54 |
+
1,
|
| 55 |
+
1,
|
| 56 |
+
3,
|
| 57 |
+
1,
|
| 58 |
+
3,
|
| 59 |
+
1,
|
| 60 |
+
2,
|
| 61 |
+
1,
|
| 62 |
+
1,
|
| 63 |
+
1,
|
| 64 |
+
2,
|
| 65 |
+
2,
|
| 66 |
+
2,
|
| 67 |
+
2,
|
| 68 |
+
1,
|
| 69 |
+
3,
|
| 70 |
+
3,
|
| 71 |
+
1,
|
| 72 |
+
2,
|
| 73 |
+
1,
|
| 74 |
+
2,
|
| 75 |
+
3,
|
| 76 |
+
1,
|
| 77 |
+
1,
|
| 78 |
+
2,
|
| 79 |
+
2,
|
| 80 |
+
2,
|
| 81 |
+
3,
|
| 82 |
+
1,
|
| 83 |
+
1,
|
| 84 |
+
3,
|
| 85 |
+
2,
|
| 86 |
+
2,
|
| 87 |
+
1,
|
| 88 |
+
2,
|
| 89 |
+
2,
|
| 90 |
+
3,
|
| 91 |
+
1,
|
| 92 |
+
2,
|
| 93 |
+
2
|
| 94 |
+
],
|
| 95 |
+
"output": 35
|
| 96 |
+
},
|
| 97 |
+
{
|
| 98 |
+
"input": [
|
| 99 |
+
2,
|
| 100 |
+
3,
|
| 101 |
+
1,
|
| 102 |
+
2,
|
| 103 |
+
3,
|
| 104 |
+
3,
|
| 105 |
+
2,
|
| 106 |
+
3,
|
| 107 |
+
1,
|
| 108 |
+
1,
|
| 109 |
+
1,
|
| 110 |
+
3,
|
| 111 |
+
1,
|
| 112 |
+
3,
|
| 113 |
+
3,
|
| 114 |
+
3,
|
| 115 |
+
2,
|
| 116 |
+
1,
|
| 117 |
+
1,
|
| 118 |
+
3,
|
| 119 |
+
1,
|
| 120 |
+
1,
|
| 121 |
+
3,
|
| 122 |
+
2,
|
| 123 |
+
2,
|
| 124 |
+
1,
|
| 125 |
+
3,
|
| 126 |
+
2,
|
| 127 |
+
2,
|
| 128 |
+
2,
|
| 129 |
+
1,
|
| 130 |
+
2,
|
| 131 |
+
3,
|
| 132 |
+
2,
|
| 133 |
+
1,
|
| 134 |
+
1,
|
| 135 |
+
3,
|
| 136 |
+
3,
|
| 137 |
+
2,
|
| 138 |
+
1,
|
| 139 |
+
2,
|
| 140 |
+
3,
|
| 141 |
+
3,
|
| 142 |
+
2,
|
| 143 |
+
2,
|
| 144 |
+
3,
|
| 145 |
+
3,
|
| 146 |
+
3,
|
| 147 |
+
2,
|
| 148 |
+
3,
|
| 149 |
+
3,
|
| 150 |
+
2,
|
| 151 |
+
3,
|
| 152 |
+
2,
|
| 153 |
+
1,
|
| 154 |
+
3,
|
| 155 |
+
1
|
| 156 |
+
],
|
| 157 |
+
"output": 30
|
| 158 |
+
},
|
| 159 |
+
{
|
| 160 |
+
"input": [
|
| 161 |
+
3,
|
| 162 |
+
2,
|
| 163 |
+
2,
|
| 164 |
+
2,
|
| 165 |
+
2,
|
| 166 |
+
1,
|
| 167 |
+
1,
|
| 168 |
+
1,
|
| 169 |
+
2,
|
| 170 |
+
3,
|
| 171 |
+
3,
|
| 172 |
+
1,
|
| 173 |
+
3,
|
| 174 |
+
3,
|
| 175 |
+
2,
|
| 176 |
+
1,
|
| 177 |
+
3,
|
| 178 |
+
1,
|
| 179 |
+
1,
|
| 180 |
+
1,
|
| 181 |
+
1,
|
| 182 |
+
2,
|
| 183 |
+
2,
|
| 184 |
+
2,
|
| 185 |
+
3,
|
| 186 |
+
2,
|
| 187 |
+
2,
|
| 188 |
+
2,
|
| 189 |
+
1,
|
| 190 |
+
1,
|
| 191 |
+
1,
|
| 192 |
+
2,
|
| 193 |
+
2,
|
| 194 |
+
2,
|
| 195 |
+
1,
|
| 196 |
+
1,
|
| 197 |
+
2,
|
| 198 |
+
3,
|
| 199 |
+
3,
|
| 200 |
+
2,
|
| 201 |
+
2,
|
| 202 |
+
3,
|
| 203 |
+
3,
|
| 204 |
+
3,
|
| 205 |
+
2,
|
| 206 |
+
2,
|
| 207 |
+
3,
|
| 208 |
+
1,
|
| 209 |
+
1,
|
| 210 |
+
3,
|
| 211 |
+
3,
|
| 212 |
+
3,
|
| 213 |
+
3,
|
| 214 |
+
1,
|
| 215 |
+
1,
|
| 216 |
+
2,
|
| 217 |
+
3,
|
| 218 |
+
3,
|
| 219 |
+
1,
|
| 220 |
+
1,
|
| 221 |
+
2,
|
| 222 |
+
1,
|
| 223 |
+
1,
|
| 224 |
+
3,
|
| 225 |
+
1,
|
| 226 |
+
2,
|
| 227 |
+
2,
|
| 228 |
+
2,
|
| 229 |
+
3,
|
| 230 |
+
3,
|
| 231 |
+
3,
|
| 232 |
+
3,
|
| 233 |
+
1,
|
| 234 |
+
3,
|
| 235 |
+
3,
|
| 236 |
+
1,
|
| 237 |
+
1,
|
| 238 |
+
2,
|
| 239 |
+
1,
|
| 240 |
+
1,
|
| 241 |
+
3,
|
| 242 |
+
2,
|
| 243 |
+
1,
|
| 244 |
+
2,
|
| 245 |
+
3
|
| 246 |
+
],
|
| 247 |
+
"output": 45
|
| 248 |
+
},
|
| 249 |
+
{
|
| 250 |
+
"input": [
|
| 251 |
+
2,
|
| 252 |
+
1,
|
| 253 |
+
2,
|
| 254 |
+
1,
|
| 255 |
+
3,
|
| 256 |
+
1,
|
| 257 |
+
3,
|
| 258 |
+
3,
|
| 259 |
+
2,
|
| 260 |
+
2,
|
| 261 |
+
1,
|
| 262 |
+
2,
|
| 263 |
+
3,
|
| 264 |
+
3,
|
| 265 |
+
3,
|
| 266 |
+
1,
|
| 267 |
+
3,
|
| 268 |
+
3,
|
| 269 |
+
1,
|
| 270 |
+
3,
|
| 271 |
+
2,
|
| 272 |
+
2,
|
| 273 |
+
3,
|
| 274 |
+
1,
|
| 275 |
+
3,
|
| 276 |
+
1,
|
| 277 |
+
1,
|
| 278 |
+
3,
|
| 279 |
+
2,
|
| 280 |
+
3,
|
| 281 |
+
2,
|
| 282 |
+
2,
|
| 283 |
+
2,
|
| 284 |
+
2,
|
| 285 |
+
2,
|
| 286 |
+
1,
|
| 287 |
+
3,
|
| 288 |
+
2,
|
| 289 |
+
1,
|
| 290 |
+
2,
|
| 291 |
+
3,
|
| 292 |
+
3,
|
| 293 |
+
2,
|
| 294 |
+
2,
|
| 295 |
+
1,
|
| 296 |
+
3,
|
| 297 |
+
2,
|
| 298 |
+
1,
|
| 299 |
+
3,
|
| 300 |
+
1,
|
| 301 |
+
2,
|
| 302 |
+
2,
|
| 303 |
+
3,
|
| 304 |
+
3,
|
| 305 |
+
3,
|
| 306 |
+
2,
|
| 307 |
+
1,
|
| 308 |
+
2
|
| 309 |
+
],
|
| 310 |
+
"output": 33
|
| 311 |
+
},
|
| 312 |
+
{
|
| 313 |
+
"input": [
|
| 314 |
+
2,
|
| 315 |
+
1,
|
| 316 |
+
2,
|
| 317 |
+
2,
|
| 318 |
+
3,
|
| 319 |
+
2,
|
| 320 |
+
3,
|
| 321 |
+
3,
|
| 322 |
+
2,
|
| 323 |
+
3,
|
| 324 |
+
2,
|
| 325 |
+
2,
|
| 326 |
+
3
|
| 327 |
+
],
|
| 328 |
+
"output": 5
|
| 329 |
+
},
|
| 330 |
+
{
|
| 331 |
+
"input": [
|
| 332 |
+
1,
|
| 333 |
+
3,
|
| 334 |
+
2,
|
| 335 |
+
1,
|
| 336 |
+
1,
|
| 337 |
+
3,
|
| 338 |
+
3,
|
| 339 |
+
1,
|
| 340 |
+
1,
|
| 341 |
+
2,
|
| 342 |
+
1,
|
| 343 |
+
3,
|
| 344 |
+
2,
|
| 345 |
+
3,
|
| 346 |
+
2,
|
| 347 |
+
1,
|
| 348 |
+
3,
|
| 349 |
+
1,
|
| 350 |
+
1,
|
| 351 |
+
1,
|
| 352 |
+
1,
|
| 353 |
+
1,
|
| 354 |
+
1,
|
| 355 |
+
1,
|
| 356 |
+
2,
|
| 357 |
+
1,
|
| 358 |
+
3,
|
| 359 |
+
2,
|
| 360 |
+
1,
|
| 361 |
+
2,
|
| 362 |
+
1,
|
| 363 |
+
1,
|
| 364 |
+
1,
|
| 365 |
+
3,
|
| 366 |
+
3,
|
| 367 |
+
2,
|
| 368 |
+
3,
|
| 369 |
+
1,
|
| 370 |
+
2,
|
| 371 |
+
3,
|
| 372 |
+
2,
|
| 373 |
+
2,
|
| 374 |
+
2,
|
| 375 |
+
2,
|
| 376 |
+
1
|
| 377 |
+
],
|
| 378 |
+
"output": 20
|
| 379 |
+
},
|
| 380 |
+
{
|
| 381 |
+
"input": [
|
| 382 |
+
2,
|
| 383 |
+
1,
|
| 384 |
+
1,
|
| 385 |
+
2,
|
| 386 |
+
1,
|
| 387 |
+
2,
|
| 388 |
+
1,
|
| 389 |
+
2,
|
| 390 |
+
3,
|
| 391 |
+
1,
|
| 392 |
+
3,
|
| 393 |
+
2,
|
| 394 |
+
2,
|
| 395 |
+
2,
|
| 396 |
+
2,
|
| 397 |
+
3,
|
| 398 |
+
3,
|
| 399 |
+
1,
|
| 400 |
+
3,
|
| 401 |
+
3,
|
| 402 |
+
2,
|
| 403 |
+
1,
|
| 404 |
+
2,
|
| 405 |
+
3,
|
| 406 |
+
3,
|
| 407 |
+
3,
|
| 408 |
+
2,
|
| 409 |
+
2,
|
| 410 |
+
1,
|
| 411 |
+
1,
|
| 412 |
+
1,
|
| 413 |
+
2,
|
| 414 |
+
1,
|
| 415 |
+
3,
|
| 416 |
+
2,
|
| 417 |
+
2,
|
| 418 |
+
3,
|
| 419 |
+
3,
|
| 420 |
+
1,
|
| 421 |
+
3,
|
| 422 |
+
1,
|
| 423 |
+
1,
|
| 424 |
+
3,
|
| 425 |
+
1,
|
| 426 |
+
2,
|
| 427 |
+
3,
|
| 428 |
+
3,
|
| 429 |
+
3,
|
| 430 |
+
2,
|
| 431 |
+
2,
|
| 432 |
+
1,
|
| 433 |
+
1,
|
| 434 |
+
3
|
| 435 |
+
],
|
| 436 |
+
"output": 28
|
| 437 |
+
},
|
| 438 |
+
{
|
| 439 |
+
"input": [
|
| 440 |
+
1,
|
| 441 |
+
2,
|
| 442 |
+
3,
|
| 443 |
+
1,
|
| 444 |
+
3,
|
| 445 |
+
3,
|
| 446 |
+
2,
|
| 447 |
+
2,
|
| 448 |
+
1,
|
| 449 |
+
2,
|
| 450 |
+
1,
|
| 451 |
+
2,
|
| 452 |
+
2,
|
| 453 |
+
2,
|
| 454 |
+
3,
|
| 455 |
+
2,
|
| 456 |
+
1,
|
| 457 |
+
2,
|
| 458 |
+
3,
|
| 459 |
+
3,
|
| 460 |
+
3,
|
| 461 |
+
3,
|
| 462 |
+
2,
|
| 463 |
+
1,
|
| 464 |
+
2,
|
| 465 |
+
2,
|
| 466 |
+
3,
|
| 467 |
+
2,
|
| 468 |
+
3,
|
| 469 |
+
1,
|
| 470 |
+
2,
|
| 471 |
+
3,
|
| 472 |
+
2,
|
| 473 |
+
3,
|
| 474 |
+
3,
|
| 475 |
+
1,
|
| 476 |
+
3,
|
| 477 |
+
2,
|
| 478 |
+
1,
|
| 479 |
+
1,
|
| 480 |
+
1,
|
| 481 |
+
3,
|
| 482 |
+
3,
|
| 483 |
+
2,
|
| 484 |
+
2,
|
| 485 |
+
3,
|
| 486 |
+
2,
|
| 487 |
+
3,
|
| 488 |
+
3,
|
| 489 |
+
2,
|
| 490 |
+
3,
|
| 491 |
+
3,
|
| 492 |
+
2,
|
| 493 |
+
3,
|
| 494 |
+
2,
|
| 495 |
+
3,
|
| 496 |
+
2,
|
| 497 |
+
1,
|
| 498 |
+
1,
|
| 499 |
+
2,
|
| 500 |
+
3,
|
| 501 |
+
3,
|
| 502 |
+
1,
|
| 503 |
+
1,
|
| 504 |
+
1,
|
| 505 |
+
3,
|
| 506 |
+
3,
|
| 507 |
+
2,
|
| 508 |
+
1,
|
| 509 |
+
3,
|
| 510 |
+
1,
|
| 511 |
+
2,
|
| 512 |
+
1,
|
| 513 |
+
3,
|
| 514 |
+
3,
|
| 515 |
+
3,
|
| 516 |
+
3,
|
| 517 |
+
1,
|
| 518 |
+
1,
|
| 519 |
+
3,
|
| 520 |
+
1,
|
| 521 |
+
2,
|
| 522 |
+
1,
|
| 523 |
+
2,
|
| 524 |
+
2,
|
| 525 |
+
1,
|
| 526 |
+
3,
|
| 527 |
+
1
|
| 528 |
+
],
|
| 529 |
+
"output": 48
|
| 530 |
+
},
|
| 531 |
+
{
|
| 532 |
+
"input": [
|
| 533 |
+
1,
|
| 534 |
+
1,
|
| 535 |
+
2,
|
| 536 |
+
1,
|
| 537 |
+
1,
|
| 538 |
+
3,
|
| 539 |
+
2,
|
| 540 |
+
1,
|
| 541 |
+
1,
|
| 542 |
+
1,
|
| 543 |
+
2,
|
| 544 |
+
1,
|
| 545 |
+
2,
|
| 546 |
+
1,
|
| 547 |
+
3,
|
| 548 |
+
1,
|
| 549 |
+
3,
|
| 550 |
+
1,
|
| 551 |
+
2,
|
| 552 |
+
1,
|
| 553 |
+
1,
|
| 554 |
+
1,
|
| 555 |
+
1,
|
| 556 |
+
1,
|
| 557 |
+
3,
|
| 558 |
+
2,
|
| 559 |
+
3,
|
| 560 |
+
3,
|
| 561 |
+
2,
|
| 562 |
+
1,
|
| 563 |
+
1,
|
| 564 |
+
2,
|
| 565 |
+
2,
|
| 566 |
+
2,
|
| 567 |
+
2,
|
| 568 |
+
2,
|
| 569 |
+
3,
|
| 570 |
+
2,
|
| 571 |
+
3,
|
| 572 |
+
3,
|
| 573 |
+
2,
|
| 574 |
+
2,
|
| 575 |
+
1,
|
| 576 |
+
2,
|
| 577 |
+
1,
|
| 578 |
+
3,
|
| 579 |
+
2,
|
| 580 |
+
2,
|
| 581 |
+
3,
|
| 582 |
+
2,
|
| 583 |
+
3,
|
| 584 |
+
1,
|
| 585 |
+
2,
|
| 586 |
+
3,
|
| 587 |
+
2,
|
| 588 |
+
3,
|
| 589 |
+
1,
|
| 590 |
+
2,
|
| 591 |
+
2,
|
| 592 |
+
3,
|
| 593 |
+
1,
|
| 594 |
+
1,
|
| 595 |
+
1,
|
| 596 |
+
3,
|
| 597 |
+
2,
|
| 598 |
+
1,
|
| 599 |
+
1,
|
| 600 |
+
3,
|
| 601 |
+
1,
|
| 602 |
+
2,
|
| 603 |
+
1,
|
| 604 |
+
3,
|
| 605 |
+
1,
|
| 606 |
+
3,
|
| 607 |
+
3,
|
| 608 |
+
2,
|
| 609 |
+
3,
|
| 610 |
+
2,
|
| 611 |
+
1,
|
| 612 |
+
1,
|
| 613 |
+
2,
|
| 614 |
+
1,
|
| 615 |
+
2
|
| 616 |
+
],
|
| 617 |
+
"output": 42
|
| 618 |
+
},
|
| 619 |
+
{
|
| 620 |
+
"input": [
|
| 621 |
+
1,
|
| 622 |
+
2,
|
| 623 |
+
2,
|
| 624 |
+
3,
|
| 625 |
+
2,
|
| 626 |
+
2,
|
| 627 |
+
1,
|
| 628 |
+
2,
|
| 629 |
+
2,
|
| 630 |
+
2,
|
| 631 |
+
2,
|
| 632 |
+
3,
|
| 633 |
+
1,
|
| 634 |
+
2,
|
| 635 |
+
3,
|
| 636 |
+
2,
|
| 637 |
+
2
|
| 638 |
+
],
|
| 639 |
+
"output": 5
|
| 640 |
+
}
|
| 641 |
+
],
|
| 642 |
+
"haskell_template": "minimumOperations :: [Int] -> Int\nminimumOperations nums ",
|
| 643 |
+
"ocaml_template": "let minimumOperations (nums: int list) : int = ",
|
| 644 |
+
"scala_template": "def minimumOperations(nums: List[Int]): Int = { \n \n}",
|
| 645 |
+
"java_template": "public static int minimumOperations(List<Integer> nums) {\n\n}",
|
| 646 |
+
"python_template": "class Solution(object):\n def minimumOperations(self, nums):\n \"\"\"\n :type nums: List[int]\n :rtype: int\n \"\"\"\n "
|
| 647 |
+
}
|
sorting_three_groups/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 (minimumOperations [2;1;3;2;1])
|
| 12 |
+
|
| 13 |
+
let test2 _ = assert_equal 2 (minimumOperations [1;3;2;1;3;3])
|
| 14 |
+
|
| 15 |
+
let test3 _ = assert_equal 0 (minimumOperations [2;2;2;2;3;3])
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
(* Grouping test cases *)
|
| 19 |
+
let suite = "Test Suite for minimumOperations" >::: [
|
| 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
|
sorting_three_groups/scala_tests/MySuite.scala
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
class MySuite extends munit.FunSuite {
|
| 3 |
+
|
| 4 |
+
test("test1") {
|
| 5 |
+
assertEquals(Main.minimumOperations(List(2,1,3,2,1)), 3)
|
| 6 |
+
}
|
| 7 |
+
|
| 8 |
+
test("test2") {
|
| 9 |
+
assertEquals(Main.minimumOperations(List(1,3,2,1,3,3)), 2)
|
| 10 |
+
}
|
| 11 |
+
|
| 12 |
+
test("test3") {
|
| 13 |
+
assertEquals(Main.minimumOperations(List(2,2,2,2,3,3)), 0)
|
| 14 |
+
}
|
| 15 |
+
|
| 16 |
+
}
|
special_array_i/haskell_tests/Main.hs
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
module Main where
|
| 3 |
+
import Test.HUnit
|
| 4 |
+
|
| 5 |
+
--Program start
|
| 6 |
+
isArraySpecial :: [Int] -> Bool
|
| 7 |
+
isArraySpecial nums = undefined
|
| 8 |
+
|
| 9 |
+
--Program end
|
| 10 |
+
|
| 11 |
+
-- Test cases
|
| 12 |
+
|
| 13 |
+
test1 :: Test
|
| 14 |
+
test1 = TestCase (assertEqual "for (isArraySpecial [1])," True (isArraySpecial [1]))
|
| 15 |
+
|
| 16 |
+
test2 :: Test
|
| 17 |
+
test2 = TestCase (assertEqual "for (isArraySpecial [2,1,4])," True (isArraySpecial [2,1,4]))
|
| 18 |
+
|
| 19 |
+
test3 :: Test
|
| 20 |
+
test3 = TestCase (assertEqual "for (isArraySpecial [4,3,1,6])," False (isArraySpecial [4,3,1,6]))
|
| 21 |
+
|
| 22 |
+
test4 :: Test
|
| 23 |
+
test4 = TestCase (assertEqual "for (isArraySpecial [46, 83, 12, 71, 62, 39, 54, 19, 88, 95, 72, 95, 6, 85, 16, 33, 22, 33, 42, 7, 50, 7, 50, 17, 34, 53, 32, 49, 62, 13, 2, 77, 10, 13])," True (isArraySpecial [46, 83, 12, 71, 62, 39, 54, 19, 88, 95, 72, 95, 6, 85, 16, 33, 22, 33, 42, 7, 50, 7, 50, 17, 34, 53, 32, 49, 62, 13, 2, 77, 10, 13]))
|
| 24 |
+
|
| 25 |
+
test5 :: Test
|
| 26 |
+
test5 = TestCase (assertEqual "for (isArraySpecial [52, 45, 36, 81, 80, 39, 46, 19, 38, 59, 14, 5, 96, 59, 62, 35, 42, 89, 88, 91, 56, 73, 4])," True (isArraySpecial [52, 45, 36, 81, 80, 39, 46, 19, 38, 59, 14, 5, 96, 59, 62, 35, 42, 89, 88, 91, 56, 73, 4]))
|
| 27 |
+
|
| 28 |
+
test6 :: Test
|
| 29 |
+
test6 = TestCase (assertEqual "for (isArraySpecial [78, 61, 30, 7, 6, 99, 12, 31, 100, 11, 12, 29, 90, 51, 68])," True (isArraySpecial [78, 61, 30, 7, 6, 99, 12, 31, 100, 11, 12, 29, 90, 51, 68]))
|
| 30 |
+
|
| 31 |
+
test7 :: Test
|
| 32 |
+
test7 = TestCase (assertEqual "for (isArraySpecial [10, 51, 68, 35, 64, 33, 4, 17, 18, 71, 78, 79, 40, 91, 70, 37, 46, 59, 100, 55, 96, 41, 22, 27, 94, 49, 14, 71, 70, 9, 12, 21, 50, 95, 60, 7, 2, 7, 58, 23, 96, 25, 62, 73, 12, 47, 78, 53, 16, 79, 62, 13, 70, 35, 62, 7, 10, 79, 12, 25, 28, 3, 78, 41, 54, 89, 90, 43, 20, 85, 8, 41, 68, 81, 14, 69, 100, 23, 36, 39, 90, 17, 64, 11, 82, 91, 50])," True (isArraySpecial [10, 51, 68, 35, 64, 33, 4, 17, 18, 71, 78, 79, 40, 91, 70, 37, 46, 59, 100, 55, 96, 41, 22, 27, 94, 49, 14, 71, 70, 9, 12, 21, 50, 95, 60, 7, 2, 7, 58, 23, 96, 25, 62, 73, 12, 47, 78, 53, 16, 79, 62, 13, 70, 35, 62, 7, 10, 79, 12, 25, 28, 3, 78, 41, 54, 89, 90, 43, 20, 85, 8, 41, 68, 81, 14, 69, 100, 23, 36, 39, 90, 17, 64, 11, 82, 91, 50]))
|
| 33 |
+
|
| 34 |
+
test8 :: Test
|
| 35 |
+
test8 = TestCase (assertEqual "for (isArraySpecial [32, 45, 8, 79, 60, 17, 62, 71, 36, 95, 72, 57, 48, 49, 8, 81, 86, 65, 74, 35, 94, 23, 26, 37, 74, 67, 4, 37, 58, 71, 80, 45, 64, 7, 98, 95, 98, 35, 36, 25, 74, 57, 64, 13, 22, 71, 80, 17, 90, 41, 42, 23, 70, 81, 74, 13, 84, 71, 54, 9, 90, 39, 100, 81, 70, 31, 44, 15])," True (isArraySpecial [32, 45, 8, 79, 60, 17, 62, 71, 36, 95, 72, 57, 48, 49, 8, 81, 86, 65, 74, 35, 94, 23, 26, 37, 74, 67, 4, 37, 58, 71, 80, 45, 64, 7, 98, 95, 98, 35, 36, 25, 74, 57, 64, 13, 22, 71, 80, 17, 90, 41, 42, 23, 70, 81, 74, 13, 84, 71, 54, 9, 90, 39, 100, 81, 70, 31, 44, 15]))
|
| 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
|
special_array_i/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, isArraySpecial(Arrays.asList(1)));
|
| 14 |
+
}
|
| 15 |
+
@Test
|
| 16 |
+
public void test2() {
|
| 17 |
+
assertEquals(true, isArraySpecial(Arrays.asList(2,1,4)));
|
| 18 |
+
}
|
| 19 |
+
@Test
|
| 20 |
+
public void test3() {
|
| 21 |
+
assertEquals(false, isArraySpecial(Arrays.asList(4,3,1,6)));
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
}
|
special_array_i/meta.json
ADDED
|
@@ -0,0 +1,284 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"id": 3429,
|
| 3 |
+
"name": "special_array_i",
|
| 4 |
+
"difficulty": "Easy",
|
| 5 |
+
"link": "https://leetcode.com/problems/special-array-i/",
|
| 6 |
+
"date": "2024-05-12 00:00:00",
|
| 7 |
+
"task_description": "An array is considered **special** if the _parity_ of every pair of adjacent elements is different. In other words, one element in each pair **must** be even, and the other **must** be odd. You are given an array of integers `nums`. Return `true` if `nums` is a **special** array, otherwise, return `false`. **Example 1:** **Input:** nums = [1] **Output:** true **Explanation:** There is only one element. So the answer is `true`. **Example 2:** **Input:** nums = [2,1,4] **Output:** true **Explanation:** There is only two pairs: `(2,1)` and `(1,4)`, and both of them contain numbers with different parity. So the answer is `true`. **Example 3:** **Input:** nums = [4,3,1,6] **Output:** false **Explanation:** `nums[1]` and `nums[2]` are both odd. So the answer is `false`. **Constraints:** `1 <= nums.length <= 100` `1 <= nums[i] <= 100`",
|
| 8 |
+
"public_test_cases": [
|
| 9 |
+
{
|
| 10 |
+
"label": "Example 1",
|
| 11 |
+
"input": "nums = [1]",
|
| 12 |
+
"output": "true "
|
| 13 |
+
},
|
| 14 |
+
{
|
| 15 |
+
"label": "Example 2",
|
| 16 |
+
"input": "nums = [2,1,4]",
|
| 17 |
+
"output": "true "
|
| 18 |
+
},
|
| 19 |
+
{
|
| 20 |
+
"label": "Example 3",
|
| 21 |
+
"input": "nums = [4,3,1,6]",
|
| 22 |
+
"output": "false "
|
| 23 |
+
}
|
| 24 |
+
],
|
| 25 |
+
"private_test_cases": [
|
| 26 |
+
{
|
| 27 |
+
"input": [
|
| 28 |
+
46,
|
| 29 |
+
83,
|
| 30 |
+
12,
|
| 31 |
+
71,
|
| 32 |
+
62,
|
| 33 |
+
39,
|
| 34 |
+
54,
|
| 35 |
+
19,
|
| 36 |
+
88,
|
| 37 |
+
95,
|
| 38 |
+
72,
|
| 39 |
+
95,
|
| 40 |
+
6,
|
| 41 |
+
85,
|
| 42 |
+
16,
|
| 43 |
+
33,
|
| 44 |
+
22,
|
| 45 |
+
33,
|
| 46 |
+
42,
|
| 47 |
+
7,
|
| 48 |
+
50,
|
| 49 |
+
7,
|
| 50 |
+
50,
|
| 51 |
+
17,
|
| 52 |
+
34,
|
| 53 |
+
53,
|
| 54 |
+
32,
|
| 55 |
+
49,
|
| 56 |
+
62,
|
| 57 |
+
13,
|
| 58 |
+
2,
|
| 59 |
+
77,
|
| 60 |
+
10,
|
| 61 |
+
13
|
| 62 |
+
],
|
| 63 |
+
"output": true
|
| 64 |
+
},
|
| 65 |
+
{
|
| 66 |
+
"input": [
|
| 67 |
+
52,
|
| 68 |
+
45,
|
| 69 |
+
36,
|
| 70 |
+
81,
|
| 71 |
+
80,
|
| 72 |
+
39,
|
| 73 |
+
46,
|
| 74 |
+
19,
|
| 75 |
+
38,
|
| 76 |
+
59,
|
| 77 |
+
14,
|
| 78 |
+
5,
|
| 79 |
+
96,
|
| 80 |
+
59,
|
| 81 |
+
62,
|
| 82 |
+
35,
|
| 83 |
+
42,
|
| 84 |
+
89,
|
| 85 |
+
88,
|
| 86 |
+
91,
|
| 87 |
+
56,
|
| 88 |
+
73,
|
| 89 |
+
4
|
| 90 |
+
],
|
| 91 |
+
"output": true
|
| 92 |
+
},
|
| 93 |
+
{
|
| 94 |
+
"input": [
|
| 95 |
+
78,
|
| 96 |
+
61,
|
| 97 |
+
30,
|
| 98 |
+
7,
|
| 99 |
+
6,
|
| 100 |
+
99,
|
| 101 |
+
12,
|
| 102 |
+
31,
|
| 103 |
+
100,
|
| 104 |
+
11,
|
| 105 |
+
12,
|
| 106 |
+
29,
|
| 107 |
+
90,
|
| 108 |
+
51,
|
| 109 |
+
68
|
| 110 |
+
],
|
| 111 |
+
"output": true
|
| 112 |
+
},
|
| 113 |
+
{
|
| 114 |
+
"input": [
|
| 115 |
+
10,
|
| 116 |
+
51,
|
| 117 |
+
68,
|
| 118 |
+
35,
|
| 119 |
+
64,
|
| 120 |
+
33,
|
| 121 |
+
4,
|
| 122 |
+
17,
|
| 123 |
+
18,
|
| 124 |
+
71,
|
| 125 |
+
78,
|
| 126 |
+
79,
|
| 127 |
+
40,
|
| 128 |
+
91,
|
| 129 |
+
70,
|
| 130 |
+
37,
|
| 131 |
+
46,
|
| 132 |
+
59,
|
| 133 |
+
100,
|
| 134 |
+
55,
|
| 135 |
+
96,
|
| 136 |
+
41,
|
| 137 |
+
22,
|
| 138 |
+
27,
|
| 139 |
+
94,
|
| 140 |
+
49,
|
| 141 |
+
14,
|
| 142 |
+
71,
|
| 143 |
+
70,
|
| 144 |
+
9,
|
| 145 |
+
12,
|
| 146 |
+
21,
|
| 147 |
+
50,
|
| 148 |
+
95,
|
| 149 |
+
60,
|
| 150 |
+
7,
|
| 151 |
+
2,
|
| 152 |
+
7,
|
| 153 |
+
58,
|
| 154 |
+
23,
|
| 155 |
+
96,
|
| 156 |
+
25,
|
| 157 |
+
62,
|
| 158 |
+
73,
|
| 159 |
+
12,
|
| 160 |
+
47,
|
| 161 |
+
78,
|
| 162 |
+
53,
|
| 163 |
+
16,
|
| 164 |
+
79,
|
| 165 |
+
62,
|
| 166 |
+
13,
|
| 167 |
+
70,
|
| 168 |
+
35,
|
| 169 |
+
62,
|
| 170 |
+
7,
|
| 171 |
+
10,
|
| 172 |
+
79,
|
| 173 |
+
12,
|
| 174 |
+
25,
|
| 175 |
+
28,
|
| 176 |
+
3,
|
| 177 |
+
78,
|
| 178 |
+
41,
|
| 179 |
+
54,
|
| 180 |
+
89,
|
| 181 |
+
90,
|
| 182 |
+
43,
|
| 183 |
+
20,
|
| 184 |
+
85,
|
| 185 |
+
8,
|
| 186 |
+
41,
|
| 187 |
+
68,
|
| 188 |
+
81,
|
| 189 |
+
14,
|
| 190 |
+
69,
|
| 191 |
+
100,
|
| 192 |
+
23,
|
| 193 |
+
36,
|
| 194 |
+
39,
|
| 195 |
+
90,
|
| 196 |
+
17,
|
| 197 |
+
64,
|
| 198 |
+
11,
|
| 199 |
+
82,
|
| 200 |
+
91,
|
| 201 |
+
50
|
| 202 |
+
],
|
| 203 |
+
"output": true
|
| 204 |
+
},
|
| 205 |
+
{
|
| 206 |
+
"input": [
|
| 207 |
+
32,
|
| 208 |
+
45,
|
| 209 |
+
8,
|
| 210 |
+
79,
|
| 211 |
+
60,
|
| 212 |
+
17,
|
| 213 |
+
62,
|
| 214 |
+
71,
|
| 215 |
+
36,
|
| 216 |
+
95,
|
| 217 |
+
72,
|
| 218 |
+
57,
|
| 219 |
+
48,
|
| 220 |
+
49,
|
| 221 |
+
8,
|
| 222 |
+
81,
|
| 223 |
+
86,
|
| 224 |
+
65,
|
| 225 |
+
74,
|
| 226 |
+
35,
|
| 227 |
+
94,
|
| 228 |
+
23,
|
| 229 |
+
26,
|
| 230 |
+
37,
|
| 231 |
+
74,
|
| 232 |
+
67,
|
| 233 |
+
4,
|
| 234 |
+
37,
|
| 235 |
+
58,
|
| 236 |
+
71,
|
| 237 |
+
80,
|
| 238 |
+
45,
|
| 239 |
+
64,
|
| 240 |
+
7,
|
| 241 |
+
98,
|
| 242 |
+
95,
|
| 243 |
+
98,
|
| 244 |
+
35,
|
| 245 |
+
36,
|
| 246 |
+
25,
|
| 247 |
+
74,
|
| 248 |
+
57,
|
| 249 |
+
64,
|
| 250 |
+
13,
|
| 251 |
+
22,
|
| 252 |
+
71,
|
| 253 |
+
80,
|
| 254 |
+
17,
|
| 255 |
+
90,
|
| 256 |
+
41,
|
| 257 |
+
42,
|
| 258 |
+
23,
|
| 259 |
+
70,
|
| 260 |
+
81,
|
| 261 |
+
74,
|
| 262 |
+
13,
|
| 263 |
+
84,
|
| 264 |
+
71,
|
| 265 |
+
54,
|
| 266 |
+
9,
|
| 267 |
+
90,
|
| 268 |
+
39,
|
| 269 |
+
100,
|
| 270 |
+
81,
|
| 271 |
+
70,
|
| 272 |
+
31,
|
| 273 |
+
44,
|
| 274 |
+
15
|
| 275 |
+
],
|
| 276 |
+
"output": true
|
| 277 |
+
}
|
| 278 |
+
],
|
| 279 |
+
"haskell_template": "isArraySpecial :: [Int] -> Bool\nisArraySpecial nums ",
|
| 280 |
+
"ocaml_template": "let isArraySpecial (nums: int list) : bool = ",
|
| 281 |
+
"scala_template": "def isArraySpecial(nums: List[Int]): Boolean = { \n \n}",
|
| 282 |
+
"java_template": "class Solution {\n public boolean isArraySpecial(int[] nums) {\n \n }\n}",
|
| 283 |
+
"python_template": "class Solution(object):\n def isArraySpecial(self, nums):\n \"\"\"\n :type nums: List[int]\n :rtype: bool\n \"\"\"\n "
|
| 284 |
+
}
|
special_array_i/ocaml_tests/main.ml
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
module Main = struct
|
| 3 |
+
open OUnit2
|
| 4 |
+
|
| 5 |
+
(* Program start *)
|
| 6 |
+
let isArraySpecial (nums: int list) : bool = failwith "Not implemented"
|
| 7 |
+
|
| 8 |
+
(* Program end *)
|
| 9 |
+
|
| 10 |
+
(* Test cases *)
|
| 11 |
+
|
| 12 |
+
let test1 _ = assert_equal true (isArraySpecial [1])
|
| 13 |
+
|
| 14 |
+
let test2 _ = assert_equal true (isArraySpecial [2;1;4])
|
| 15 |
+
|
| 16 |
+
let test3 _ = assert_equal false (isArraySpecial [4;3;1;6])
|
| 17 |
+
|
| 18 |
+
let test4 _ = assert_equal false (isArraySpecial [46; 83; 12; 71; 62; 39; 54; 19; 88; 95; 72; 95; 6; 85; 16; 33; 22; 33; 42; 7; 50; 7; 50; 17; 34; 53; 32; 49; 62; 13; 2; 77; 10; 13])
|
| 19 |
+
|
| 20 |
+
let test5 _ = assert_equal false (isArraySpecial [52; 45; 36; 81; 80; 39; 46; 19; 38; 59; 14; 5; 96; 59; 62; 35; 42; 89; 88; 91; 56; 73; 4])
|
| 21 |
+
|
| 22 |
+
let test6 _ = assert_equal false (isArraySpecial [78; 61; 30; 7; 6; 99; 12; 31; 100; 11; 12; 29; 90; 51; 68])
|
| 23 |
+
|
| 24 |
+
let test7 _ = assert_equal false (isArraySpecial [10; 51; 68; 35; 64; 33; 4; 17; 18; 71; 78; 79; 40; 91; 70; 37; 46; 59; 100; 55; 96; 41; 22; 27; 94; 49; 14; 71; 70; 9; 12; 21; 50; 95; 60; 7; 2; 7; 58; 23; 96; 25; 62; 73; 12; 47; 78; 53; 16; 79; 62; 13; 70; 35; 62; 7; 10; 79; 12; 25; 28; 3; 78; 41; 54; 89; 90; 43; 20; 85; 8; 41; 68; 81; 14; 69; 100; 23; 36; 39; 90; 17; 64; 11; 82; 91; 50])
|
| 25 |
+
|
| 26 |
+
let test8 _ = assert_equal false (isArraySpecial [32; 45; 8; 79; 60; 17; 62; 71; 36; 95; 72; 57; 48; 49; 8; 81; 86; 65; 74; 35; 94; 23; 26; 37; 74; 67; 4; 37; 58; 71; 80; 45; 64; 7; 98; 95; 98; 35; 36; 25; 74; 57; 64; 13; 22; 71; 80; 17; 90; 41; 42; 23; 70; 81; 74; 13; 84; 71; 54; 9; 90; 39; 100; 81; 70; 31; 44; 15])
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
(* Grouping test cases *)
|
| 30 |
+
let suite = "Test Suite for isArraySpecial" >::: [
|
| 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
|
special_array_i/scala_tests/MySuite.scala
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
class MySuite extends munit.FunSuite {
|
| 3 |
+
|
| 4 |
+
test("test1") {
|
| 5 |
+
assertEquals(Main.isArraySpecial(List(1)), true)
|
| 6 |
+
}
|
| 7 |
+
|
| 8 |
+
test("test2") {
|
| 9 |
+
assertEquals(Main.isArraySpecial(List(2,1,4)), true)
|
| 10 |
+
}
|
| 11 |
+
|
| 12 |
+
test("test3") {
|
| 13 |
+
assertEquals(Main.isArraySpecial(List(4,3,1,6)), false)
|
| 14 |
+
}
|
| 15 |
+
|
| 16 |
+
test("test4") {
|
| 17 |
+
assertEquals(Main.isArraySpecial(46,83,12,71,62,39,54,19,88,95,72,95,6,85,16,33,22,33,42,7,50,7,50,17,34,53,32,49,62,13,2,77,10,13), true)
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
test("test5") {
|
| 21 |
+
assertEquals(Main.isArraySpecial(52,45,36,81,80,39,46,19,38,59,14,5,96,59,62,35,42,89,88,91,56,73,4), true)
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
test("test6") {
|
| 25 |
+
assertEquals(Main.isArraySpecial(78,61,30,7,6,99,12,31,100,11,12,29,90,51,68), true)
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
test("test7") {
|
| 29 |
+
assertEquals(Main.isArraySpecial(10,51,68,35,64,33,4,17,18,71,78,79,40,91,70,37,46,59,100,55,96,41,22,27,94,49,14,71,70,9,12,21,50,95,60,7,2,7,58,23,96,25,62,73,12,47,78,53,16,79,62,13,70,35,62,7,10,79,12,25,28,3,78,41,54,89,90,43,20,85,8,41,68,81,14,69,100,23,36,39,90,17,64,11,82,91,50), true)
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
test("test8") {
|
| 33 |
+
assertEquals(Main.isArraySpecial(32,45,8,79,60,17,62,71,36,95,72,57,48,49,8,81,86,65,74,35,94,23,26,37,74,67,4,37,58,71,80,45,64,7,98,95,98,35,36,25,74,57,64,13,22,71,80,17,90,41,42,23,70,81,74,13,84,71,54,9,90,39,100,81,70,31,44,15), true)
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
}
|
special_array_ii/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(false)), isArraySpecial(new ArrayList<>(Arrays.asList(3,4,1,2,6)), new ArrayList<>(Arrays.asList(new ArrayList<>(Arrays.asList(0,4))))));
|
| 15 |
+
}
|
| 16 |
+
@Test
|
| 17 |
+
public void test2() {
|
| 18 |
+
assertEquals(new ArrayList<>(Arrays.asList(false,true)), isArraySpecial(new ArrayList<>(Arrays.asList(4,3,1,6)), new ArrayList<>(Arrays.asList(new ArrayList<>(Arrays.asList(0,2)),new ArrayList<>(Arrays.asList(2,3))))));
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
}
|
special_permutations/haskell_tests/Main.hs
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
module Main where
|
| 3 |
+
import Test.HUnit
|
| 4 |
+
|
| 5 |
+
--Program start
|
| 6 |
+
specialPerm :: [Int] -> Int
|
| 7 |
+
specialPerm nums = undefined
|
| 8 |
+
|
| 9 |
+
--Program end
|
| 10 |
+
|
| 11 |
+
-- Test cases
|
| 12 |
+
|
| 13 |
+
test1 :: Test
|
| 14 |
+
test1 = TestCase (assertEqual "for (specialPerm [2,3,6])," 2 (specialPerm [2,3,6]))
|
| 15 |
+
|
| 16 |
+
test2 :: Test
|
| 17 |
+
test2 = TestCase (assertEqual "for (specialPerm [1,4,3])," 2 (specialPerm [1,4,3]))
|
| 18 |
+
|
| 19 |
+
test3 :: Test
|
| 20 |
+
test3 = TestCase (assertEqual "for (specialPerm [584117688, 128132521, 483733809, 538103732, 157980701, 84500114, 369758978, 417335206, 834992633])," 0 (specialPerm [584117688, 128132521, 483733809, 538103732, 157980701, 84500114, 369758978, 417335206, 834992633]))
|
| 21 |
+
|
| 22 |
+
test4 :: Test
|
| 23 |
+
test4 = TestCase (assertEqual "for (specialPerm [716189780, 829231105, 799685662, 706127727, 642091233, 653562772, 19107990, 817847028, 452438656, 309420299, 224255714, 378823621, 893604088, 555231725])," 0 (specialPerm [716189780, 829231105, 799685662, 706127727, 642091233, 653562772, 19107990, 817847028, 452438656, 309420299, 224255714, 378823621, 893604088, 555231725]))
|
| 24 |
+
|
| 25 |
+
test5 :: Test
|
| 26 |
+
test5 = TestCase (assertEqual "for (specialPerm [915827588, 281855433, 282404443, 237318432, 258066764, 83688214, 236117470, 134376301, 125033736, 406824599, 806597217, 175838204, 448108347])," 0 (specialPerm [915827588, 281855433, 282404443, 237318432, 258066764, 83688214, 236117470, 134376301, 125033736, 406824599, 806597217, 175838204, 448108347]))
|
| 27 |
+
|
| 28 |
+
test6 :: Test
|
| 29 |
+
test6 = TestCase (assertEqual "for (specialPerm [726633986, 400995617, 693097314, 440474407, 63494536, 993852230, 881042725, 924564810])," 0 (specialPerm [726633986, 400995617, 693097314, 440474407, 63494536, 993852230, 881042725, 924564810]))
|
| 30 |
+
|
| 31 |
+
test7 :: Test
|
| 32 |
+
test7 = TestCase (assertEqual "for (specialPerm [744707562, 793994140, 180416571, 473700883, 587397301, 367020656, 905392500, 925682568, 353345376, 696934710, 546914520, 207602398, 366110622, 970835618])," 0 (specialPerm [744707562, 793994140, 180416571, 473700883, 587397301, 367020656, 905392500, 925682568, 353345376, 696934710, 546914520, 207602398, 366110622, 970835618]))
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
-- Grouping test cases
|
| 36 |
+
tests :: Test
|
| 37 |
+
tests = TestList [TestLabel "Test1" test1, TestLabel "Test2" test2, TestLabel "Test3" test3, TestLabel "Test4" test4, TestLabel "Test5" test5, TestLabel "Test6" test6]
|
| 38 |
+
|
| 39 |
+
-- Running the tests
|
| 40 |
+
main :: IO Counts
|
| 41 |
+
main = runTestTT tests
|
special_permutations/java_tests/Main.java
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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(2, specialPerm(Arrays.asList(2,3,6)));
|
| 14 |
+
}
|
| 15 |
+
@Test
|
| 16 |
+
public void test2() {
|
| 17 |
+
assertEquals(2, specialPerm(Arrays.asList(1,4,3)));
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
}
|
special_permutations/meta.json
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"id": 2848,
|
| 3 |
+
"name": "special_permutations",
|
| 4 |
+
"difficulty": "Medium",
|
| 5 |
+
"link": "https://leetcode.com/problems/special-permutations/",
|
| 6 |
+
"date": "2023-06-11 00:00:00",
|
| 7 |
+
"task_description": "You are given a **0-indexed** integer array `nums` containing `n` **distinct** positive integers. A permutation of `nums` is called special if: For all indexes `0 <= i < n - 1`, either `nums[i] % nums[i+1] == 0` or `nums[i+1] % nums[i] == 0`. Return _the total number of special permutations. _As the answer could be large, return it **modulo **`109 + 7`. **Example 1:** ``` **Input:** nums = [2,3,6] **Output:** 2 **Explanation:** [3,6,2] and [2,6,3] are the two special permutations of nums. ``` **Example 2:** ``` **Input:** nums = [1,4,3] **Output:** 2 **Explanation:** [3,1,4] and [4,1,3] are the two special permutations of nums. ``` **Constraints:** `2 <= nums.length <= 14` `1 <= nums[i] <= 109`",
|
| 8 |
+
"public_test_cases": [
|
| 9 |
+
{
|
| 10 |
+
"label": "Example 1",
|
| 11 |
+
"input": "nums = [2,3,6]",
|
| 12 |
+
"output": "2 "
|
| 13 |
+
},
|
| 14 |
+
{
|
| 15 |
+
"label": "Example 2",
|
| 16 |
+
"input": "nums = [1,4,3]",
|
| 17 |
+
"output": "2 "
|
| 18 |
+
}
|
| 19 |
+
],
|
| 20 |
+
"private_test_cases": [
|
| 21 |
+
{
|
| 22 |
+
"input": [
|
| 23 |
+
584117688,
|
| 24 |
+
128132521,
|
| 25 |
+
483733809,
|
| 26 |
+
538103732,
|
| 27 |
+
157980701,
|
| 28 |
+
84500114,
|
| 29 |
+
369758978,
|
| 30 |
+
417335206,
|
| 31 |
+
834992633
|
| 32 |
+
],
|
| 33 |
+
"output": 0
|
| 34 |
+
},
|
| 35 |
+
{
|
| 36 |
+
"input": [
|
| 37 |
+
716189780,
|
| 38 |
+
829231105,
|
| 39 |
+
799685662,
|
| 40 |
+
706127727,
|
| 41 |
+
642091233,
|
| 42 |
+
653562772,
|
| 43 |
+
19107990,
|
| 44 |
+
817847028,
|
| 45 |
+
452438656,
|
| 46 |
+
309420299,
|
| 47 |
+
224255714,
|
| 48 |
+
378823621,
|
| 49 |
+
893604088,
|
| 50 |
+
555231725
|
| 51 |
+
],
|
| 52 |
+
"output": 0
|
| 53 |
+
},
|
| 54 |
+
{
|
| 55 |
+
"input": [
|
| 56 |
+
915827588,
|
| 57 |
+
281855433,
|
| 58 |
+
282404443,
|
| 59 |
+
237318432,
|
| 60 |
+
258066764,
|
| 61 |
+
83688214,
|
| 62 |
+
236117470,
|
| 63 |
+
134376301,
|
| 64 |
+
125033736,
|
| 65 |
+
406824599,
|
| 66 |
+
806597217,
|
| 67 |
+
175838204,
|
| 68 |
+
448108347
|
| 69 |
+
],
|
| 70 |
+
"output": 0
|
| 71 |
+
},
|
| 72 |
+
{
|
| 73 |
+
"input": [
|
| 74 |
+
726633986,
|
| 75 |
+
400995617,
|
| 76 |
+
693097314,
|
| 77 |
+
440474407,
|
| 78 |
+
63494536,
|
| 79 |
+
993852230,
|
| 80 |
+
881042725,
|
| 81 |
+
924564810
|
| 82 |
+
],
|
| 83 |
+
"output": 0
|
| 84 |
+
},
|
| 85 |
+
{
|
| 86 |
+
"input": [
|
| 87 |
+
744707562,
|
| 88 |
+
793994140,
|
| 89 |
+
180416571,
|
| 90 |
+
473700883,
|
| 91 |
+
587397301,
|
| 92 |
+
367020656,
|
| 93 |
+
905392500,
|
| 94 |
+
925682568,
|
| 95 |
+
353345376,
|
| 96 |
+
696934710,
|
| 97 |
+
546914520,
|
| 98 |
+
207602398,
|
| 99 |
+
366110622,
|
| 100 |
+
970835618
|
| 101 |
+
],
|
| 102 |
+
"output": 0
|
| 103 |
+
}
|
| 104 |
+
],
|
| 105 |
+
"haskell_template": "specialPerm :: [Int] -> Int\nspecialPerm nums ",
|
| 106 |
+
"ocaml_template": "let specialPerm (nums: int list) : int = ",
|
| 107 |
+
"scala_template": "def specialPerm(nums: List[Int]): Int = { \n \n}",
|
| 108 |
+
"java_template": "class Solution {\n public int specialPerm(int[] nums) {\n \n }\n}",
|
| 109 |
+
"python_template": "class Solution(object):\n def specialPerm(self, nums):\n \"\"\"\n :type nums: List[int]\n :rtype: int\n \"\"\"\n "
|
| 110 |
+
}
|
special_permutations/ocaml_tests/main.ml
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
module Main = struct
|
| 3 |
+
open OUnit2
|
| 4 |
+
|
| 5 |
+
(* Program start *)
|
| 6 |
+
let specialPerm (nums: int list) : int = failwith "Not implemented"
|
| 7 |
+
|
| 8 |
+
(* Program end *)
|
| 9 |
+
|
| 10 |
+
(* Test cases *)
|
| 11 |
+
|
| 12 |
+
let test1 _ = assert_equal 2 (specialPerm [2;3;6])
|
| 13 |
+
|
| 14 |
+
let test2 _ = assert_equal 2 (specialPerm [1;4;3])
|
| 15 |
+
|
| 16 |
+
let test3 _ = assert_equal 2 (specialPerm [584117688; 128132521; 483733809; 538103732; 157980701; 84500114; 369758978; 417335206; 834992633])
|
| 17 |
+
|
| 18 |
+
let test4 _ = assert_equal 2 (specialPerm [716189780; 829231105; 799685662; 706127727; 642091233; 653562772; 19107990; 817847028; 452438656; 309420299; 224255714; 378823621; 893604088; 555231725])
|
| 19 |
+
|
| 20 |
+
let test5 _ = assert_equal 2 (specialPerm [915827588; 281855433; 282404443; 237318432; 258066764; 83688214; 236117470; 134376301; 125033736; 406824599; 806597217; 175838204; 448108347])
|
| 21 |
+
|
| 22 |
+
let test6 _ = assert_equal 2 (specialPerm [726633986; 400995617; 693097314; 440474407; 63494536; 993852230; 881042725; 924564810])
|
| 23 |
+
|
| 24 |
+
let test7 _ = assert_equal 2 (specialPerm [744707562; 793994140; 180416571; 473700883; 587397301; 367020656; 905392500; 925682568; 353345376; 696934710; 546914520; 207602398; 366110622; 970835618])
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
(* Grouping test cases *)
|
| 28 |
+
let suite = "Test Suite for specialPerm" >::: [
|
| 29 |
+
|
| 30 |
+
"test1" >:: test1;
|
| 31 |
+
"test2" >:: test2;
|
| 32 |
+
"test3" >:: test3;
|
| 33 |
+
"test4" >:: test4;
|
| 34 |
+
"test5" >:: test5;
|
| 35 |
+
"test6" >:: test6;
|
| 36 |
+
"test7" >:: test7;
|
| 37 |
+
]
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
(* Running the tests *)
|
| 41 |
+
let () = run_test_tt_main suite
|
| 42 |
+
end
|
special_permutations/scala_tests/MySuite.scala
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
class MySuite extends munit.FunSuite {
|
| 3 |
+
|
| 4 |
+
test("test1") {
|
| 5 |
+
assertEquals(Main.specialPerm(List(2,3,6)), 2)
|
| 6 |
+
}
|
| 7 |
+
|
| 8 |
+
test("test2") {
|
| 9 |
+
assertEquals(Main.specialPerm(List(1,4,3)), 2)
|
| 10 |
+
}
|
| 11 |
+
|
| 12 |
+
test("test3") {
|
| 13 |
+
assertEquals(Main.specialPerm(584117688,128132521,483733809,538103732,157980701,84500114,369758978,417335206,834992633), 0)
|
| 14 |
+
}
|
| 15 |
+
|
| 16 |
+
test("test4") {
|
| 17 |
+
assertEquals(Main.specialPerm(716189780,829231105,799685662,706127727,642091233,653562772,19107990,817847028,452438656,309420299,224255714,378823621,893604088,555231725), 0)
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
test("test5") {
|
| 21 |
+
assertEquals(Main.specialPerm(915827588,281855433,282404443,237318432,258066764,83688214,236117470,134376301,125033736,406824599,806597217,175838204,448108347), 0)
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
test("test6") {
|
| 25 |
+
assertEquals(Main.specialPerm(726633986,400995617,693097314,440474407,63494536,993852230,881042725,924564810), 0)
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
test("test7") {
|
| 29 |
+
assertEquals(Main.specialPerm(744707562,793994140,180416571,473700883,587397301,367020656,905392500,925682568,353345376,696934710,546914520,207602398,366110622,970835618), 0)
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
}
|
split_array_into_maximum_number_of_subarrays/haskell_tests/Main.hs
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
split_array_into_maximum_number_of_subarrays/java_tests/Main.java
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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(3, maxSubarrays(Arrays.asList(1,0,2,0,1,2)));
|
| 14 |
+
}
|
| 15 |
+
@Test
|
| 16 |
+
public void test2() {
|
| 17 |
+
assertEquals(1, maxSubarrays(Arrays.asList(5,7,1,3)));
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
}
|
split_array_into_maximum_number_of_subarrays/meta.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
split_array_into_maximum_number_of_subarrays/ocaml_tests/main.ml
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
split_array_into_maximum_number_of_subarrays/scala_tests/MySuite.scala
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
split_the_array/haskell_tests/Main.hs
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
module Main where
|
| 3 |
+
import Test.HUnit
|
| 4 |
+
|
| 5 |
+
--Program start
|
| 6 |
+
isPossibleToSplit :: [Int] -> Bool
|
| 7 |
+
isPossibleToSplit nums = undefined
|
| 8 |
+
|
| 9 |
+
--Program end
|
| 10 |
+
|
| 11 |
+
-- Test cases
|
| 12 |
+
|
| 13 |
+
test1 :: Test
|
| 14 |
+
test1 = TestCase (assertEqual "for (isPossibleToSplit [1,1,2,2,3,4])," True (isPossibleToSplit [1,1,2,2,3,4]))
|
| 15 |
+
|
| 16 |
+
test2 :: Test
|
| 17 |
+
test2 = TestCase (assertEqual "for (isPossibleToSplit [1,1,1,1])," False (isPossibleToSplit [1,1,1,1]))
|
| 18 |
+
|
| 19 |
+
test3 :: Test
|
| 20 |
+
test3 = TestCase (assertEqual "for (isPossibleToSplit [79, 98, 70, 52, 79, 93, 39, 1, 73, 8, 33, 89, 99, 78, 78, 42])," True (isPossibleToSplit [79, 98, 70, 52, 79, 93, 39, 1, 73, 8, 33, 89, 99, 78, 78, 42]))
|
| 21 |
+
|
| 22 |
+
test4 :: Test
|
| 23 |
+
test4 = TestCase (assertEqual "for (isPossibleToSplit [28, 33, 20, 86, 85, 55, 87, 90, 18, 57, 11, 11, 87, 62, 23, 74, 67, 22, 81, 31, 1, 68, 87, 26, 12, 78, 66, 88, 26, 3, 58, 99, 14, 78, 72, 6, 64, 98])," False (isPossibleToSplit [28, 33, 20, 86, 85, 55, 87, 90, 18, 57, 11, 11, 87, 62, 23, 74, 67, 22, 81, 31, 1, 68, 87, 26, 12, 78, 66, 88, 26, 3, 58, 99, 14, 78, 72, 6, 64, 98]))
|
| 24 |
+
|
| 25 |
+
test5 :: Test
|
| 26 |
+
test5 = TestCase (assertEqual "for (isPossibleToSplit [100, 87, 98, 2, 31, 68, 54, 5, 71, 39, 95, 53, 90, 26, 77, 13, 73, 6, 89, 55, 14, 18, 46, 9, 66, 17, 69, 89, 76, 64, 49, 90, 97, 58, 5, 5, 9, 1, 35, 76, 77, 82, 49, 8])," False (isPossibleToSplit [100, 87, 98, 2, 31, 68, 54, 5, 71, 39, 95, 53, 90, 26, 77, 13, 73, 6, 89, 55, 14, 18, 46, 9, 66, 17, 69, 89, 76, 64, 49, 90, 97, 58, 5, 5, 9, 1, 35, 76, 77, 82, 49, 8]))
|
| 27 |
+
|
| 28 |
+
test6 :: Test
|
| 29 |
+
test6 = TestCase (assertEqual "for (isPossibleToSplit [71, 63, 77, 63, 91, 18, 89, 39, 41, 49, 64, 58, 26, 99, 14, 40, 69, 44, 85, 58, 26, 48, 92, 45, 48, 77, 46, 27, 21, 25, 17, 10, 4, 72, 43, 43, 7, 48, 6, 79, 34, 56, 21, 1, 57, 89, 78, 48, 93, 49, 88, 65, 12, 74, 33, 9, 18, 73, 53, 43, 29, 3, 22, 58, 25, 46, 72, 86, 76, 5, 85, 11, 14, 14, 41, 97, 9, 54, 41, 53, 57, 33, 43, 44])," False (isPossibleToSplit [71, 63, 77, 63, 91, 18, 89, 39, 41, 49, 64, 58, 26, 99, 14, 40, 69, 44, 85, 58, 26, 48, 92, 45, 48, 77, 46, 27, 21, 25, 17, 10, 4, 72, 43, 43, 7, 48, 6, 79, 34, 56, 21, 1, 57, 89, 78, 48, 93, 49, 88, 65, 12, 74, 33, 9, 18, 73, 53, 43, 29, 3, 22, 58, 25, 46, 72, 86, 76, 5, 85, 11, 14, 14, 41, 97, 9, 54, 41, 53, 57, 33, 43, 44]))
|
| 30 |
+
|
| 31 |
+
test7 :: Test
|
| 32 |
+
test7 = TestCase (assertEqual "for (isPossibleToSplit [64, 53, 60, 80, 73, 94, 64, 27, 85, 2, 67, 46, 39, 55, 11, 75, 96, 19, 98, 40, 87, 33, 51, 66, 7, 72, 25, 13, 89, 3, 99, 15, 39, 55, 38, 96, 23, 83, 22, 22, 48, 26, 19, 33, 76, 86, 56, 32, 96, 23, 15, 100, 49, 43, 81, 38, 80, 25, 43, 39, 51, 43, 78, 45, 54, 77, 66, 75, 71, 5, 47, 18, 28, 86, 68, 78, 71, 70, 46, 12, 27, 36, 23, 76, 37, 77, 69, 56, 3, 35, 80, 40, 56, 62, 51, 44])," False (isPossibleToSplit [64, 53, 60, 80, 73, 94, 64, 27, 85, 2, 67, 46, 39, 55, 11, 75, 96, 19, 98, 40, 87, 33, 51, 66, 7, 72, 25, 13, 89, 3, 99, 15, 39, 55, 38, 96, 23, 83, 22, 22, 48, 26, 19, 33, 76, 86, 56, 32, 96, 23, 15, 100, 49, 43, 81, 38, 80, 25, 43, 39, 51, 43, 78, 45, 54, 77, 66, 75, 71, 5, 47, 18, 28, 86, 68, 78, 71, 70, 46, 12, 27, 36, 23, 76, 37, 77, 69, 56, 3, 35, 80, 40, 56, 62, 51, 44]))
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
-- Grouping test cases
|
| 36 |
+
tests :: Test
|
| 37 |
+
tests = TestList [TestLabel "Test1" test1, TestLabel "Test2" test2, TestLabel "Test3" test3, TestLabel "Test4" test4, TestLabel "Test5" test5, TestLabel "Test6" test6]
|
| 38 |
+
|
| 39 |
+
-- Running the tests
|
| 40 |
+
main :: IO Counts
|
| 41 |
+
main = runTestTT tests
|
split_the_array/java_tests/Main.java
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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, isPossibleToSplit(Arrays.asList(1,1,2,2,3,4)));
|
| 14 |
+
}
|
| 15 |
+
@Test
|
| 16 |
+
public void test2() {
|
| 17 |
+
assertEquals(false, isPossibleToSplit(Arrays.asList(1,1,1,1)));
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
}
|
split_the_array/meta.json
ADDED
|
@@ -0,0 +1,330 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"id": 3324,
|
| 3 |
+
"name": "split_the_array",
|
| 4 |
+
"difficulty": "Easy",
|
| 5 |
+
"link": "https://leetcode.com/problems/split-the-array/",
|
| 6 |
+
"date": "2024-02-18 00:00:00",
|
| 7 |
+
"task_description": "You are given an integer array `nums` of **even** length. You have to split the array into two parts `nums1` and `nums2` such that: `nums1.length == nums2.length == nums.length / 2`. `nums1` should contain **distinct **elements. `nums2` should also contain **distinct** elements. Return `true`_ if it is possible to split the array, and _`false` _otherwise__._ **Example 1:** ``` **Input:** nums = [1,1,2,2,3,4] **Output:** true **Explanation:** One of the possible ways to split nums is nums1 = [1,2,3] and nums2 = [1,2,4]. ``` **Example 2:** ``` **Input:** nums = [1,1,1,1] **Output:** false **Explanation:** The only possible way to split nums is nums1 = [1,1] and nums2 = [1,1]. Both nums1 and nums2 do not contain distinct elements. Therefore, we return false. ``` **Constraints:** `1 <= nums.length <= 100` `nums.length % 2 == 0 ` `1 <= nums[i] <= 100`",
|
| 8 |
+
"public_test_cases": [
|
| 9 |
+
{
|
| 10 |
+
"label": "Example 1",
|
| 11 |
+
"input": "nums = [1,1,2,2,3,4]",
|
| 12 |
+
"output": "true "
|
| 13 |
+
},
|
| 14 |
+
{
|
| 15 |
+
"label": "Example 2",
|
| 16 |
+
"input": "nums = [1,1,1,1]",
|
| 17 |
+
"output": "false "
|
| 18 |
+
}
|
| 19 |
+
],
|
| 20 |
+
"private_test_cases": [
|
| 21 |
+
{
|
| 22 |
+
"input": [
|
| 23 |
+
79,
|
| 24 |
+
98,
|
| 25 |
+
70,
|
| 26 |
+
52,
|
| 27 |
+
79,
|
| 28 |
+
93,
|
| 29 |
+
39,
|
| 30 |
+
1,
|
| 31 |
+
73,
|
| 32 |
+
8,
|
| 33 |
+
33,
|
| 34 |
+
89,
|
| 35 |
+
99,
|
| 36 |
+
78,
|
| 37 |
+
78,
|
| 38 |
+
42
|
| 39 |
+
],
|
| 40 |
+
"output": true
|
| 41 |
+
},
|
| 42 |
+
{
|
| 43 |
+
"input": [
|
| 44 |
+
28,
|
| 45 |
+
33,
|
| 46 |
+
20,
|
| 47 |
+
86,
|
| 48 |
+
85,
|
| 49 |
+
55,
|
| 50 |
+
87,
|
| 51 |
+
90,
|
| 52 |
+
18,
|
| 53 |
+
57,
|
| 54 |
+
11,
|
| 55 |
+
11,
|
| 56 |
+
87,
|
| 57 |
+
62,
|
| 58 |
+
23,
|
| 59 |
+
74,
|
| 60 |
+
67,
|
| 61 |
+
22,
|
| 62 |
+
81,
|
| 63 |
+
31,
|
| 64 |
+
1,
|
| 65 |
+
68,
|
| 66 |
+
87,
|
| 67 |
+
26,
|
| 68 |
+
12,
|
| 69 |
+
78,
|
| 70 |
+
66,
|
| 71 |
+
88,
|
| 72 |
+
26,
|
| 73 |
+
3,
|
| 74 |
+
58,
|
| 75 |
+
99,
|
| 76 |
+
14,
|
| 77 |
+
78,
|
| 78 |
+
72,
|
| 79 |
+
6,
|
| 80 |
+
64,
|
| 81 |
+
98
|
| 82 |
+
],
|
| 83 |
+
"output": false
|
| 84 |
+
},
|
| 85 |
+
{
|
| 86 |
+
"input": [
|
| 87 |
+
100,
|
| 88 |
+
87,
|
| 89 |
+
98,
|
| 90 |
+
2,
|
| 91 |
+
31,
|
| 92 |
+
68,
|
| 93 |
+
54,
|
| 94 |
+
5,
|
| 95 |
+
71,
|
| 96 |
+
39,
|
| 97 |
+
95,
|
| 98 |
+
53,
|
| 99 |
+
90,
|
| 100 |
+
26,
|
| 101 |
+
77,
|
| 102 |
+
13,
|
| 103 |
+
73,
|
| 104 |
+
6,
|
| 105 |
+
89,
|
| 106 |
+
55,
|
| 107 |
+
14,
|
| 108 |
+
18,
|
| 109 |
+
46,
|
| 110 |
+
9,
|
| 111 |
+
66,
|
| 112 |
+
17,
|
| 113 |
+
69,
|
| 114 |
+
89,
|
| 115 |
+
76,
|
| 116 |
+
64,
|
| 117 |
+
49,
|
| 118 |
+
90,
|
| 119 |
+
97,
|
| 120 |
+
58,
|
| 121 |
+
5,
|
| 122 |
+
5,
|
| 123 |
+
9,
|
| 124 |
+
1,
|
| 125 |
+
35,
|
| 126 |
+
76,
|
| 127 |
+
77,
|
| 128 |
+
82,
|
| 129 |
+
49,
|
| 130 |
+
8
|
| 131 |
+
],
|
| 132 |
+
"output": false
|
| 133 |
+
},
|
| 134 |
+
{
|
| 135 |
+
"input": [
|
| 136 |
+
71,
|
| 137 |
+
63,
|
| 138 |
+
77,
|
| 139 |
+
63,
|
| 140 |
+
91,
|
| 141 |
+
18,
|
| 142 |
+
89,
|
| 143 |
+
39,
|
| 144 |
+
41,
|
| 145 |
+
49,
|
| 146 |
+
64,
|
| 147 |
+
58,
|
| 148 |
+
26,
|
| 149 |
+
99,
|
| 150 |
+
14,
|
| 151 |
+
40,
|
| 152 |
+
69,
|
| 153 |
+
44,
|
| 154 |
+
85,
|
| 155 |
+
58,
|
| 156 |
+
26,
|
| 157 |
+
48,
|
| 158 |
+
92,
|
| 159 |
+
45,
|
| 160 |
+
48,
|
| 161 |
+
77,
|
| 162 |
+
46,
|
| 163 |
+
27,
|
| 164 |
+
21,
|
| 165 |
+
25,
|
| 166 |
+
17,
|
| 167 |
+
10,
|
| 168 |
+
4,
|
| 169 |
+
72,
|
| 170 |
+
43,
|
| 171 |
+
43,
|
| 172 |
+
7,
|
| 173 |
+
48,
|
| 174 |
+
6,
|
| 175 |
+
79,
|
| 176 |
+
34,
|
| 177 |
+
56,
|
| 178 |
+
21,
|
| 179 |
+
1,
|
| 180 |
+
57,
|
| 181 |
+
89,
|
| 182 |
+
78,
|
| 183 |
+
48,
|
| 184 |
+
93,
|
| 185 |
+
49,
|
| 186 |
+
88,
|
| 187 |
+
65,
|
| 188 |
+
12,
|
| 189 |
+
74,
|
| 190 |
+
33,
|
| 191 |
+
9,
|
| 192 |
+
18,
|
| 193 |
+
73,
|
| 194 |
+
53,
|
| 195 |
+
43,
|
| 196 |
+
29,
|
| 197 |
+
3,
|
| 198 |
+
22,
|
| 199 |
+
58,
|
| 200 |
+
25,
|
| 201 |
+
46,
|
| 202 |
+
72,
|
| 203 |
+
86,
|
| 204 |
+
76,
|
| 205 |
+
5,
|
| 206 |
+
85,
|
| 207 |
+
11,
|
| 208 |
+
14,
|
| 209 |
+
14,
|
| 210 |
+
41,
|
| 211 |
+
97,
|
| 212 |
+
9,
|
| 213 |
+
54,
|
| 214 |
+
41,
|
| 215 |
+
53,
|
| 216 |
+
57,
|
| 217 |
+
33,
|
| 218 |
+
43,
|
| 219 |
+
44
|
| 220 |
+
],
|
| 221 |
+
"output": false
|
| 222 |
+
},
|
| 223 |
+
{
|
| 224 |
+
"input": [
|
| 225 |
+
64,
|
| 226 |
+
53,
|
| 227 |
+
60,
|
| 228 |
+
80,
|
| 229 |
+
73,
|
| 230 |
+
94,
|
| 231 |
+
64,
|
| 232 |
+
27,
|
| 233 |
+
85,
|
| 234 |
+
2,
|
| 235 |
+
67,
|
| 236 |
+
46,
|
| 237 |
+
39,
|
| 238 |
+
55,
|
| 239 |
+
11,
|
| 240 |
+
75,
|
| 241 |
+
96,
|
| 242 |
+
19,
|
| 243 |
+
98,
|
| 244 |
+
40,
|
| 245 |
+
87,
|
| 246 |
+
33,
|
| 247 |
+
51,
|
| 248 |
+
66,
|
| 249 |
+
7,
|
| 250 |
+
72,
|
| 251 |
+
25,
|
| 252 |
+
13,
|
| 253 |
+
89,
|
| 254 |
+
3,
|
| 255 |
+
99,
|
| 256 |
+
15,
|
| 257 |
+
39,
|
| 258 |
+
55,
|
| 259 |
+
38,
|
| 260 |
+
96,
|
| 261 |
+
23,
|
| 262 |
+
83,
|
| 263 |
+
22,
|
| 264 |
+
22,
|
| 265 |
+
48,
|
| 266 |
+
26,
|
| 267 |
+
19,
|
| 268 |
+
33,
|
| 269 |
+
76,
|
| 270 |
+
86,
|
| 271 |
+
56,
|
| 272 |
+
32,
|
| 273 |
+
96,
|
| 274 |
+
23,
|
| 275 |
+
15,
|
| 276 |
+
100,
|
| 277 |
+
49,
|
| 278 |
+
43,
|
| 279 |
+
81,
|
| 280 |
+
38,
|
| 281 |
+
80,
|
| 282 |
+
25,
|
| 283 |
+
43,
|
| 284 |
+
39,
|
| 285 |
+
51,
|
| 286 |
+
43,
|
| 287 |
+
78,
|
| 288 |
+
45,
|
| 289 |
+
54,
|
| 290 |
+
77,
|
| 291 |
+
66,
|
| 292 |
+
75,
|
| 293 |
+
71,
|
| 294 |
+
5,
|
| 295 |
+
47,
|
| 296 |
+
18,
|
| 297 |
+
28,
|
| 298 |
+
86,
|
| 299 |
+
68,
|
| 300 |
+
78,
|
| 301 |
+
71,
|
| 302 |
+
70,
|
| 303 |
+
46,
|
| 304 |
+
12,
|
| 305 |
+
27,
|
| 306 |
+
36,
|
| 307 |
+
23,
|
| 308 |
+
76,
|
| 309 |
+
37,
|
| 310 |
+
77,
|
| 311 |
+
69,
|
| 312 |
+
56,
|
| 313 |
+
3,
|
| 314 |
+
35,
|
| 315 |
+
80,
|
| 316 |
+
40,
|
| 317 |
+
56,
|
| 318 |
+
62,
|
| 319 |
+
51,
|
| 320 |
+
44
|
| 321 |
+
],
|
| 322 |
+
"output": false
|
| 323 |
+
}
|
| 324 |
+
],
|
| 325 |
+
"haskell_template": "isPossibleToSplit :: [Int] -> Bool\nisPossibleToSplit nums ",
|
| 326 |
+
"ocaml_template": "let isPossibleToSplit (nums: int list) : bool = ",
|
| 327 |
+
"scala_template": "def isPossibleToSplit(nums: List[Int]): Boolean = { \n \n}",
|
| 328 |
+
"java_template": "class Solution {\n public boolean isPossibleToSplit(int[] nums) {\n \n }\n}",
|
| 329 |
+
"python_template": "class Solution(object):\n def isPossibleToSplit(self, nums):\n \"\"\"\n :type nums: List[int]\n :rtype: bool\n \"\"\"\n "
|
| 330 |
+
}
|
split_the_array/ocaml_tests/main.ml
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
module Main = struct
|
| 3 |
+
open OUnit2
|
| 4 |
+
|
| 5 |
+
(* Program start *)
|
| 6 |
+
let isPossibleToSplit (nums: int list) : bool = failwith "Not implemented"
|
| 7 |
+
|
| 8 |
+
(* Program end *)
|
| 9 |
+
|
| 10 |
+
(* Test cases *)
|
| 11 |
+
|
| 12 |
+
let test1 _ = assert_equal true (isPossibleToSplit [1;1;2;2;3;4])
|
| 13 |
+
|
| 14 |
+
let test2 _ = assert_equal false (isPossibleToSplit [1;1;1;1])
|
| 15 |
+
|
| 16 |
+
let test3 _ = assert_equal false (isPossibleToSplit [79; 98; 70; 52; 79; 93; 39; 1; 73; 8; 33; 89; 99; 78; 78; 42])
|
| 17 |
+
|
| 18 |
+
let test4 _ = assert_equal false (isPossibleToSplit [28; 33; 20; 86; 85; 55; 87; 90; 18; 57; 11; 11; 87; 62; 23; 74; 67; 22; 81; 31; 1; 68; 87; 26; 12; 78; 66; 88; 26; 3; 58; 99; 14; 78; 72; 6; 64; 98])
|
| 19 |
+
|
| 20 |
+
let test5 _ = assert_equal false (isPossibleToSplit [100; 87; 98; 2; 31; 68; 54; 5; 71; 39; 95; 53; 90; 26; 77; 13; 73; 6; 89; 55; 14; 18; 46; 9; 66; 17; 69; 89; 76; 64; 49; 90; 97; 58; 5; 5; 9; 1; 35; 76; 77; 82; 49; 8])
|
| 21 |
+
|
| 22 |
+
let test6 _ = assert_equal false (isPossibleToSplit [71; 63; 77; 63; 91; 18; 89; 39; 41; 49; 64; 58; 26; 99; 14; 40; 69; 44; 85; 58; 26; 48; 92; 45; 48; 77; 46; 27; 21; 25; 17; 10; 4; 72; 43; 43; 7; 48; 6; 79; 34; 56; 21; 1; 57; 89; 78; 48; 93; 49; 88; 65; 12; 74; 33; 9; 18; 73; 53; 43; 29; 3; 22; 58; 25; 46; 72; 86; 76; 5; 85; 11; 14; 14; 41; 97; 9; 54; 41; 53; 57; 33; 43; 44])
|
| 23 |
+
|
| 24 |
+
let test7 _ = assert_equal false (isPossibleToSplit [64; 53; 60; 80; 73; 94; 64; 27; 85; 2; 67; 46; 39; 55; 11; 75; 96; 19; 98; 40; 87; 33; 51; 66; 7; 72; 25; 13; 89; 3; 99; 15; 39; 55; 38; 96; 23; 83; 22; 22; 48; 26; 19; 33; 76; 86; 56; 32; 96; 23; 15; 100; 49; 43; 81; 38; 80; 25; 43; 39; 51; 43; 78; 45; 54; 77; 66; 75; 71; 5; 47; 18; 28; 86; 68; 78; 71; 70; 46; 12; 27; 36; 23; 76; 37; 77; 69; 56; 3; 35; 80; 40; 56; 62; 51; 44])
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
(* Grouping test cases *)
|
| 28 |
+
let suite = "Test Suite for isPossibleToSplit" >::: [
|
| 29 |
+
|
| 30 |
+
"test1" >:: test1;
|
| 31 |
+
"test2" >:: test2;
|
| 32 |
+
"test3" >:: test3;
|
| 33 |
+
"test4" >:: test4;
|
| 34 |
+
"test5" >:: test5;
|
| 35 |
+
"test6" >:: test6;
|
| 36 |
+
"test7" >:: test7;
|
| 37 |
+
]
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
(* Running the tests *)
|
| 41 |
+
let () = run_test_tt_main suite
|
| 42 |
+
end
|
split_the_array/scala_tests/MySuite.scala
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
class MySuite extends munit.FunSuite {
|
| 3 |
+
|
| 4 |
+
test("test1") {
|
| 5 |
+
assertEquals(Main.isPossibleToSplit(List(1,1,2,2,3,4)), true)
|
| 6 |
+
}
|
| 7 |
+
|
| 8 |
+
test("test2") {
|
| 9 |
+
assertEquals(Main.isPossibleToSplit(List(1,1,1,1)), false)
|
| 10 |
+
}
|
| 11 |
+
|
| 12 |
+
test("test3") {
|
| 13 |
+
assertEquals(Main.isPossibleToSplit(79,98,70,52,79,93,39,1,73,8,33,89,99,78,78,42), true)
|
| 14 |
+
}
|
| 15 |
+
|
| 16 |
+
test("test4") {
|
| 17 |
+
assertEquals(Main.isPossibleToSplit(28,33,20,86,85,55,87,90,18,57,11,11,87,62,23,74,67,22,81,31,1,68,87,26,12,78,66,88,26,3,58,99,14,78,72,6,64,98), false)
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
test("test5") {
|
| 21 |
+
assertEquals(Main.isPossibleToSplit(100,87,98,2,31,68,54,5,71,39,95,53,90,26,77,13,73,6,89,55,14,18,46,9,66,17,69,89,76,64,49,90,97,58,5,5,9,1,35,76,77,82,49,8), false)
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
test("test6") {
|
| 25 |
+
assertEquals(Main.isPossibleToSplit(71,63,77,63,91,18,89,39,41,49,64,58,26,99,14,40,69,44,85,58,26,48,92,45,48,77,46,27,21,25,17,10,4,72,43,43,7,48,6,79,34,56,21,1,57,89,78,48,93,49,88,65,12,74,33,9,18,73,53,43,29,3,22,58,25,46,72,86,76,5,85,11,14,14,41,97,9,54,41,53,57,33,43,44), false)
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
test("test7") {
|
| 29 |
+
assertEquals(Main.isPossibleToSplit(64,53,60,80,73,94,64,27,85,2,67,46,39,55,11,75,96,19,98,40,87,33,51,66,7,72,25,13,89,3,99,15,39,55,38,96,23,83,22,22,48,26,19,33,76,86,56,32,96,23,15,100,49,43,81,38,80,25,43,39,51,43,78,45,54,77,66,75,71,5,47,18,28,86,68,78,71,70,46,12,27,36,23,76,37,77,69,56,3,35,80,40,56,62,51,44), false)
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
}
|
split_the_array_to_make_coprime_products/.DS_Store
ADDED
|
Binary file (6.15 kB). View file
|
|
|
split_the_array_to_make_coprime_products/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 (findValidSplit [4,7,8,15,3,5])," 2 (findValidSplit [4,7,8,15,3,5]))
|
| 13 |
+
|
| 14 |
+
test2 :: Test
|
| 15 |
+
test2 = TestCase (assertEqual "for (findValidSplit [4,7,15,8,3,5])," (-1) (findValidSplit [4,7,15,8,3,5]))
|
| 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
|
split_the_array_to_make_coprime_products/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(2, findValidSplit(new ArrayList<>(Arrays.asList(4,7,8,15,3,5))));
|
| 15 |
+
}
|
| 16 |
+
@Test
|
| 17 |
+
public void test2() {
|
| 18 |
+
assertEquals(-1, findValidSplit(new ArrayList<>(Arrays.asList(4,7,15,8,3,5))));
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
}
|
split_the_array_to_make_coprime_products/meta.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
split_the_array_to_make_coprime_products/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 (findValidSplit [4;7;8;15;3;5])
|
| 12 |
+
|
| 13 |
+
let test2 _ = assert_equal (-1) (findValidSplit [4;7;15;8;3;5])
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
(* Grouping test cases *)
|
| 17 |
+
let suite = "Test Suite for findValidSplit" >::: [
|
| 18 |
+
|
| 19 |
+
"test1" >:: test1;
|
| 20 |
+
"test2" >:: test2;
|
| 21 |
+
]
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
(* Running the tests *)
|
| 25 |
+
let () = run_test_tt_main suite
|
| 26 |
+
end
|
split_the_array_to_make_coprime_products/scala_tests/MySuite.scala
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
class MySuite extends munit.FunSuite {
|
| 3 |
+
|
| 4 |
+
test("test1") {
|
| 5 |
+
assertEquals(Main.findValidSplit(List(4,7,8,15,3,5)), 2)
|
| 6 |
+
}
|
| 7 |
+
|
| 8 |
+
test("test2") {
|
| 9 |
+
assertEquals(Main.findValidSplit(List(4,7,15,8,3,5)), -1)
|
| 10 |
+
}
|
| 11 |
+
|
| 12 |
+
}
|
steps_to_make_array_non_decreasing/haskell_tests/Main.hs
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
steps_to_make_array_non_decreasing/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(3, totalSteps(new ArrayList<>(Arrays.asList(5,3,4,4,7,3,6,11,8,5,11))));
|
| 15 |
+
}
|
| 16 |
+
@Test
|
| 17 |
+
public void test2() {
|
| 18 |
+
assertEquals(0, totalSteps(new ArrayList<>(Arrays.asList(4,5,7,7,13))));
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
}
|
steps_to_make_array_non_decreasing/meta.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:08a645877892fe84e002b84e51606886571ba8523ba9571b3eeafab9719b2ef3
|
| 3 |
+
size 17508521
|
steps_to_make_array_non_decreasing/ocaml_tests/main.ml
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
steps_to_make_array_non_decreasing/scala_tests/MySuite.scala
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
string_compression_iii/haskell_tests/Main.hs
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
string_compression_iii/java_tests/Main.java
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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("abcde", compressedString("abcde"));
|
| 14 |
+
}
|
| 15 |
+
@Test
|
| 16 |
+
public void test2() {
|
| 17 |
+
assertEquals("aaaaaaaaaaaaaabb", compressedString("aaaaaaaaaaaaaabb"));
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
}
|
string_compression_iii/meta.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
string_compression_iii/ocaml_tests/main.ml
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
string_compression_iii/scala_tests/MySuite.scala
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
string_transformation/haskell_tests/Main.hs
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
string_transformation/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(2, numberOfWays("abcd", "cdab", 2));
|
| 15 |
+
}
|
| 16 |
+
@Test
|
| 17 |
+
public void test2() {
|
| 18 |
+
assertEquals(2, numberOfWays("ababab", "ababab", 1));
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
}
|
string_transformation/meta.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
string_transformation/ocaml_tests/main.ml
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
string_transformation/scala_tests/MySuite.scala
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
strong_password_checker_ii/haskell_tests/Main.hs
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
module Main where
|
| 3 |
+
import Test.HUnit
|
| 4 |
+
|
| 5 |
+
--Program start
|
| 6 |
+
strongPasswordCheckerII :: String -> Bool
|
| 7 |
+
strongPasswordCheckerII password = undefined
|
| 8 |
+
|
| 9 |
+
--Program end
|
| 10 |
+
|
| 11 |
+
-- Test cases
|
| 12 |
+
|
| 13 |
+
test1 :: Test
|
| 14 |
+
test1 = TestCase (assertEqual "for (strongPasswordCheckerII \"IloveLe3tcode! \")," True (strongPasswordCheckerII "IloveLe3tcode!"))
|
| 15 |
+
|
| 16 |
+
test2 :: Test
|
| 17 |
+
test2 = TestCase (assertEqual "for (strongPasswordCheckerII \"Me+You--IsMyDream \")," False (strongPasswordCheckerII "Me+You--IsMyDream"))
|
| 18 |
+
|
| 19 |
+
test3 :: Test
|
| 20 |
+
test3 = TestCase (assertEqual "for (strongPasswordCheckerII \"1aB! \")," False (strongPasswordCheckerII "1aB!"))
|
| 21 |
+
|
| 22 |
+
test4 :: Test
|
| 23 |
+
test4 = TestCase (assertEqual "for (strongPasswordCheckerII \" k n U $ 3 l r n \")," True (strongPasswordCheckerII " k n U $ 3 l r n "))
|
| 24 |
+
|
| 25 |
+
test5 :: Test
|
| 26 |
+
test5 = TestCase (assertEqual "for (strongPasswordCheckerII \" 2 O W ^ k X r 1 \")," True (strongPasswordCheckerII " 2 O W ^ k X r 1 "))
|
| 27 |
+
|
| 28 |
+
test6 :: Test
|
| 29 |
+
test6 = TestCase (assertEqual "for (strongPasswordCheckerII \" J & h 5 I 2 k @ \")," True (strongPasswordCheckerII " J & h 5 I 2 k @ "))
|
| 30 |
+
|
| 31 |
+
test7 :: Test
|
| 32 |
+
test7 = TestCase (assertEqual "for (strongPasswordCheckerII \" W h * 2 r ) @ G \")," True (strongPasswordCheckerII " W h * 2 r ) @ G "))
|
| 33 |
+
|
| 34 |
+
test8 :: Test
|
| 35 |
+
test8 = TestCase (assertEqual "for (strongPasswordCheckerII \" W b y & f 5 K f \")," True (strongPasswordCheckerII " W b y & f 5 K f "))
|
| 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
|
strong_password_checker_ii/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, strongPasswordCheckerII("IloveLe3tcode!"));
|
| 14 |
+
}
|
| 15 |
+
@Test
|
| 16 |
+
public void test2() {
|
| 17 |
+
assertEquals(false, strongPasswordCheckerII("Me+You--IsMyDream"));
|
| 18 |
+
}
|
| 19 |
+
@Test
|
| 20 |
+
public void test3() {
|
| 21 |
+
assertEquals(false, strongPasswordCheckerII("1aB!"));
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
}
|
strong_password_checker_ii/meta.json
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"id": 2391,
|
| 3 |
+
"name": "strong_password_checker_ii",
|
| 4 |
+
"difficulty": "Easy",
|
| 5 |
+
"link": "https://leetcode.com/problems/strong-password-checker-ii/",
|
| 6 |
+
"date": "2022-05-28 00:00:00",
|
| 7 |
+
"task_description": "A password is said to be **strong** if it satisfies all the following criteria: It has at least `8` characters. It contains at least **one lowercase** letter. It contains at least **one uppercase** letter. It contains at least **one digit**. It contains at least **one special character**. The special characters are the characters in the following string: `\"!@#$%^&*()-+\"`. It does **not** contain `2` of the same character in adjacent positions (i.e., `\"aab\"` violates this condition, but `\"aba\"` does not). Given a string `password`, return `true`_ if it is a **strong** password_. Otherwise, return `false`. **Example 1:** ``` **Input:** password = \"IloveLe3tcode!\" **Output:** true **Explanation:** The password meets all the requirements. Therefore, we return true. ``` **Example 2:** ``` **Input:** password = \"Me+You--IsMyDream\" **Output:** false **Explanation:** The password does not contain a digit and also contains 2 of the same character in adjacent positions. Therefore, we return false. ``` **Example 3:** ``` **Input:** password = \"1aB!\" **Output:** false **Explanation:** The password does not meet the length requirement. Therefore, we return false. ``` **Constraints:** `1 <= password.length <= 100` `password` consists of letters, digits, and special characters: `\"!@#$%^&*()-+\"`.",
|
| 8 |
+
"public_test_cases": [
|
| 9 |
+
{
|
| 10 |
+
"label": "Example 1",
|
| 11 |
+
"input": "password = \"IloveLe3tcode!\"",
|
| 12 |
+
"output": "true "
|
| 13 |
+
},
|
| 14 |
+
{
|
| 15 |
+
"label": "Example 2",
|
| 16 |
+
"input": "password = \"Me+You--IsMyDream\"",
|
| 17 |
+
"output": "false "
|
| 18 |
+
},
|
| 19 |
+
{
|
| 20 |
+
"label": "Example 3",
|
| 21 |
+
"input": "password = \"1aB!\"",
|
| 22 |
+
"output": "false "
|
| 23 |
+
}
|
| 24 |
+
],
|
| 25 |
+
"private_test_cases": [
|
| 26 |
+
{
|
| 27 |
+
"input": "knU$3lrn",
|
| 28 |
+
"output": true
|
| 29 |
+
},
|
| 30 |
+
{
|
| 31 |
+
"input": "2OW^kXr1",
|
| 32 |
+
"output": true
|
| 33 |
+
},
|
| 34 |
+
{
|
| 35 |
+
"input": "J&h5I2k@",
|
| 36 |
+
"output": true
|
| 37 |
+
},
|
| 38 |
+
{
|
| 39 |
+
"input": "Wh*2r)@G",
|
| 40 |
+
"output": true
|
| 41 |
+
},
|
| 42 |
+
{
|
| 43 |
+
"input": "Wby&f5Kf",
|
| 44 |
+
"output": true
|
| 45 |
+
}
|
| 46 |
+
],
|
| 47 |
+
"haskell_template": "strongPasswordCheckerII :: String -> Bool\nstrongPasswordCheckerII password ",
|
| 48 |
+
"ocaml_template": "let strongPasswordCheckerII (password: string) : bool = ",
|
| 49 |
+
"scala_template": "def strongPasswordCheckerII(password: String): Boolean = { \n \n}",
|
| 50 |
+
"java_template": "class Solution {\n public boolean strongPasswordCheckerII(String password) {\n \n }\n}",
|
| 51 |
+
"python_template": "class Solution(object):\n def strongPasswordCheckerII(self, password):\n \"\"\"\n :type password: str\n :rtype: bool\n \"\"\"\n "
|
| 52 |
+
}
|
strong_password_checker_ii/ocaml_tests/main.ml
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
module Main = struct
|
| 3 |
+
open OUnit2
|
| 4 |
+
|
| 5 |
+
(* Program start *)
|
| 6 |
+
let strongPasswordCheckerII (password: string) : bool = failwith "Not implemented"
|
| 7 |
+
|
| 8 |
+
(* Program end *)
|
| 9 |
+
|
| 10 |
+
(* Test cases *)
|
| 11 |
+
|
| 12 |
+
let test1 _ = assert_equal true (strongPasswordCheckerII "IloveLe3tcode!")
|
| 13 |
+
|
| 14 |
+
let test2 _ = assert_equal false (strongPasswordCheckerII "Me+You--IsMyDream")
|
| 15 |
+
|
| 16 |
+
let test3 _ = assert_equal false (strongPasswordCheckerII "1aB!")
|
| 17 |
+
|
| 18 |
+
let test4 _ = assert_equal false (strongPasswordCheckerII " k n U $ 3 l r n ")
|
| 19 |
+
|
| 20 |
+
let test5 _ = assert_equal false (strongPasswordCheckerII " 2 O W ^ k X r 1 ")
|
| 21 |
+
|
| 22 |
+
let test6 _ = assert_equal false (strongPasswordCheckerII " J & h 5 I 2 k @ ")
|
| 23 |
+
|
| 24 |
+
let test7 _ = assert_equal false (strongPasswordCheckerII " W h * 2 r ) @ G ")
|
| 25 |
+
|
| 26 |
+
let test8 _ = assert_equal false (strongPasswordCheckerII " W b y & f 5 K f ")
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
(* Grouping test cases *)
|
| 30 |
+
let suite = "Test Suite for strongPasswordCheckerII" >::: [
|
| 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
|