DatasetRepo commited on
Commit
e5db8da
·
verified ·
1 Parent(s): abac9f7

e772cc7a8a95bda60bf7cb1bb77defcf817c3f9d50800e835dc9b9b3aacafce0

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 +3 -0
  2. shortest_string_that_contains_three_strings/meta.json +107 -0
  3. shortest_string_that_contains_three_strings/ocaml_tests/main.ml +26 -0
  4. shortest_string_that_contains_three_strings/scala_tests/MySuite.scala +12 -0
  5. shortest_subarray_with_or_at_least_k_i/haskell_tests/Main.hs +45 -0
  6. shortest_subarray_with_or_at_least_k_i/java_tests/Main.java +25 -0
  7. shortest_subarray_with_or_at_least_k_i/meta.json +308 -0
  8. shortest_subarray_with_or_at_least_k_i/ocaml_tests/main.ml +50 -0
  9. shortest_subarray_with_or_at_least_k_i/scala_tests/MySuite.scala +44 -0
  10. shortest_subarray_with_or_at_least_k_ii/haskell_tests/Main.hs +0 -0
  11. shortest_subarray_with_or_at_least_k_ii/java_tests/Main.java +25 -0
  12. shortest_subarray_with_or_at_least_k_ii/meta.json +3 -0
  13. shortest_subarray_with_or_at_least_k_ii/ocaml_tests/main.ml +0 -0
  14. shortest_subarray_with_or_at_least_k_ii/scala_tests/MySuite.scala +0 -0
  15. shortest_uncommon_substring_in_an_array/java_tests/Main.java +20 -0
  16. sliding_subarray_beauty/.DS_Store +0 -0
  17. sliding_subarray_beauty/haskell_tests/Main.hs +27 -0
  18. sliding_subarray_beauty/java_tests/Main.java +25 -0
  19. sliding_subarray_beauty/meta.json +3 -0
  20. sliding_subarray_beauty/ocaml_tests/main.ml +29 -0
  21. sliding_subarray_beauty/scala_tests/MySuite.scala +16 -0
  22. smallest_divisible_digit_product_i/haskell_tests/Main.hs +45 -0
  23. smallest_divisible_digit_product_i/java_tests/Main.java +21 -0
  24. smallest_divisible_digit_product_i/meta.json +97 -0
  25. smallest_divisible_digit_product_i/ocaml_tests/main.ml +50 -0
  26. smallest_divisible_digit_product_i/scala_tests/MySuite.scala +44 -0
  27. smallest_divisible_digit_product_ii/haskell_tests/Main.hs +0 -0
  28. smallest_divisible_digit_product_ii/java_tests/Main.java +25 -0
  29. smallest_divisible_digit_product_ii/meta.json +0 -0
  30. smallest_divisible_digit_product_ii/ocaml_tests/main.ml +0 -0
  31. smallest_divisible_digit_product_ii/scala_tests/MySuite.scala +0 -0
  32. smallest_missing_integer_greater_than_sequential_prefix_sum/haskell_tests/Main.hs +41 -0
  33. smallest_missing_integer_greater_than_sequential_prefix_sum/java_tests/Main.java +20 -0
  34. smallest_missing_integer_greater_than_sequential_prefix_sum/meta.json +144 -0
  35. smallest_missing_integer_greater_than_sequential_prefix_sum/ocaml_tests/main.ml +42 -0
  36. smallest_missing_integer_greater_than_sequential_prefix_sum/scala_tests/MySuite.scala +32 -0
  37. smallest_missing_non_negative_integer_after_operations/.DS_Store +0 -0
  38. smallest_missing_non_negative_integer_after_operations/haskell_tests/Main.hs +24 -0
  39. smallest_missing_non_negative_integer_after_operations/java_tests/Main.java +21 -0
  40. smallest_missing_non_negative_integer_after_operations/meta.json +3 -0
  41. smallest_missing_non_negative_integer_after_operations/ocaml_tests/main.ml +26 -0
  42. smallest_missing_non_negative_integer_after_operations/scala_tests/MySuite.scala +12 -0
  43. smallest_subarrays_with_maximum_bitwise_or/.DS_Store +0 -0
  44. smallest_subarrays_with_maximum_bitwise_or/haskell_tests/Main.hs +24 -0
  45. smallest_subarrays_with_maximum_bitwise_or/java_tests/Main.java +21 -0
  46. smallest_subarrays_with_maximum_bitwise_or/meta.json +0 -0
  47. smallest_subarrays_with_maximum_bitwise_or/ocaml_tests/main.ml +26 -0
  48. smallest_subarrays_with_maximum_bitwise_or/scala_tests/MySuite.scala +12 -0
  49. smallest_substring_with_identical_characters_i/haskell_tests/Main.hs +45 -0
  50. smallest_substring_with_identical_characters_i/java_tests/Main.java +21 -0
.gitattributes CHANGED
@@ -275,3 +275,6 @@ replace_non_coprime_numbers_in_array/meta.json filter=lfs diff=lfs merge=lfs -te
275
  robot_collisions/meta.json filter=lfs diff=lfs merge=lfs -text
276
  shifting_letters_ii/meta.json filter=lfs diff=lfs merge=lfs -text
277
  shortest_impossible_sequence_of_rolls/meta.json filter=lfs diff=lfs merge=lfs -text
 
 
 
 
275
  robot_collisions/meta.json filter=lfs diff=lfs merge=lfs -text
276
  shifting_letters_ii/meta.json filter=lfs diff=lfs merge=lfs -text
277
  shortest_impossible_sequence_of_rolls/meta.json filter=lfs diff=lfs merge=lfs -text
278
+ shortest_subarray_with_or_at_least_k_ii/meta.json filter=lfs diff=lfs merge=lfs -text
279
+ 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
shortest_string_that_contains_three_strings/meta.json ADDED
@@ -0,0 +1,107 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "id": 2877,
3
+ "name": "shortest_string_that_contains_three_strings",
4
+ "difficulty": "Medium",
5
+ "link": "https://leetcode.com/problems/shortest-string-that-contains-three-strings/",
6
+ "date": "1690070400000",
7
+ "task_description": "Given three strings `a`, `b`, and `c`, your task is to find a string that has the** minimum** length and contains all three strings as **substrings**. If there are multiple such strings, return the_ _**lexicographically_ _smallest **one. Return _a string denoting the answer to the problem._ **Notes** A string `a` is **lexicographically smaller** than a string `b` (of the same length) if in the first position where `a` and `b` differ, string `a` has a letter that appears **earlier **in the alphabet than the corresponding letter in `b`. A **substring** is a contiguous sequence of characters within a string. **Example 1:** ``` **Input:** a = \"abc\", b = \"bca\", c = \"aaa\" **Output:** \"aaabca\" **Explanation:** We show that \"aaabca\" contains all the given strings: a = ans[2...4], b = ans[3..5], c = ans[0..2]. It can be shown that the length of the resulting string would be at least 6 and \"aaabca\" is the lexicographically smallest one. ``` **Example 2:** ``` **Input:** a = \"ab\", b = \"ba\", c = \"aba\" **Output:** \"aba\" **Explanation: **We show that the string \"aba\" contains all the given strings: a = ans[0..1], b = ans[1..2], c = ans[0..2]. Since the length of c is 3, the length of the resulting string would be at least 3. It can be shown that \"aba\" is the lexicographically smallest one. ``` **Constraints:** `1 <= a.length, b.length, c.length <= 100` `a`, `b`, `c` consist only of lowercase English letters.",
8
+ "public_test_cases": [
9
+ {
10
+ "label": "Example 1",
11
+ "input": "a = \"abc\", b = \"bca\", c = \"aaa\"",
12
+ "output": "\"aaabca\" "
13
+ },
14
+ {
15
+ "label": "Example 2",
16
+ "input": "a = \"ab\", b = \"ba\", c = \"aba\"",
17
+ "output": "\"aba\" "
18
+ }
19
+ ],
20
+ "private_test_cases": [
21
+ {
22
+ "input": [
23
+ "\"wrgzetkwycvrgbirwclrwsblkfecsertsvaqgbrwpfprbwzbocsgodxwllwdrknyxitc\"",
24
+ "\"welaunojcdczlkxwsvcnqdrkaetpnjzfynwflvzgtmxmvgjrfpv\"",
25
+ "\"donsfsswccihyitepvoegeqpuugpomgvxidpvrjgtamybibwdgnynixcgvoorvqzxsivn\""
26
+ ],
27
+ "output": "donsfsswccihyitepvoegeqpuugpomgvxidpvrjgtamybibwdgnynixcgvoorvqzxsivnwelaunojcdczlkxwsvcnqdrkaetpnjzfynwflvzgtmxmvgjrfpvwrgzetkwycvrgbirwclrwsblkfecsertsvaqgbrwpfprbwzbocsgodxwllwdrknyxitc"
28
+ },
29
+ {
30
+ "input": [
31
+ "\"asigvexrzpfmorvvvnscwqnpniqezvxiv\"",
32
+ "\"tfqajcelaqupacpizucsjqfxxi\"",
33
+ "\"ssrbvodscludzisopjkmygcgpynvwnzrsasgxrmukqgofpswxahqljtiee\""
34
+ ],
35
+ "output": "asigvexrzpfmorvvvnscwqnpniqezvxivssrbvodscludzisopjkmygcgpynvwnzrsasgxrmukqgofpswxahqljtieetfqajcelaqupacpizucsjqfxxi"
36
+ },
37
+ {
38
+ "input": [
39
+ "\"xuavyormuebkvvoubjhaupmqvhdwwkmnrycauhrxsnqvtroiwvwevqgdqao\"",
40
+ "\"hldznvfqomsmncuaigxonrywewxfhlxhlctekjdgdymhoqabqgcalqwgeyitgyoxsdasddvntg\"",
41
+ "\"qvhqhuvovfxosgzkolzftbhmqbzjvnjwxbbduiqawwvwjrzscudvbzzpooiyubpcfmakcdajgqmpkjmryimhsiuenlaebux\""
42
+ ],
43
+ "output": "hldznvfqomsmncuaigxonrywewxfhlxhlctekjdgdymhoqabqgcalqwgeyitgyoxsdasddvntgqvhqhuvovfxosgzkolzftbhmqbzjvnjwxbbduiqawwvwjrzscudvbzzpooiyubpcfmakcdajgqmpkjmryimhsiuenlaebuxuavyormuebkvvoubjhaupmqvhdwwkmnrycauhrxsnqvtroiwvwevqgdqao"
44
+ },
45
+ {
46
+ "input": [
47
+ "\"chawduquqsxdvkazntomogvtnwaye\"",
48
+ "\"vpydaguxlrmdrnifusdxvuqtlgovvukxzvpkkltrcrsygaubqxqadahxizbmhsobvqorhsxgfuyong\"",
49
+ "\"epnvrgokwfpqzfjeewjrfoedkcbnpohpwzjoyzyxthspbsqkiemgcvhpdwgulkwcvjgsdwwgtzujnebillgxwrqticxzrjeqdy\""
50
+ ],
51
+ "output": "chawduquqsxdvkazntomogvtnwayepnvrgokwfpqzfjeewjrfoedkcbnpohpwzjoyzyxthspbsqkiemgcvhpdwgulkwcvjgsdwwgtzujnebillgxwrqticxzrjeqdyvpydaguxlrmdrnifusdxvuqtlgovvukxzvpkkltrcrsygaubqxqadahxizbmhsobvqorhsxgfuyong"
52
+ },
53
+ {
54
+ "input": [
55
+ "\"mvzsexjyjlpdnijvmooi\"",
56
+ "\"qwalgakythuyisqnohqaecwjmkzfexoxkbanfochftvebyoswpsptegvwfyeevjmrfgt\"",
57
+ "\"tutpewbuzyuuqmxpfrqnwrhunvwptjvmvcrqbbhapeycevowctorbipzivgzvcg\""
58
+ ],
59
+ "output": "mvzsexjyjlpdnijvmooiqwalgakythuyisqnohqaecwjmkzfexoxkbanfochftvebyoswpsptegvwfyeevjmrfgtutpewbuzyuuqmxpfrqnwrhunvwptjvmvcrqbbhapeycevowctorbipzivgzvcg"
60
+ },
61
+ {
62
+ "input": [
63
+ "\"vtzfav\"",
64
+ "\"rmyuzojrsmarrperkdnboojzmzwuunbfkhuypwhpouxsrtbpdy\"",
65
+ "\"xzeqjrphbdfgwdctrbzmggxshcteroifystaecbkqozdpfcjivawqqknokfueljqwrpsujtwjiqefj\""
66
+ ],
67
+ "output": "rmyuzojrsmarrperkdnboojzmzwuunbfkhuypwhpouxsrtbpdyvtzfavxzeqjrphbdfgwdctrbzmggxshcteroifystaecbkqozdpfcjivawqqknokfueljqwrpsujtwjiqefj"
68
+ },
69
+ {
70
+ "input": [
71
+ "\"lwxsqaxhnspgnmiyhchuyutervllkafqlpwhkfheqshbslcqxtlnnsbgfvslmybcxpogbwrrgwaufscnobbaqtyrjzyhfonrzwyj\"",
72
+ "\"qelfibnsshwxrezdrvcyokwbbmiejorrghbvxgvtbhlmglgmxxdomdbhiaolpcwrmrwhsjhrdxvsylugpy\"",
73
+ "\"sdzjnhkgtumlhnpdpwnpnajwwgqpdknxihjprfztlalpaktu\""
74
+ ],
75
+ "output": "lwxsqaxhnspgnmiyhchuyutervllkafqlpwhkfheqshbslcqxtlnnsbgfvslmybcxpogbwrrgwaufscnobbaqtyrjzyhfonrzwyjqelfibnsshwxrezdrvcyokwbbmiejorrghbvxgvtbhlmglgmxxdomdbhiaolpcwrmrwhsjhrdxvsylugpysdzjnhkgtumlhnpdpwnpnajwwgqpdknxihjprfztlalpaktu"
76
+ },
77
+ {
78
+ "input": [
79
+ "jetiayntmsvinhnausvipvm",
80
+ "uodgvemykvyxrnwnuqffyrnezfvnlopnvmpdasoddjwievdtzjgoaroylmdmbfkncuvhqfckgknbeyyrbavfwyzeodqsg",
81
+ "pitawhxiwobktcxzvaokqejexhcvptrpowgkizcrbufvtozijkknfyreffmftomnssm"
82
+ ],
83
+ "output": "jetiayntmsvinhnausvipvmpitawhxiwobktcxzvaokqejexhcvptrpowgkizcrbufvtozijkknfyreffmftomnssmuodgvemykvyxrnwnuqffyrnezfvnlopnvmpdasoddjwievdtzjgoaroylmdmbfkncuvhqfckgknbeyyrbavfwyzeodqsg"
84
+ },
85
+ {
86
+ "input": [
87
+ "rsbtxhhveiwkzbtholezcathmxfvjjylqj",
88
+ "kfkrjxwlmdjryosfwvihpqeirbqhhbaxrkzdsyutdvdfsoljfxmtghglwlhozzulyvhtbrpwhszksjxqkxkqoyqxqnt",
89
+ "twidpgqgspgudpoxibzzwyvqiwfkujjoeazxjdydurfjqfafgsnvxymrekwlmwcosakcbhsxpmkkmdovpssrfjfwlraeoxi"
90
+ ],
91
+ "output": "kfkrjxwlmdjryosfwvihpqeirbqhhbaxrkzdsyutdvdfsoljfxmtghglwlhozzulyvhtbrpwhszksjxqkxkqoyqxqntwidpgqgspgudpoxibzzwyvqiwfkujjoeazxjdydurfjqfafgsnvxymrekwlmwcosakcbhsxpmkkmdovpssrfjfwlraeoxirsbtxhhveiwkzbtholezcathmxfvjjylqj"
92
+ },
93
+ {
94
+ "input": [
95
+ "foycvolzkbafijihpaffpmbohpxekfwmrmjkqlyuinxdnxmvbnmgdjwzploaanuyvphvstsjypeejzmfsuqjafloycjwggqae",
96
+ "physhjizrulnpjnhawppmbodqnfsndfatunrydrsnhplisxtfeaxepmtoomvbvbxgcbvucygplkql",
97
+ "fqudtkzpoweczosdltursuiwzxapsoyitaltdgbadqphessrhnwxipcijtb"
98
+ ],
99
+ "output": "foycvolzkbafijihpaffpmbohpxekfwmrmjkqlyuinxdnxmvbnmgdjwzploaanuyvphvstsjypeejzmfsuqjafloycjwggqaefqudtkzpoweczosdltursuiwzxapsoyitaltdgbadqphessrhnwxipcijtbphyshjizrulnpjnhawppmbodqnfsndfatunrydrsnhplisxtfeaxepmtoomvbvbxgcbvucygplkql"
100
+ }
101
+ ],
102
+ "haskell_template": "minimumString :: String -> String -> String -> String\nminimumString a b c ",
103
+ "ocaml_template": "let minimumString (a: string) (b: string) (c: string) : string = ",
104
+ "scala_template": "def minimumString(a: String,b: String,c: String): String = { \n \n}",
105
+ "java_template": "public static String minimumString(String a, String b, String c) {\n\n}",
106
+ "python_template": "class Solution(object):\n def minimumString(self, a, b, c):\n \"\"\"\n :type a: str\n :type b: str\n :type c: str\n :rtype: str\n \"\"\"\n "
107
+ }
shortest_string_that_contains_three_strings/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 "aaabca" (minimumString "abc" "bca" "aaa")
12
+
13
+ let test2 _ = assert_equal "aba" (minimumString "ab" "ba" "aba")
14
+
15
+
16
+ (* Grouping test cases *)
17
+ let suite = "Test Suite for minimumString" >::: [
18
+
19
+ "test1" >:: test1;
20
+ "test2" >:: test2;
21
+ ]
22
+
23
+
24
+ (* Running the tests *)
25
+ let () = run_test_tt_main suite
26
+ end
shortest_string_that_contains_three_strings/scala_tests/MySuite.scala ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ class MySuite extends munit.FunSuite {
3
+
4
+ test("test1") {
5
+ assertEquals(Main.minimumString("abc","bca","aaa"), "aaabca")
6
+ }
7
+
8
+ test("test2") {
9
+ assertEquals(Main.minimumString("ab","ba","aba"), "aba")
10
+ }
11
+
12
+ }
shortest_subarray_with_or_at_least_k_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 (minimumSubarrayLength [1,2,3] 2)," 1 (minimumSubarrayLength [1,2,3] 2))
13
+
14
+ test2 :: Test
15
+ test2 = TestCase (assertEqual "for (minimumSubarrayLength [2,1,8] 10)," 3 (minimumSubarrayLength [2,1,8] 10))
16
+
17
+ test3 :: Test
18
+ test3 = TestCase (assertEqual "for (minimumSubarrayLength [1,2] 0)," 1 (minimumSubarrayLength [1,2] 0))
19
+
20
+ test4 :: Test
21
+ test4 = TestCase (assertEqual "for (minimumSubarrayLength [22, 31, 32, 30, 43, 26, 31, 22, 18, 22, 35, 8, 24, 12] 47)," 2 (minimumSubarrayLength [22, 31, 32, 30, 43, 26, 31, 22, 18, 22, 35, 8, 24, 12] 47))
22
+
23
+ test5 :: Test
24
+ test5 = TestCase (assertEqual "for (minimumSubarrayLength [4, 39, 7, 38, 9, 15, 31, 20, 4, 2, 36, 41, 27, 38, 42] 60)," 2 (minimumSubarrayLength [4, 39, 7, 38, 9, 15, 31, 20, 4, 2, 36, 41, 27, 38, 42] 60))
25
+
26
+ test6 :: Test
27
+ test6 = TestCase (assertEqual "for (minimumSubarrayLength [1, 21, 41, 7, 42, 24, 16, 22, 16, 1, 8, 3, 8, 32, 21, 11, 4, 22, 35, 27, 24] 33)," 1 (minimumSubarrayLength [1, 21, 41, 7, 42, 24, 16, 22, 16, 1, 8, 3, 8, 32, 21, 11, 4, 22, 35, 27, 24] 33))
28
+
29
+ test7 :: Test
30
+ test7 = TestCase (assertEqual "for (minimumSubarrayLength [15, 40, 37, 16, 33, 6, 49, 25, 32, 48, 34, 23, 9, 46, 9, 45, 32, 34, 42, 16, 14, 3, 50, 5, 22, 17, 50] 44)," 1 (minimumSubarrayLength [15, 40, 37, 16, 33, 6, 49, 25, 32, 48, 34, 23, 9, 46, 9, 45, 32, 34, 42, 16, 14, 3, 50, 5, 22, 17, 50] 44))
31
+
32
+ test8 :: Test
33
+ test8 = TestCase (assertEqual "for (minimumSubarrayLength [8, 30, 41, 14, 5, 17, 17, 4, 46, 0, 48, 22, 44, 26, 48, 10, 22, 44, 14, 29, 9, 30] 13)," 1 (minimumSubarrayLength [8, 30, 41, 14, 5, 17, 17, 4, 46, 0, 48, 22, 44, 26, 48, 10, 22, 44, 14, 29, 9, 30] 13))
34
+
35
+ test9 :: Test
36
+ test9 = TestCase (assertEqual "for (minimumSubarrayLength [19, 45, 49, 7, 49, 42, 44, 14, 23, 11, 49, 35, 43, 22, 29, 48, 42, 19, 17, 26, 24, 42, 43, 16, 30, 44, 18, 25, 32, 12, 12, 18, 19, 15, 9, 4] 55)," 2 (minimumSubarrayLength [19, 45, 49, 7, 49, 42, 44, 14, 23, 11, 49, 35, 43, 22, 29, 48, 42, 19, 17, 26, 24, 42, 43, 16, 30, 44, 18, 25, 32, 12, 12, 18, 19, 15, 9, 4] 55))
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
shortest_subarray_with_or_at_least_k_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(1, minimumSubarrayLength(new ArrayList<>(Arrays.asList(1,2,3)), 2));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals(3, minimumSubarrayLength(new ArrayList<>(Arrays.asList(2,1,8)), 10));
19
+ }
20
+ @Test
21
+ public void test3() {
22
+ assertEquals(1, minimumSubarrayLength(new ArrayList<>(Arrays.asList(1,2)), 0));
23
+ }
24
+
25
+ }
shortest_subarray_with_or_at_least_k_i/meta.json ADDED
@@ -0,0 +1,308 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "id": 3381,
3
+ "name": "shortest_subarray_with_or_at_least_k_i",
4
+ "difficulty": "Easy",
5
+ "link": "https://leetcode.com/problems/shortest-subarray-with-or-at-least-k-i/",
6
+ "date": "2024-03-16 00:00:00",
7
+ "task_description": "You are given an array `nums` of **non-negative** integers and an integer `k`. An array is called **special** if the bitwise `OR` of all of its elements is **at least** `k`. Return _the length of the **shortest** **special** **non-empty** subarray of_ `nums`, _or return_ `-1` _if no special subarray exists_. **Example 1:** **Input:** nums = [1,2,3], k = 2 **Output:** 1 **Explanation:** The subarray `[3]` has `OR` value of `3`. Hence, we return `1`. Note that `[2]` is also a special subarray. **Example 2:** **Input:** nums = [2,1,8], k = 10 **Output:** 3 **Explanation:** The subarray `[2,1,8]` has `OR` value of `11`. Hence, we return `3`. **Example 3:** **Input:** nums = [1,2], k = 0 **Output:** 1 **Explanation:** The subarray `[1]` has `OR` value of `1`. Hence, we return `1`. **Constraints:** `1 <= nums.length <= 50` `0 <= nums[i] <= 50` `0 <= k < 64`",
8
+ "public_test_cases": [
9
+ {
10
+ "label": "Example 1",
11
+ "input": "nums = [1,2,3], k = 2",
12
+ "output": "1 "
13
+ },
14
+ {
15
+ "label": "Example 2",
16
+ "input": "nums = [2,1,8], k = 10",
17
+ "output": "3 "
18
+ },
19
+ {
20
+ "label": "Example 3",
21
+ "input": "nums = [1,2], k = 0",
22
+ "output": "1 "
23
+ }
24
+ ],
25
+ "private_test_cases": [
26
+ {
27
+ "input": [
28
+ [
29
+ 22,
30
+ 31,
31
+ 32,
32
+ 30,
33
+ 43,
34
+ 26,
35
+ 31,
36
+ 22,
37
+ 18,
38
+ 22,
39
+ 35,
40
+ 8,
41
+ 24,
42
+ 12
43
+ ],
44
+ 47
45
+ ],
46
+ "output": 2
47
+ },
48
+ {
49
+ "input": [
50
+ [
51
+ 4,
52
+ 39,
53
+ 7,
54
+ 38,
55
+ 9,
56
+ 15,
57
+ 31,
58
+ 20,
59
+ 4,
60
+ 2,
61
+ 36,
62
+ 41,
63
+ 27,
64
+ 38,
65
+ 42
66
+ ],
67
+ 60
68
+ ],
69
+ "output": 2
70
+ },
71
+ {
72
+ "input": [
73
+ [
74
+ 1,
75
+ 21,
76
+ 41,
77
+ 7,
78
+ 42,
79
+ 24,
80
+ 16,
81
+ 22,
82
+ 16,
83
+ 1,
84
+ 8,
85
+ 3,
86
+ 8,
87
+ 32,
88
+ 21,
89
+ 11,
90
+ 4,
91
+ 22,
92
+ 35,
93
+ 27,
94
+ 24
95
+ ],
96
+ 33
97
+ ],
98
+ "output": 1
99
+ },
100
+ {
101
+ "input": [
102
+ [
103
+ 15,
104
+ 40,
105
+ 37,
106
+ 16,
107
+ 33,
108
+ 6,
109
+ 49,
110
+ 25,
111
+ 32,
112
+ 48,
113
+ 34,
114
+ 23,
115
+ 9,
116
+ 46,
117
+ 9,
118
+ 45,
119
+ 32,
120
+ 34,
121
+ 42,
122
+ 16,
123
+ 14,
124
+ 3,
125
+ 50,
126
+ 5,
127
+ 22,
128
+ 17,
129
+ 50
130
+ ],
131
+ 44
132
+ ],
133
+ "output": 1
134
+ },
135
+ {
136
+ "input": [
137
+ [
138
+ 8,
139
+ 30,
140
+ 41,
141
+ 14,
142
+ 5,
143
+ 17,
144
+ 17,
145
+ 4,
146
+ 46,
147
+ 0,
148
+ 48,
149
+ 22,
150
+ 44,
151
+ 26,
152
+ 48,
153
+ 10,
154
+ 22,
155
+ 44,
156
+ 14,
157
+ 29,
158
+ 9,
159
+ 30
160
+ ],
161
+ 13
162
+ ],
163
+ "output": 1
164
+ },
165
+ {
166
+ "input": [
167
+ [
168
+ 19,
169
+ 45,
170
+ 49,
171
+ 7,
172
+ 49,
173
+ 42,
174
+ 44,
175
+ 14,
176
+ 23,
177
+ 11,
178
+ 49,
179
+ 35,
180
+ 43,
181
+ 22,
182
+ 29,
183
+ 48,
184
+ 42,
185
+ 19,
186
+ 17,
187
+ 26,
188
+ 24,
189
+ 42,
190
+ 43,
191
+ 16,
192
+ 30,
193
+ 44,
194
+ 18,
195
+ 25,
196
+ 32,
197
+ 12,
198
+ 12,
199
+ 18,
200
+ 19,
201
+ 15,
202
+ 9,
203
+ 4
204
+ ],
205
+ 55
206
+ ],
207
+ "output": 2
208
+ },
209
+ {
210
+ "input": [
211
+ [
212
+ 40,
213
+ 17,
214
+ 33,
215
+ 21,
216
+ 29,
217
+ 36,
218
+ 7,
219
+ 6,
220
+ 22,
221
+ 42,
222
+ 31
223
+ ],
224
+ 46
225
+ ],
226
+ "output": 2
227
+ },
228
+ {
229
+ "input": [
230
+ [
231
+ 2,
232
+ 31,
233
+ 49,
234
+ 26,
235
+ 46,
236
+ 15,
237
+ 16,
238
+ 46,
239
+ 7,
240
+ 27,
241
+ 32,
242
+ 2,
243
+ 48,
244
+ 45,
245
+ 9,
246
+ 46,
247
+ 30,
248
+ 10,
249
+ 18
250
+ ],
251
+ 55
252
+ ],
253
+ "output": 2
254
+ },
255
+ {
256
+ "input": [
257
+ [
258
+ 33,
259
+ 43,
260
+ 49,
261
+ 18,
262
+ 21,
263
+ 40
264
+ ],
265
+ 49
266
+ ],
267
+ "output": 1
268
+ },
269
+ {
270
+ "input": [
271
+ [
272
+ 1,
273
+ 12,
274
+ 9,
275
+ 0,
276
+ 21,
277
+ 29,
278
+ 21,
279
+ 4,
280
+ 2,
281
+ 15,
282
+ 16,
283
+ 2,
284
+ 15,
285
+ 13,
286
+ 49,
287
+ 17,
288
+ 18,
289
+ 32,
290
+ 50,
291
+ 49,
292
+ 26,
293
+ 28,
294
+ 10,
295
+ 20,
296
+ 12
297
+ ],
298
+ 20
299
+ ],
300
+ "output": 1
301
+ }
302
+ ],
303
+ "haskell_template": "minimumSubarrayLength :: [Int] -> Int -> Int\nminimumSubarrayLength nums k ",
304
+ "ocaml_template": "let minimumSubarrayLength (nums: int list) (k: int) : int = ",
305
+ "scala_template": "def minimumSubarrayLength(nums: List[Int],k: Int): Int = { \n \n}",
306
+ "java_template": "class Solution {\n public int minimumSubarrayLength(int[] nums, int k) {\n \n }\n}",
307
+ "python_template": "class Solution(object):\n def minimumSubarrayLength(self, nums, k):\n \"\"\"\n :type nums: List[int]\n :type k: int\n :rtype: int\n \"\"\"\n "
308
+ }
shortest_subarray_with_or_at_least_k_i/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 1 (minimumSubarrayLength [1;2;3] 2)
12
+
13
+ let test2 _ = assert_equal 3 (minimumSubarrayLength [2;1;8] 10)
14
+
15
+ let test3 _ = assert_equal 1 (minimumSubarrayLength [1;2] 0)
16
+
17
+ let test4 _ = assert_equal 2 (minimumSubarrayLength [22; 31; 32; 30; 43; 26; 31; 22; 18; 22; 35; 8; 24; 12] 47)
18
+
19
+ let test5 _ = assert_equal 2 (minimumSubarrayLength [4; 39; 7; 38; 9; 15; 31; 20; 4; 2; 36; 41; 27; 38; 42] 60)
20
+
21
+ let test6 _ = assert_equal 1 (minimumSubarrayLength [1; 21; 41; 7; 42; 24; 16; 22; 16; 1; 8; 3; 8; 32; 21; 11; 4; 22; 35; 27; 24] 33)
22
+
23
+ let test7 _ = assert_equal 1 (minimumSubarrayLength [15; 40; 37; 16; 33; 6; 49; 25; 32; 48; 34; 23; 9; 46; 9; 45; 32; 34; 42; 16; 14; 3; 50; 5; 22; 17; 50] 44)
24
+
25
+ let test8 _ = assert_equal 1 (minimumSubarrayLength [8; 30; 41; 14; 5; 17; 17; 4; 46; 0; 48; 22; 44; 26; 48; 10; 22; 44; 14; 29; 9; 30] 13)
26
+
27
+ let test9 _ = assert_equal 2 (minimumSubarrayLength [19; 45; 49; 7; 49; 42; 44; 14; 23; 11; 49; 35; 43; 22; 29; 48; 42; 19; 17; 26; 24; 42; 43; 16; 30; 44; 18; 25; 32; 12; 12; 18; 19; 15; 9; 4] 55)
28
+
29
+ let test10 _ = assert_equal 2 (minimumSubarrayLength [40; 17; 33; 21; 29; 36; 7; 6; 22; 42; 31] 46)
30
+
31
+
32
+ (* Grouping test cases *)
33
+ let suite = "Test Suite for minimumSubarrayLength" >::: [
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
shortest_subarray_with_or_at_least_k_i/scala_tests/MySuite.scala ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ class MySuite extends munit.FunSuite {
3
+
4
+ test("test1") {
5
+ assertEquals(Main.minimumSubarrayLength(List(1,2,3),2), 1)
6
+ }
7
+
8
+ test("test2") {
9
+ assertEquals(Main.minimumSubarrayLength(List(2,1,8),10), 3)
10
+ }
11
+
12
+ test("test3") {
13
+ assertEquals(Main.minimumSubarrayLength(List(1,2),0), 1)
14
+ }
15
+
16
+ test("test4") {
17
+ assertEquals(Main.minimumSubarrayLength(List(22, 31, 32, 30, 43, 26, 31, 22, 18, 22, 35, 8, 24, 12),47), 2)
18
+ }
19
+
20
+ test("test5") {
21
+ assertEquals(Main.minimumSubarrayLength(List(4, 39, 7, 38, 9, 15, 31, 20, 4, 2, 36, 41, 27, 38, 42),60), 2)
22
+ }
23
+
24
+ test("test6") {
25
+ assertEquals(Main.minimumSubarrayLength(List(1, 21, 41, 7, 42, 24, 16, 22, 16, 1, 8, 3, 8, 32, 21, 11, 4, 22, 35, 27, 24),33), 1)
26
+ }
27
+
28
+ test("test7") {
29
+ assertEquals(Main.minimumSubarrayLength(List(15, 40, 37, 16, 33, 6, 49, 25, 32, 48, 34, 23, 9, 46, 9, 45, 32, 34, 42, 16, 14, 3, 50, 5, 22, 17, 50),44), 1)
30
+ }
31
+
32
+ test("test8") {
33
+ assertEquals(Main.minimumSubarrayLength(List(8, 30, 41, 14, 5, 17, 17, 4, 46, 0, 48, 22, 44, 26, 48, 10, 22, 44, 14, 29, 9, 30),13), 1)
34
+ }
35
+
36
+ test("test9") {
37
+ assertEquals(Main.minimumSubarrayLength(List(19, 45, 49, 7, 49, 42, 44, 14, 23, 11, 49, 35, 43, 22, 29, 48, 42, 19, 17, 26, 24, 42, 43, 16, 30, 44, 18, 25, 32, 12, 12, 18, 19, 15, 9, 4),55), 2)
38
+ }
39
+
40
+ test("test10") {
41
+ assertEquals(Main.minimumSubarrayLength(List(40, 17, 33, 21, 29, 36, 7, 6, 22, 42, 31),46), 2)
42
+ }
43
+
44
+ }
shortest_subarray_with_or_at_least_k_ii/haskell_tests/Main.hs ADDED
The diff for this file is too large to render. See raw diff
 
shortest_subarray_with_or_at_least_k_ii/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(1, minimumSubarrayLength(new ArrayList<>(Arrays.asList(1,2,3)), 2));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals(3, minimumSubarrayLength(new ArrayList<>(Arrays.asList(2,1,8)), 10));
19
+ }
20
+ @Test
21
+ public void test3() {
22
+ assertEquals(1, minimumSubarrayLength(new ArrayList<>(Arrays.asList(1,2)), 0));
23
+ }
24
+
25
+ }
shortest_subarray_with_or_at_least_k_ii/meta.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:97a2870e18e36f62bfae439c7de6d943e7e531576cd0d785dc1ec84a8711dccc
3
+ size 26784808
shortest_subarray_with_or_at_least_k_ii/ocaml_tests/main.ml ADDED
The diff for this file is too large to render. See raw diff
 
shortest_subarray_with_or_at_least_k_ii/scala_tests/MySuite.scala ADDED
The diff for this file is too large to render. See raw diff
 
shortest_uncommon_substring_in_an_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(Arrays.asList("ab","","ba",""), shortestSubstrings(Arrays.asList("cab","ad","bad","c")));
14
+ }
15
+ @Test
16
+ public void test2() {
17
+ assertEquals(Arrays.asList("","","abcd"), shortestSubstrings(Arrays.asList("abc","bcd","abcd")));
18
+ }
19
+
20
+ }
sliding_subarray_beauty/.DS_Store ADDED
Binary file (6.15 kB). View file
 
sliding_subarray_beauty/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 (getSubarrayBeauty [1,-1,-3,-2,3] 3 2)," [-1,-2,-2] (getSubarrayBeauty [1,-1,-3,-2,3] 3 2))
13
+
14
+ test2 :: Test
15
+ test2 = TestCase (assertEqual "for (getSubarrayBeauty [-1,-2,-3,-4,-5] 2 2)," [-1,-2,-3,-4] (getSubarrayBeauty [-1,-2,-3,-4,-5] 2 2))
16
+
17
+ test3 :: Test
18
+ test3 = TestCase (assertEqual "for (getSubarrayBeauty [-3,1,2,-3,0,-3] 2 1)," [-3,0,-3,-3,-3] (getSubarrayBeauty [-3,1,2,-3,0,-3] 2 1))
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
sliding_subarray_beauty/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,-2,-2)), getSubarrayBeauty(new ArrayList<>(Arrays.asList(1,-1,-3,-2,3)), 3, 2));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals(new ArrayList<>(Arrays.asList(-1,-2,-3,-4)), getSubarrayBeauty(new ArrayList<>(Arrays.asList(-1,-2,-3,-4,-5)), 2, 2));
19
+ }
20
+ @Test
21
+ public void test3() {
22
+ assertEquals(new ArrayList<>(Arrays.asList(-3,0,-3,-3,-3)), getSubarrayBeauty(new ArrayList<>(Arrays.asList(-3,1,2,-3,0,-3)), 2, 1));
23
+ }
24
+
25
+ }
sliding_subarray_beauty/meta.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1a2f536fe2079b2e0278fd8125f3f89e21acd7ff3b6895e838593551764b64c9
3
+ size 16245481
sliding_subarray_beauty/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;-2;-2] (getSubarrayBeauty [1;-1;-3;-2;3] 3 2)
12
+
13
+ let test2 _ = assert_equal [-1;-2;-3;-4] (getSubarrayBeauty [-1;-2;-3;-4;-5] 2 2)
14
+
15
+ let test3 _ = assert_equal [-3;0;-3;-3;-3] (getSubarrayBeauty [-3;1;2;-3;0;-3] 2 1)
16
+
17
+
18
+ (* Grouping test cases *)
19
+ let suite = "Test Suite for getSubarrayBeauty" >::: [
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
sliding_subarray_beauty/scala_tests/MySuite.scala ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ class MySuite extends munit.FunSuite {
3
+
4
+ test("test1") {
5
+ assertEquals(Main.getSubarrayBeauty(List(1,-1,-3,-2,3),3,2), List(-1,-2,-2))
6
+ }
7
+
8
+ test("test2") {
9
+ assertEquals(Main.getSubarrayBeauty(List(-1,-2,-3,-4,-5),2,2), List(-1,-2,-3,-4))
10
+ }
11
+
12
+ test("test3") {
13
+ assertEquals(Main.getSubarrayBeauty(List(-3,1,2,-3,0,-3),2,1), List(-3,0,-3,-3,-3))
14
+ }
15
+
16
+ }
smallest_divisible_digit_product_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 (smallestNumber 10 2)," 10 (smallestNumber 10 2))
13
+
14
+ test2 :: Test
15
+ test2 = TestCase (assertEqual "for (smallestNumber 15 3)," 16 (smallestNumber 15 3))
16
+
17
+ test3 :: Test
18
+ test3 = TestCase (assertEqual "for (smallestNumber 80 10)," 80 (smallestNumber 80 10))
19
+
20
+ test4 :: Test
21
+ test4 = TestCase (assertEqual "for (smallestNumber 95 10)," 100 (smallestNumber 95 10))
22
+
23
+ test5 :: Test
24
+ test5 = TestCase (assertEqual "for (smallestNumber 79 5)," 80 (smallestNumber 79 5))
25
+
26
+ test6 :: Test
27
+ test6 = TestCase (assertEqual "for (smallestNumber 61 1)," 61 (smallestNumber 61 1))
28
+
29
+ test7 :: Test
30
+ test7 = TestCase (assertEqual "for (smallestNumber 79 2)," 80 (smallestNumber 79 2))
31
+
32
+ test8 :: Test
33
+ test8 = TestCase (assertEqual "for (smallestNumber 96 10)," 100 (smallestNumber 96 10))
34
+
35
+ test9 :: Test
36
+ test9 = TestCase (assertEqual "for (smallestNumber 97 2)," 98 (smallestNumber 97 2))
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
smallest_divisible_digit_product_i/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(10, smallestNumber(10, 2));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals(16, smallestNumber(15, 3));
19
+ }
20
+
21
+ }
smallest_divisible_digit_product_i/meta.json ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "id": 3626,
3
+ "name": "smallest_divisible_digit_product_i",
4
+ "difficulty": "Easy",
5
+ "link": "https://leetcode.com/problems/smallest-divisible-digit-product-i/",
6
+ "date": "2024-10-26 00:00:00",
7
+ "task_description": "You are given two integers `n` and `t`. Return the **smallest** number greater than or equal to `n` such that the **product of its digits** is divisible by `t`. **Example 1:** **Input:** n = 10, t = 2 **Output:** 10 **Explanation:** The digit product of 10 is 0, which is divisible by 2, making it the smallest number greater than or equal to 10 that satisfies the condition. **Example 2:** **Input:** n = 15, t = 3 **Output:** 16 **Explanation:** The digit product of 16 is 6, which is divisible by 3, making it the smallest number greater than or equal to 15 that satisfies the condition. **Constraints:** `1 <= n <= 100` `1 <= t <= 10`",
8
+ "public_test_cases": [
9
+ {
10
+ "label": "Example 1",
11
+ "input": "n = 10, t = 2",
12
+ "output": "10 "
13
+ },
14
+ {
15
+ "label": "Example 2",
16
+ "input": "n = 15, t = 3",
17
+ "output": "16 "
18
+ }
19
+ ],
20
+ "private_test_cases": [
21
+ {
22
+ "input": [
23
+ 80,
24
+ 10
25
+ ],
26
+ "output": 80
27
+ },
28
+ {
29
+ "input": [
30
+ 95,
31
+ 10
32
+ ],
33
+ "output": 100
34
+ },
35
+ {
36
+ "input": [
37
+ 79,
38
+ 5
39
+ ],
40
+ "output": 80
41
+ },
42
+ {
43
+ "input": [
44
+ 61,
45
+ 1
46
+ ],
47
+ "output": 61
48
+ },
49
+ {
50
+ "input": [
51
+ 79,
52
+ 2
53
+ ],
54
+ "output": 80
55
+ },
56
+ {
57
+ "input": [
58
+ 96,
59
+ 10
60
+ ],
61
+ "output": 100
62
+ },
63
+ {
64
+ "input": [
65
+ 97,
66
+ 2
67
+ ],
68
+ "output": 98
69
+ },
70
+ {
71
+ "input": [
72
+ 9,
73
+ 5
74
+ ],
75
+ "output": 10
76
+ },
77
+ {
78
+ "input": [
79
+ 92,
80
+ 7
81
+ ],
82
+ "output": 97
83
+ },
84
+ {
85
+ "input": [
86
+ 41,
87
+ 4
88
+ ],
89
+ "output": 41
90
+ }
91
+ ],
92
+ "haskell_template": "smallestNumber :: Int -> Int -> Int\nsmallestNumber n t ",
93
+ "ocaml_template": "let smallestNumber (n: int) (t: int) : int = ",
94
+ "scala_template": "def smallestNumber(n: Int,t: Int): Int = { \n \n}",
95
+ "java_template": "class Solution {\n public int smallestNumber(int n, int t) {\n \n }\n}",
96
+ "python_template": "class Solution(object):\n def smallestNumber(self, n, t):\n \"\"\"\n :type n: int\n :type t: int\n :rtype: int\n \"\"\"\n "
97
+ }
smallest_divisible_digit_product_i/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 10 (smallestNumber 10 2)
12
+
13
+ let test2 _ = assert_equal 16 (smallestNumber 15 3)
14
+
15
+ let test3 _ = assert_equal 80 (smallestNumber 80 10)
16
+
17
+ let test4 _ = assert_equal 100 (smallestNumber 95 10)
18
+
19
+ let test5 _ = assert_equal 80 (smallestNumber 79 5)
20
+
21
+ let test6 _ = assert_equal 61 (smallestNumber 61 1)
22
+
23
+ let test7 _ = assert_equal 80 (smallestNumber 79 2)
24
+
25
+ let test8 _ = assert_equal 100 (smallestNumber 96 10)
26
+
27
+ let test9 _ = assert_equal 98 (smallestNumber 97 2)
28
+
29
+ let test10 _ = assert_equal 10 (smallestNumber 9 5)
30
+
31
+
32
+ (* Grouping test cases *)
33
+ let suite = "Test Suite for smallestNumber" >::: [
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
smallest_divisible_digit_product_i/scala_tests/MySuite.scala ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ class MySuite extends munit.FunSuite {
3
+
4
+ test("test1") {
5
+ assertEquals(Main.smallestNumber(10,2), 10)
6
+ }
7
+
8
+ test("test2") {
9
+ assertEquals(Main.smallestNumber(15,3), 16)
10
+ }
11
+
12
+ test("test3") {
13
+ assertEquals(Main.smallestNumber(80,10), 80)
14
+ }
15
+
16
+ test("test4") {
17
+ assertEquals(Main.smallestNumber(95,10), 100)
18
+ }
19
+
20
+ test("test5") {
21
+ assertEquals(Main.smallestNumber(79,5), 80)
22
+ }
23
+
24
+ test("test6") {
25
+ assertEquals(Main.smallestNumber(61,1), 61)
26
+ }
27
+
28
+ test("test7") {
29
+ assertEquals(Main.smallestNumber(79,2), 80)
30
+ }
31
+
32
+ test("test8") {
33
+ assertEquals(Main.smallestNumber(96,10), 100)
34
+ }
35
+
36
+ test("test9") {
37
+ assertEquals(Main.smallestNumber(97,2), 98)
38
+ }
39
+
40
+ test("test10") {
41
+ assertEquals(Main.smallestNumber(9,5), 10)
42
+ }
43
+
44
+ }
smallest_divisible_digit_product_ii/haskell_tests/Main.hs ADDED
The diff for this file is too large to render. See raw diff
 
smallest_divisible_digit_product_ii/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("256", smallestNumber("1234", 256));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals("50", smallestNumber("12355", 50));
19
+ }
20
+ @Test
21
+ public void test3() {
22
+ assertEquals("26", smallestNumber("11111", 26));
23
+ }
24
+
25
+ }
smallest_divisible_digit_product_ii/meta.json ADDED
The diff for this file is too large to render. See raw diff
 
smallest_divisible_digit_product_ii/ocaml_tests/main.ml ADDED
The diff for this file is too large to render. See raw diff
 
smallest_divisible_digit_product_ii/scala_tests/MySuite.scala ADDED
The diff for this file is too large to render. See raw diff
 
smallest_missing_integer_greater_than_sequential_prefix_sum/haskell_tests/Main.hs ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ module Main where
3
+ import Test.HUnit
4
+
5
+ --Program start
6
+ missingInteger :: [Int] -> Int
7
+ missingInteger nums = undefined
8
+
9
+ --Program end
10
+
11
+ -- Test cases
12
+
13
+ test1 :: Test
14
+ test1 = TestCase (assertEqual "for (missingInteger [1,2,3,2,5])," 6 (missingInteger [1,2,3,2,5]))
15
+
16
+ test2 :: Test
17
+ test2 = TestCase (assertEqual "for (missingInteger [3,4,5,1,12,14,13])," 15 (missingInteger [3,4,5,1,12,14,13]))
18
+
19
+ test3 :: Test
20
+ test3 = TestCase (assertEqual "for (missingInteger [7, 17, 38])," 8 (missingInteger [7, 17, 38]))
21
+
22
+ test4 :: Test
23
+ test4 = TestCase (assertEqual "for (missingInteger [7, 24, 7, 41, 18, 11, 16, 1, 26, 41])," 8 (missingInteger [7, 24, 7, 41, 18, 11, 16, 1, 26, 41]))
24
+
25
+ test5 :: Test
26
+ test5 = TestCase (assertEqual "for (missingInteger [12, 10, 39, 28, 40, 38, 33, 8, 31, 14, 32, 23, 48, 14, 19, 43, 18])," 13 (missingInteger [12, 10, 39, 28, 40, 38, 33, 8, 31, 14, 32, 23, 48, 14, 19, 43, 18]))
27
+
28
+ test6 :: Test
29
+ test6 = TestCase (assertEqual "for (missingInteger [11, 30, 12, 12, 30, 15, 13, 4, 44, 20, 1, 17, 28, 40, 24, 9, 22, 7, 23, 20, 12, 37, 13, 4, 47, 41, 23, 1, 1, 13, 9, 26, 27, 21, 39, 30, 42, 46, 34, 50, 3, 23])," 14 (missingInteger [11, 30, 12, 12, 30, 15, 13, 4, 44, 20, 1, 17, 28, 40, 24, 9, 22, 7, 23, 20, 12, 37, 13, 4, 47, 41, 23, 1, 1, 13, 9, 26, 27, 21, 39, 30, 42, 46, 34, 50, 3, 23]))
30
+
31
+ test7 :: Test
32
+ test7 = TestCase (assertEqual "for (missingInteger [26, 36, 4, 9, 48, 36, 27, 27, 48, 7, 34, 37, 14, 44, 16, 17, 7, 26, 16, 35])," 28 (missingInteger [26, 36, 4, 9, 48, 36, 27, 27, 48, 7, 34, 37, 14, 44, 16, 17, 7, 26, 16, 35]))
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
smallest_missing_integer_greater_than_sequential_prefix_sum/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(6, missingInteger(Arrays.asList(1,2,3,2,5)));
14
+ }
15
+ @Test
16
+ public void test2() {
17
+ assertEquals(15, missingInteger(Arrays.asList(3,4,5,1,12,14,13)));
18
+ }
19
+
20
+ }
smallest_missing_integer_greater_than_sequential_prefix_sum/meta.json ADDED
@@ -0,0 +1,144 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "id": 3236,
3
+ "name": "smallest_missing_integer_greater_than_sequential_prefix_sum",
4
+ "difficulty": "Easy",
5
+ "link": "https://leetcode.com/problems/smallest-missing-integer-greater-than-sequential-prefix-sum/",
6
+ "date": "2023-12-23 00:00:00",
7
+ "task_description": "You are given a **0-indexed** array of integers `nums`. A prefix `nums[0..i]` is **sequential** if, for all `1 <= j <= i`, `nums[j] = nums[j - 1] + 1`. In particular, the prefix consisting only of `nums[0]` is **sequential**. Return _the **smallest** integer_ `x` _missing from_ `nums` _such that_ `x` _is greater than or equal to the sum of the **longest** sequential prefix._ **Example 1:** ``` **Input:** nums = [1,2,3,2,5] **Output:** 6 **Explanation:** The longest sequential prefix of nums is [1,2,3] with a sum of 6. 6 is not in the array, therefore 6 is the smallest missing integer greater than or equal to the sum of the longest sequential prefix. ``` **Example 2:** ``` **Input:** nums = [3,4,5,1,12,14,13] **Output:** 15 **Explanation:** The longest sequential prefix of nums is [3,4,5] with a sum of 12. 12, 13, and 14 belong to the array while 15 does not. Therefore 15 is the smallest missing integer greater than or equal to the sum of the longest sequential prefix. ``` **Constraints:** `1 <= nums.length <= 50` `1 <= nums[i] <= 50`",
8
+ "public_test_cases": [
9
+ {
10
+ "label": "Example 1",
11
+ "input": "nums = [1,2,3,2,5]",
12
+ "output": "6 "
13
+ },
14
+ {
15
+ "label": "Example 2",
16
+ "input": "nums = [3,4,5,1,12,14,13]",
17
+ "output": "15 "
18
+ }
19
+ ],
20
+ "private_test_cases": [
21
+ {
22
+ "input": [
23
+ 7,
24
+ 17,
25
+ 38
26
+ ],
27
+ "output": 8
28
+ },
29
+ {
30
+ "input": [
31
+ 7,
32
+ 24,
33
+ 7,
34
+ 41,
35
+ 18,
36
+ 11,
37
+ 16,
38
+ 1,
39
+ 26,
40
+ 41
41
+ ],
42
+ "output": 8
43
+ },
44
+ {
45
+ "input": [
46
+ 12,
47
+ 10,
48
+ 39,
49
+ 28,
50
+ 40,
51
+ 38,
52
+ 33,
53
+ 8,
54
+ 31,
55
+ 14,
56
+ 32,
57
+ 23,
58
+ 48,
59
+ 14,
60
+ 19,
61
+ 43,
62
+ 18
63
+ ],
64
+ "output": 13
65
+ },
66
+ {
67
+ "input": [
68
+ 11,
69
+ 30,
70
+ 12,
71
+ 12,
72
+ 30,
73
+ 15,
74
+ 13,
75
+ 4,
76
+ 44,
77
+ 20,
78
+ 1,
79
+ 17,
80
+ 28,
81
+ 40,
82
+ 24,
83
+ 9,
84
+ 22,
85
+ 7,
86
+ 23,
87
+ 20,
88
+ 12,
89
+ 37,
90
+ 13,
91
+ 4,
92
+ 47,
93
+ 41,
94
+ 23,
95
+ 1,
96
+ 1,
97
+ 13,
98
+ 9,
99
+ 26,
100
+ 27,
101
+ 21,
102
+ 39,
103
+ 30,
104
+ 42,
105
+ 46,
106
+ 34,
107
+ 50,
108
+ 3,
109
+ 23
110
+ ],
111
+ "output": 14
112
+ },
113
+ {
114
+ "input": [
115
+ 26,
116
+ 36,
117
+ 4,
118
+ 9,
119
+ 48,
120
+ 36,
121
+ 27,
122
+ 27,
123
+ 48,
124
+ 7,
125
+ 34,
126
+ 37,
127
+ 14,
128
+ 44,
129
+ 16,
130
+ 17,
131
+ 7,
132
+ 26,
133
+ 16,
134
+ 35
135
+ ],
136
+ "output": 28
137
+ }
138
+ ],
139
+ "haskell_template": "missingInteger :: [Int] -> Int\nmissingInteger nums ",
140
+ "ocaml_template": "let missingInteger (nums: int list) : int = ",
141
+ "scala_template": "def missingInteger(nums: List[Int]): Int = { \n \n}",
142
+ "java_template": "class Solution {\n public int missingInteger(int[] nums) {\n \n }\n}",
143
+ "python_template": "class Solution(object):\n def missingInteger(self, nums):\n \"\"\"\n :type nums: List[int]\n :rtype: int\n \"\"\"\n "
144
+ }
smallest_missing_integer_greater_than_sequential_prefix_sum/ocaml_tests/main.ml ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ module Main = struct
3
+ open OUnit2
4
+
5
+ (* Program start *)
6
+ let missingInteger (nums: int list) : int = failwith "Not implemented"
7
+
8
+ (* Program end *)
9
+
10
+ (* Test cases *)
11
+
12
+ let test1 _ = assert_equal 6 (missingInteger [1;2;3;2;5])
13
+
14
+ let test2 _ = assert_equal 15 (missingInteger [3;4;5;1;12;14;13])
15
+
16
+ let test3 _ = assert_equal 15 (missingInteger [7; 17; 38])
17
+
18
+ let test4 _ = assert_equal 15 (missingInteger [7; 24; 7; 41; 18; 11; 16; 1; 26; 41])
19
+
20
+ let test5 _ = assert_equal 15 (missingInteger [12; 10; 39; 28; 40; 38; 33; 8; 31; 14; 32; 23; 48; 14; 19; 43; 18])
21
+
22
+ let test6 _ = assert_equal 15 (missingInteger [11; 30; 12; 12; 30; 15; 13; 4; 44; 20; 1; 17; 28; 40; 24; 9; 22; 7; 23; 20; 12; 37; 13; 4; 47; 41; 23; 1; 1; 13; 9; 26; 27; 21; 39; 30; 42; 46; 34; 50; 3; 23])
23
+
24
+ let test7 _ = assert_equal 15 (missingInteger [26; 36; 4; 9; 48; 36; 27; 27; 48; 7; 34; 37; 14; 44; 16; 17; 7; 26; 16; 35])
25
+
26
+
27
+ (* Grouping test cases *)
28
+ let suite = "Test Suite for missingInteger" >::: [
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
smallest_missing_integer_greater_than_sequential_prefix_sum/scala_tests/MySuite.scala ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ class MySuite extends munit.FunSuite {
3
+
4
+ test("test1") {
5
+ assertEquals(Main.missingInteger(List(1,2,3,2,5)), 6)
6
+ }
7
+
8
+ test("test2") {
9
+ assertEquals(Main.missingInteger(List(3,4,5,1,12,14,13)), 15)
10
+ }
11
+
12
+ test("test3") {
13
+ assertEquals(Main.missingInteger(7,17,38), 8)
14
+ }
15
+
16
+ test("test4") {
17
+ assertEquals(Main.missingInteger(7,24,7,41,18,11,16,1,26,41), 8)
18
+ }
19
+
20
+ test("test5") {
21
+ assertEquals(Main.missingInteger(12,10,39,28,40,38,33,8,31,14,32,23,48,14,19,43,18), 13)
22
+ }
23
+
24
+ test("test6") {
25
+ assertEquals(Main.missingInteger(11,30,12,12,30,15,13,4,44,20,1,17,28,40,24,9,22,7,23,20,12,37,13,4,47,41,23,1,1,13,9,26,27,21,39,30,42,46,34,50,3,23), 14)
26
+ }
27
+
28
+ test("test7") {
29
+ assertEquals(Main.missingInteger(26,36,4,9,48,36,27,27,48,7,34,37,14,44,16,17,7,26,16,35), 28)
30
+ }
31
+
32
+ }
smallest_missing_non_negative_integer_after_operations/.DS_Store ADDED
Binary file (6.15 kB). View file
 
smallest_missing_non_negative_integer_after_operations/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 (findSmallestInteger [1,-10,7,13,6,8] 5)," 4 (findSmallestInteger [1,-10,7,13,6,8] 5))
13
+
14
+ test2 :: Test
15
+ test2 = TestCase (assertEqual "for (findSmallestInteger [1,-10,7,13,6,8] 7)," 2 (findSmallestInteger [1,-10,7,13,6,8] 7))
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
smallest_missing_non_negative_integer_after_operations/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(4, findSmallestInteger(new ArrayList<>(Arrays.asList(1,-10,7,13,6,8)), 5));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals(2, findSmallestInteger(new ArrayList<>(Arrays.asList(1,-10,7,13,6,8)), 7));
19
+ }
20
+
21
+ }
smallest_missing_non_negative_integer_after_operations/meta.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:58577186bcc778141e25a299bcbeb02a5b9c0725321899f26a5e77f37821a8b3
3
+ size 13422702
smallest_missing_non_negative_integer_after_operations/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 4 (findSmallestInteger [1;-10;7;13;6;8] 5)
12
+
13
+ let test2 _ = assert_equal 2 (findSmallestInteger [1;-10;7;13;6;8] 7)
14
+
15
+
16
+ (* Grouping test cases *)
17
+ let suite = "Test Suite for findSmallestInteger" >::: [
18
+
19
+ "test1" >:: test1;
20
+ "test2" >:: test2;
21
+ ]
22
+
23
+
24
+ (* Running the tests *)
25
+ let () = run_test_tt_main suite
26
+ end
smallest_missing_non_negative_integer_after_operations/scala_tests/MySuite.scala ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ class MySuite extends munit.FunSuite {
3
+
4
+ test("test1") {
5
+ assertEquals(Main.findSmallestInteger(List(1,-10,7,13,6,8),5), 4)
6
+ }
7
+
8
+ test("test2") {
9
+ assertEquals(Main.findSmallestInteger(List(1,-10,7,13,6,8),7), 2)
10
+ }
11
+
12
+ }
smallest_subarrays_with_maximum_bitwise_or/.DS_Store ADDED
Binary file (6.15 kB). View file
 
smallest_subarrays_with_maximum_bitwise_or/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 (smallestSubarrays [1,0,2,1,3])," [3,3,2,2,1] (smallestSubarrays [1,0,2,1,3]))
13
+
14
+ test2 :: Test
15
+ test2 = TestCase (assertEqual "for (smallestSubarrays [1,2])," [2,1] (smallestSubarrays [1,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
smallest_subarrays_with_maximum_bitwise_or/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(3,3,2,2,1)), smallestSubarrays(new ArrayList<>(Arrays.asList(1,0,2,1,3))));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals(new ArrayList<>(Arrays.asList(2,1)), smallestSubarrays(new ArrayList<>(Arrays.asList(1,2))));
19
+ }
20
+
21
+ }
smallest_subarrays_with_maximum_bitwise_or/meta.json ADDED
The diff for this file is too large to render. See raw diff
 
smallest_subarrays_with_maximum_bitwise_or/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 [3;3;2;2;1] (smallestSubarrays [1;0;2;1;3])
12
+
13
+ let test2 _ = assert_equal [2;1] (smallestSubarrays [1;2])
14
+
15
+
16
+ (* Grouping test cases *)
17
+ let suite = "Test Suite for smallestSubarrays" >::: [
18
+
19
+ "test1" >:: test1;
20
+ "test2" >:: test2;
21
+ ]
22
+
23
+
24
+ (* Running the tests *)
25
+ let () = run_test_tt_main suite
26
+ end
smallest_subarrays_with_maximum_bitwise_or/scala_tests/MySuite.scala ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ class MySuite extends munit.FunSuite {
3
+
4
+ test("test1") {
5
+ assertEquals(Main.smallestSubarrays(List(1,0,2,1,3)), List(3,3,2,2,1))
6
+ }
7
+
8
+ test("test2") {
9
+ assertEquals(Main.smallestSubarrays(List(1,2)), List(2,1))
10
+ }
11
+
12
+ }
smallest_substring_with_identical_characters_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 (minLength \"000001 \" 1)," 2 (minLength "000001" 1))
13
+
14
+ test2 :: Test
15
+ test2 = TestCase (assertEqual "for (minLength \"0000 \" 2)," 1 (minLength "0000" 2))
16
+
17
+ test3 :: Test
18
+ test3 = TestCase (assertEqual "for (minLength \"111011101011001101110101111010001001010111111001010111011001110100010010101010101000111110010110000010000101010100111111001101100101110010100011111000111001100101001101100101111001011010110000001110111011001010101101110110100000010100001100011110111010011110101001010010010100011011110000101010010010101101000001110110100011111101011101000010001011101110000001110101110111110111011000111001101010110101001111101000111010101001101100010011111011010101011011110001011011000100011111111100100000111110010100010100000101000111100100001010000100011011001011100001100011010111001011010101001001101001111110000001010011100001000000100011011111110001011000101000001011111100111111010011100010111001110010000100100000011111000111000110001001101010001100111100000001010111000110011101010110010010100100000100 \" 791)," 1 (minLength "111011101011001101110101111010001001010111111001010111011001110100010010101010101000111110010110000010000101010100111111001101100101110010100011111000111001100101001101100101111001011010110000001110111011001010101101110110100000010100001100011110111010011110101001010010010100011011110000101010010010101101000001110110100011111101011101000010001011101110000001110101110111110111011000111001101010110101001111101000111010101001101100010011111011010101011011110001011011000100011111111100100000111110010100010100000101000111100100001010000100011011001011100001100011010111001011010101001001101001111110000001010011100001000000100011011111110001011000101000001011111100111111010011100010111001110010000100100000011111000111000110001001101010001100111100000001010111000110011101010110010010100100000100" 791))
19
+
20
+ test4 :: Test
21
+ test4 = TestCase (assertEqual "for (minLength \"010001010100011010001010001011011101000001011110000100101001010000100001010111110101011001000100110011111111011101101100101110001111100011110101011011000001101001111110000010001100011110100011011111010101100010000010100000 \" 168)," 1 (minLength "010001010100011010001010001011011101000001011110000100101001010000100001010111110101011001000100110011111111011101101100101110001111100011110101011011000001101001111110000010001100011110100011011111010101100010000010100000" 168))
22
+
23
+ test5 :: Test
24
+ test5 = TestCase (assertEqual "for (minLength \"0001001111010111010011001101110100000111011111110001001110111111100110011000110001111000000110100111100110010101000101001001100100001000001100010011001110000010110111001101100101011011100010101110011010100010110010100111111111010001011001101000011000100010110001111100100111011111000000001101101101110000111010000010010011001111101111111011110011010101101101011001100111110111011001000101000101011101000101001001000010110111101011100001100000001110010110000100101010110100110100010011101011111000001001111010110111010101001101110100111110000101000000011111101100000110001010000001100001100110000111000 \" 255)," 2 (minLength "0001001111010111010011001101110100000111011111110001001110111111100110011000110001111000000110100111100110010101000101001001100100001000001100010011001110000010110111001101100101011011100010101110011010100010110010100111111111010001011001101000011000100010110001111100100111011111000000001101101101110000111010000010010011001111101111111011110011010101101101011001100111110111011001000101000101011101000101001001000010110111101011100001100000001110010110000100101010110100110100010011101011111000001001111010110111010101001101110100111110000101000000011111101100000110001010000001100001100110000111000" 255))
25
+
26
+ test6 :: Test
27
+ test6 = TestCase (assertEqual "for (minLength \"110101001110100001010000010010111100110001011110010111011111111101010010101000010100001000010100100101110100111001010110010000001111011110111101111001110010111111001111100100110110100000101111111001101111110101011000001011110100100010001001010101001000001001001010000001110000010110000000000101111101010011110000011001100011111101000010010011100010100001001001001000010011100010110011100010011101100111100000010110010001111101011011000100111011010000011100000101111100101101100111001111001010101011111010001110000111011101001011010100010000110000011010101010001001110101 \" 527)," 1 (minLength "110101001110100001010000010010111100110001011110010111011111111101010010101000010100001000010100100101110100111001010110010000001111011110111101111001110010111111001111100100110110100000101111111001101111110101011000001011110100100010001001010101001000001001001010000001110000010110000000000101111101010011110000011001100011111101000010010011100010100001001001001000010011100010110011100010011101100111100000010110010001111101011011000100111011010000011100000101111100101101100111001111001010101011111010001110000111011101001011010100010000110000011010101010001001110101" 527))
28
+
29
+ test7 :: Test
30
+ test7 = TestCase (assertEqual "for (minLength \"010000110000101101001100001101010000100000110100000010010111001111001001100010111100001001101111101101101011011110100010110101001111000001111010110100001101111001110100110000010001010101101110001110000101111000111111110001100110011011100001010000010000100010010010110111100100110101111011110011111100100111010010011000000001001110101000100110110110110011011111100111000010010100000010000101001111001111110100101010001111110001001100001010110000111000010000010001110101111010011000111101110001111010011001001100011011110110101100100010010011011110010100100101010010101100001011010001011011001100000011100100010111101101111111000000010110001010001010011011100000101011110000101011001100100001111100010001011010110000000000010110011 \" 604)," 1 (minLength "010000110000101101001100001101010000100000110100000010010111001111001001100010111100001001101111101101101011011110100010110101001111000001111010110100001101111001110100110000010001010101101110001110000101111000111111110001100110011011100001010000010000100010010010110111100100110101111011110011111100100111010010011000000001001110101000100110110110110011011111100111000010010100000010000101001111001111110100101010001111110001001100001010110000111000010000010001110101111010011000111101110001111010011001001100011011110110101100100010010011011110010100100101010010101100001011010001011011001100000011100100010111101101111111000000010110001010001010011011100000101011110000101011001100100001111100010001011010110000000000010110011" 604))
31
+
32
+ test8 :: Test
33
+ test8 = TestCase (assertEqual "for (minLength \"00101110001110010110011011100000010001001101001001000100111111001010110011000001110000001100011011100111101010110011111001100111110000011101011110010111010101010010001100111101000001001001111010010111001010101110010000010101100100011010000010110100010111111011110110101110110011010011011100001011101000110111100001110111101001111100100011001011000111100001101111110111000001011100010011111010110100010100000100111000100101101100010110100110110100011101010000111100010001010010110110001101010010001111010010101010111000000001111001101 \" 487)," 1 (minLength "00101110001110010110011011100000010001001101001001000100111111001010110011000001110000001100011011100111101010110011111001100111110000011101011110010111010101010010001100111101000001001001111010010111001010101110010000010101100100011010000010110100010111111011110110101110110011010011011100001011101000110111100001110111101001111100100011001011000111100001101111110111000001011100010011111010110100010100000100111000100101101100010110100110110100011101010000111100010001010010110110001101010010001111010010101010111000000001111001101" 487))
34
+
35
+ test9 :: Test
36
+ test9 = TestCase (assertEqual "for (minLength \"1101 \" 1)," 1 (minLength "1101" 1))
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
smallest_substring_with_identical_characters_i/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, minLength("000001", 1));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals(1, minLength("0000", 2));
19
+ }
20
+
21
+ }