DatasetRepo commited on
Commit
4b2a0a0
·
verified ·
1 Parent(s): 540c128

d626876cf072af0b6013a204ca3af7b22fd6e14b0b49e196df4e4b44ef5e012d

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 +2 -0
  2. count_submatrices_with_equal_frequency_of_x_and_y/scala_tests/MySuite.scala +0 -0
  3. count_submatrices_with_top_left_element_and_sum_less_than_k/java_tests/Main.java +21 -0
  4. count_substrings_divisible_by_last_digit/haskell_tests/Main.hs +0 -0
  5. count_substrings_divisible_by_last_digit/java_tests/Main.java +24 -0
  6. count_substrings_divisible_by_last_digit/meta.json +0 -0
  7. count_substrings_divisible_by_last_digit/ocaml_tests/main.ml +0 -0
  8. count_substrings_divisible_by_last_digit/scala_tests/MySuite.scala +0 -0
  9. count_substrings_starting_and_ending_with_given_character/haskell_tests/Main.hs +0 -0
  10. count_substrings_starting_and_ending_with_given_character/java_tests/Main.java +21 -0
  11. count_substrings_starting_and_ending_with_given_character/meta.json +0 -0
  12. count_substrings_starting_and_ending_with_given_character/ocaml_tests/main.ml +0 -0
  13. count_substrings_starting_and_ending_with_given_character/scala_tests/MySuite.scala +0 -0
  14. count_substrings_that_can_be_rearranged_to_contain_a_string_ii/haskell_tests/Main.hs +0 -0
  15. count_substrings_that_can_be_rearranged_to_contain_a_string_ii/java_tests/Main.java +21 -0
  16. count_substrings_that_can_be_rearranged_to_contain_a_string_ii/meta.json +0 -0
  17. count_substrings_that_can_be_rearranged_to_contain_a_string_ii/ocaml_tests/main.ml +0 -0
  18. count_substrings_that_can_be_rearranged_to_contain_a_string_ii/scala_tests/MySuite.scala +0 -0
  19. count_substrings_that_satisfy_k_constraint_i/haskell_tests/Main.hs +45 -0
  20. count_substrings_that_satisfy_k_constraint_i/java_tests/Main.java +25 -0
  21. count_substrings_that_satisfy_k_constraint_i/meta.json +102 -0
  22. count_substrings_that_satisfy_k_constraint_i/ocaml_tests/main.ml +50 -0
  23. count_substrings_that_satisfy_k_constraint_i/scala_tests/MySuite.scala +44 -0
  24. count_substrings_that_satisfy_k_constraint_ii/haskell_tests/Main.hs +3 -0
  25. count_substrings_that_satisfy_k_constraint_ii/java_tests/Main.java +21 -0
  26. count_substrings_that_satisfy_k_constraint_ii/meta.json +3 -0
  27. count_substrings_that_satisfy_k_constraint_ii/ocaml_tests/main.ml +0 -0
  28. count_substrings_that_satisfy_k_constraint_ii/scala_tests/MySuite.scala +0 -0
  29. count_symmetric_integers/.DS_Store +0 -0
  30. count_symmetric_integers/haskell_tests/Main.hs +24 -0
  31. count_symmetric_integers/java_tests/Main.java +21 -0
  32. count_symmetric_integers/meta.json +26 -0
  33. count_symmetric_integers/ocaml_tests/main.ml +26 -0
  34. count_symmetric_integers/scala_tests/MySuite.scala +12 -0
  35. count_tested_devices_after_test_operations/haskell_tests/Main.hs +47 -0
  36. count_tested_devices_after_test_operations/java_tests/Main.java +20 -0
  37. count_tested_devices_after_test_operations/meta.json +525 -0
  38. count_tested_devices_after_test_operations/ocaml_tests/main.ml +51 -0
  39. count_tested_devices_after_test_operations/scala_tests/MySuite.scala +44 -0
  40. count_the_hidden_sequences/.DS_Store +0 -0
  41. count_the_hidden_sequences/haskell_tests/Main.hs +27 -0
  42. count_the_hidden_sequences/java_tests/Main.java +25 -0
  43. count_the_hidden_sequences/meta.json +578 -0
  44. count_the_hidden_sequences/ocaml_tests/main.ml +29 -0
  45. count_the_hidden_sequences/scala_tests/MySuite.scala +16 -0
  46. count_the_number_of_arrays_with_k_matching_adjacent_elements/haskell_tests/Main.hs +45 -0
  47. count_the_number_of_arrays_with_k_matching_adjacent_elements/java_tests/Main.java +25 -0
  48. count_the_number_of_arrays_with_k_matching_adjacent_elements/meta.json +112 -0
  49. count_the_number_of_arrays_with_k_matching_adjacent_elements/ocaml_tests/main.ml +50 -0
  50. count_the_number_of_arrays_with_k_matching_adjacent_elements/scala_tests/MySuite.scala +44 -0
.gitattributes CHANGED
@@ -85,3 +85,5 @@ count_subarrays_where_max_element_appears_at_least_k_times/meta.json filter=lfs
85
  count_subarrays_with_score_less_than_k/meta.json filter=lfs diff=lfs merge=lfs -text
86
  count_submatrices_with_equal_frequency_of_x_and_y/haskell_tests/Main.hs filter=lfs diff=lfs merge=lfs -text
87
  count_submatrices_with_equal_frequency_of_x_and_y/meta.json filter=lfs diff=lfs merge=lfs -text
 
 
 
85
  count_subarrays_with_score_less_than_k/meta.json filter=lfs diff=lfs merge=lfs -text
86
  count_submatrices_with_equal_frequency_of_x_and_y/haskell_tests/Main.hs filter=lfs diff=lfs merge=lfs -text
87
  count_submatrices_with_equal_frequency_of_x_and_y/meta.json filter=lfs diff=lfs merge=lfs -text
88
+ count_substrings_that_satisfy_k_constraint_ii/haskell_tests/Main.hs filter=lfs diff=lfs merge=lfs -text
89
+ count_substrings_that_satisfy_k_constraint_ii/meta.json filter=lfs diff=lfs merge=lfs -text
count_submatrices_with_equal_frequency_of_x_and_y/scala_tests/MySuite.scala ADDED
The diff for this file is too large to render. See raw diff
 
count_submatrices_with_top_left_element_and_sum_less_than_k/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, countSubmatrices(new ArrayList<>(Arrays.asList(new ArrayList<>(Arrays.asList(7,6,3)),new ArrayList<>(Arrays.asList(6,6,1)))), 18));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals(6, countSubmatrices(new ArrayList<>(Arrays.asList(new ArrayList<>(Arrays.asList(7,2,9)),new ArrayList<>(Arrays.asList(1,5,0)),new ArrayList<>(Arrays.asList(2,6,6)))), 20));
19
+ }
20
+
21
+ }
count_substrings_divisible_by_last_digit/haskell_tests/Main.hs ADDED
The diff for this file is too large to render. See raw diff
 
count_substrings_divisible_by_last_digit/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(11, countSubstrings("12936"));
14
+ }
15
+ @Test
16
+ public void test2() {
17
+ assertEquals(18, countSubstrings("5701283"));
18
+ }
19
+ @Test
20
+ public void test3() {
21
+ assertEquals(25, countSubstrings("1010101010"));
22
+ }
23
+
24
+ }
count_substrings_divisible_by_last_digit/meta.json ADDED
The diff for this file is too large to render. See raw diff
 
count_substrings_divisible_by_last_digit/ocaml_tests/main.ml ADDED
The diff for this file is too large to render. See raw diff
 
count_substrings_divisible_by_last_digit/scala_tests/MySuite.scala ADDED
The diff for this file is too large to render. See raw diff
 
count_substrings_starting_and_ending_with_given_character/haskell_tests/Main.hs ADDED
The diff for this file is too large to render. See raw diff
 
count_substrings_starting_and_ending_with_given_character/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(6, countSubstrings("abada", "a"));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals(6, countSubstrings("zzz", "z"));
19
+ }
20
+
21
+ }
count_substrings_starting_and_ending_with_given_character/meta.json ADDED
The diff for this file is too large to render. See raw diff
 
count_substrings_starting_and_ending_with_given_character/ocaml_tests/main.ml ADDED
The diff for this file is too large to render. See raw diff
 
count_substrings_starting_and_ending_with_given_character/scala_tests/MySuite.scala ADDED
The diff for this file is too large to render. See raw diff
 
count_substrings_that_can_be_rearranged_to_contain_a_string_ii/haskell_tests/Main.hs ADDED
The diff for this file is too large to render. See raw diff
 
count_substrings_that_can_be_rearranged_to_contain_a_string_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(1, validSubstringCount("bcca", "abc"));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals(10, validSubstringCount("abcabc", "abc"));
19
+ }
20
+
21
+ }
count_substrings_that_can_be_rearranged_to_contain_a_string_ii/meta.json ADDED
The diff for this file is too large to render. See raw diff
 
count_substrings_that_can_be_rearranged_to_contain_a_string_ii/ocaml_tests/main.ml ADDED
The diff for this file is too large to render. See raw diff
 
count_substrings_that_can_be_rearranged_to_contain_a_string_ii/scala_tests/MySuite.scala ADDED
The diff for this file is too large to render. See raw diff
 
count_substrings_that_satisfy_k_constraint_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 (countKConstraintSubstrings \"10101 \" 1)," 12 (countKConstraintSubstrings "10101" 1))
13
+
14
+ test2 :: Test
15
+ test2 = TestCase (assertEqual "for (countKConstraintSubstrings \"1010101 \" 2)," 25 (countKConstraintSubstrings "1010101" 2))
16
+
17
+ test3 :: Test
18
+ test3 = TestCase (assertEqual "for (countKConstraintSubstrings \"11111 \" 1)," 15 (countKConstraintSubstrings "11111" 1))
19
+
20
+ test4 :: Test
21
+ test4 = TestCase (assertEqual "for (countKConstraintSubstrings \"11 \" 2)," 3 (countKConstraintSubstrings "11" 2))
22
+
23
+ test5 :: Test
24
+ test5 = TestCase (assertEqual "for (countKConstraintSubstrings \"1 \" 1)," 1 (countKConstraintSubstrings "1" 1))
25
+
26
+ test6 :: Test
27
+ test6 = TestCase (assertEqual "for (countKConstraintSubstrings \"1011100110011101110000000101111110001 \" 36)," 703 (countKConstraintSubstrings "1011100110011101110000000101111110001" 36))
28
+
29
+ test7 :: Test
30
+ test7 = TestCase (assertEqual "for (countKConstraintSubstrings \"1111100100000100001110110001001110110011110 \" 33)," 946 (countKConstraintSubstrings "1111100100000100001110110001001110110011110" 33))
31
+
32
+ test8 :: Test
33
+ test8 = TestCase (assertEqual "for (countKConstraintSubstrings \"011010011 \" 5)," 45 (countKConstraintSubstrings "011010011" 5))
34
+
35
+ test9 :: Test
36
+ test9 = TestCase (assertEqual "for (countKConstraintSubstrings \"011111100010010111111100010100000101110111101110 \" 9)," 782 (countKConstraintSubstrings "011111100010010111111100010100000101110111101110" 9))
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
count_substrings_that_satisfy_k_constraint_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(12, countKConstraintSubstrings("10101", 1));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals(25, countKConstraintSubstrings("1010101", 2));
19
+ }
20
+ @Test
21
+ public void test3() {
22
+ assertEquals(15, countKConstraintSubstrings("11111", 1));
23
+ }
24
+
25
+ }
count_substrings_that_satisfy_k_constraint_i/meta.json ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "id": 3543,
3
+ "name": "count_substrings_that_satisfy_k_constraint_i",
4
+ "difficulty": "Easy",
5
+ "link": "https://leetcode.com/problems/count-substrings-that-satisfy-k-constraint-i/",
6
+ "date": "2024-08-11 00:00:00",
7
+ "task_description": "You are given a **binary** string `s` and an integer `k`. A **binary string** satisfies the **k-constraint** if **either** of the following conditions holds: The number of `0`'s in the string is at most `k`. The number of `1`'s in the string is at most `k`. Return an integer denoting the number of substrings of `s` that satisfy the **k-constraint**. **Example 1:** **Input:** s = \"10101\", k = 1 **Output:** 12 **Explanation:** Every substring of `s` except the substrings `\"1010\"`, `\"10101\"`, and `\"0101\"` satisfies the k-constraint. **Example 2:** **Input:** s = \"1010101\", k = 2 **Output:** 25 **Explanation:** Every substring of `s` except the substrings with a length greater than 5 satisfies the k-constraint. **Example 3:** **Input:** s = \"11111\", k = 1 **Output:** 15 **Explanation:** All substrings of `s` satisfy the k-constraint. **Constraints:** `1 <= s.length <= 50 ` `1 <= k <= s.length` `s[i]` is either `'0'` or `'1'`.",
8
+ "public_test_cases": [
9
+ {
10
+ "label": "Example 1",
11
+ "input": "s = \"10101\", k = 1",
12
+ "output": "12 "
13
+ },
14
+ {
15
+ "label": "Example 2",
16
+ "input": "s = \"1010101\", k = 2",
17
+ "output": "25 "
18
+ },
19
+ {
20
+ "label": "Example 3",
21
+ "input": "s = \"11111\", k = 1",
22
+ "output": "15 "
23
+ }
24
+ ],
25
+ "private_test_cases": [
26
+ {
27
+ "input": [
28
+ "\"11\"",
29
+ 2
30
+ ],
31
+ "output": 3
32
+ },
33
+ {
34
+ "input": [
35
+ "\"1\"",
36
+ 1
37
+ ],
38
+ "output": 1
39
+ },
40
+ {
41
+ "input": [
42
+ "\"1011100110011101110000000101111110001\"",
43
+ 36
44
+ ],
45
+ "output": 703
46
+ },
47
+ {
48
+ "input": [
49
+ "\"1111100100000100001110110001001110110011110\"",
50
+ 33
51
+ ],
52
+ "output": 946
53
+ },
54
+ {
55
+ "input": [
56
+ "\"011010011\"",
57
+ 5
58
+ ],
59
+ "output": 45
60
+ },
61
+ {
62
+ "input": [
63
+ "\"011111100010010111111100010100000101110111101110\"",
64
+ 9
65
+ ],
66
+ "output": 782
67
+ },
68
+ {
69
+ "input": [
70
+ "\"11\"",
71
+ 1
72
+ ],
73
+ "output": 3
74
+ },
75
+ {
76
+ "input": [
77
+ "01000111100001100100000010010001111010000111000011",
78
+ 41
79
+ ],
80
+ "output": 1275
81
+ },
82
+ {
83
+ "input": [
84
+ "10000100000010011110011110001000000000101001",
85
+ 26
86
+ ],
87
+ "output": 990
88
+ },
89
+ {
90
+ "input": [
91
+ "11001000101000001011",
92
+ 8
93
+ ],
94
+ "output": 210
95
+ }
96
+ ],
97
+ "haskell_template": "countKConstraintSubstrings :: String -> Int -> Int\ncountKConstraintSubstrings s k ",
98
+ "ocaml_template": "let countKConstraintSubstrings (s: string) (k: int) : int = ",
99
+ "scala_template": "def countKConstraintSubstrings(s: String,k: Int): Int = { \n \n}",
100
+ "java_template": "class Solution {\n public int countKConstraintSubstrings(String s, int k) {\n \n }\n}",
101
+ "python_template": "class Solution(object):\n def countKConstraintSubstrings(self, s, k):\n \"\"\"\n :type s: str\n :type k: int\n :rtype: int\n \"\"\"\n "
102
+ }
count_substrings_that_satisfy_k_constraint_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 12 (countKConstraintSubstrings "10101" 1)
12
+
13
+ let test2 _ = assert_equal 25 (countKConstraintSubstrings "1010101" 2)
14
+
15
+ let test3 _ = assert_equal 15 (countKConstraintSubstrings "11111" 1)
16
+
17
+ let test4 _ = assert_equal 3 (countKConstraintSubstrings "11" 2)
18
+
19
+ let test5 _ = assert_equal 1 (countKConstraintSubstrings "1" 1)
20
+
21
+ let test6 _ = assert_equal 703 (countKConstraintSubstrings "1011100110011101110000000101111110001" 36)
22
+
23
+ let test7 _ = assert_equal 946 (countKConstraintSubstrings "1111100100000100001110110001001110110011110" 33)
24
+
25
+ let test8 _ = assert_equal 45 (countKConstraintSubstrings "011010011" 5)
26
+
27
+ let test9 _ = assert_equal 782 (countKConstraintSubstrings "011111100010010111111100010100000101110111101110" 9)
28
+
29
+ let test10 _ = assert_equal 3 (countKConstraintSubstrings "11" 1)
30
+
31
+
32
+ (* Grouping test cases *)
33
+ let suite = "Test Suite for countKConstraintSubstrings" >::: [
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
count_substrings_that_satisfy_k_constraint_i/scala_tests/MySuite.scala ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ class MySuite extends munit.FunSuite {
3
+
4
+ test("test1") {
5
+ assertEquals(Main.countKConstraintSubstrings("10101",1), 12)
6
+ }
7
+
8
+ test("test2") {
9
+ assertEquals(Main.countKConstraintSubstrings("1010101",2), 25)
10
+ }
11
+
12
+ test("test3") {
13
+ assertEquals(Main.countKConstraintSubstrings("11111",1), 15)
14
+ }
15
+
16
+ test("test4") {
17
+ assertEquals(Main.countKConstraintSubstrings("11",2), 3)
18
+ }
19
+
20
+ test("test5") {
21
+ assertEquals(Main.countKConstraintSubstrings("1",1), 1)
22
+ }
23
+
24
+ test("test6") {
25
+ assertEquals(Main.countKConstraintSubstrings("1011100110011101110000000101111110001",36), 703)
26
+ }
27
+
28
+ test("test7") {
29
+ assertEquals(Main.countKConstraintSubstrings("1111100100000100001110110001001110110011110",33), 946)
30
+ }
31
+
32
+ test("test8") {
33
+ assertEquals(Main.countKConstraintSubstrings("011010011",5), 45)
34
+ }
35
+
36
+ test("test9") {
37
+ assertEquals(Main.countKConstraintSubstrings("011111100010010111111100010100000101110111101110",9), 782)
38
+ }
39
+
40
+ test("test10") {
41
+ assertEquals(Main.countKConstraintSubstrings("11",1), 3)
42
+ }
43
+
44
+ }
count_substrings_that_satisfy_k_constraint_ii/haskell_tests/Main.hs ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4f01c243e19c0bbbec4595b2bf7e89a1c243e23810678e878a1703da5542b129
3
+ size 11130138
count_substrings_that_satisfy_k_constraint_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(26)), countKConstraintSubstrings("0001111", 2, new ArrayList<>(Arrays.asList(new ArrayList<>(Arrays.asList(0,6))))));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals(new ArrayList<>(Arrays.asList(15,9,3)), countKConstraintSubstrings("010101", 1, new ArrayList<>(Arrays.asList(new ArrayList<>(Arrays.asList(0,5)),new ArrayList<>(Arrays.asList(1,4)),new ArrayList<>(Arrays.asList(2,3))))));
19
+ }
20
+
21
+ }
count_substrings_that_satisfy_k_constraint_ii/meta.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0a67ba341b2b2e8847eb1c2fa62f357685b07d322f72f8d796649da7d095f813
3
+ size 55204956
count_substrings_that_satisfy_k_constraint_ii/ocaml_tests/main.ml ADDED
The diff for this file is too large to render. See raw diff
 
count_substrings_that_satisfy_k_constraint_ii/scala_tests/MySuite.scala ADDED
The diff for this file is too large to render. See raw diff
 
count_symmetric_integers/.DS_Store ADDED
Binary file (6.15 kB). View file
 
count_symmetric_integers/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 (countSymmetricIntegers 1 100)," 9 (countSymmetricIntegers 1 100))
13
+
14
+ test2 :: Test
15
+ test2 = TestCase (assertEqual "for (countSymmetricIntegers 1200 1230)," 4 (countSymmetricIntegers 1200 1230))
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
count_symmetric_integers/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(9, countSymmetricIntegers(1, 100));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals(4, countSymmetricIntegers(1200, 1230));
19
+ }
20
+
21
+ }
count_symmetric_integers/meta.json ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "id": 2998,
3
+ "name": "count_symmetric_integers",
4
+ "difficulty": "Easy",
5
+ "link": "https://leetcode.com/problems/count-symmetric-integers/",
6
+ "date": "1693094400000",
7
+ "task_description": "You are given two positive integers `low` and `high`. An integer `x` consisting of `2 * n` digits is **symmetric** if the sum of the first `n` digits of `x` is equal to the sum of the last `n` digits of `x`. Numbers with an odd number of digits are never symmetric. Return _the **number of symmetric** integers in the range_ `[low, high]`. **Example 1:** ``` **Input:** low = 1, high = 100 **Output:** 9 **Explanation:** There are 9 symmetric integers between 1 and 100: 11, 22, 33, 44, 55, 66, 77, 88, and 99. ``` **Example 2:** ``` **Input:** low = 1200, high = 1230 **Output:** 4 **Explanation:** There are 4 symmetric integers between 1200 and 1230: 1203, 1212, 1221, and 1230. ``` **Constraints:** `1 <= low <= high <= 104`",
8
+ "public_test_cases": [
9
+ {
10
+ "label": "Example 1",
11
+ "input": "low = 1, high = 100",
12
+ "output": "9 "
13
+ },
14
+ {
15
+ "label": "Example 2",
16
+ "input": "low = 1200, high = 1230",
17
+ "output": "4 "
18
+ }
19
+ ],
20
+ "private_test_cases": [],
21
+ "haskell_template": "countSymmetricIntegers :: Int -> Int -> Int\ncountSymmetricIntegers low high ",
22
+ "ocaml_template": "let countSymmetricIntegers (low: int) (high: int) : int = ",
23
+ "scala_template": "def countSymmetricIntegers(low: Int,high: Int): Int = { \n \n}",
24
+ "java_template": "public static int countSymmetricIntegers(int low, int high) {\n\n}",
25
+ "python_template": "class Solution(object):\n def countSymmetricIntegers(self, low, high):\n \"\"\"\n :type low: int\n :type high: int\n :rtype: int\n \"\"\"\n "
26
+ }
count_symmetric_integers/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 9 (countSymmetricIntegers 1 100)
12
+
13
+ let test2 _ = assert_equal 4 (countSymmetricIntegers 1200 1230)
14
+
15
+
16
+ (* Grouping test cases *)
17
+ let suite = "Test Suite for countSymmetricIntegers" >::: [
18
+
19
+ "test1" >:: test1;
20
+ "test2" >:: test2;
21
+ ]
22
+
23
+
24
+ (* Running the tests *)
25
+ let () = run_test_tt_main suite
26
+ end
count_symmetric_integers/scala_tests/MySuite.scala ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ class MySuite extends munit.FunSuite {
3
+
4
+ test("test1") {
5
+ assertEquals(Main.countSymmetricIntegers(1,100), 9)
6
+ }
7
+
8
+ test("test2") {
9
+ assertEquals(Main.countSymmetricIntegers(1200,1230), 4)
10
+ }
11
+
12
+ }
count_tested_devices_after_test_operations/haskell_tests/Main.hs ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ module Main where
3
+ import Test.HUnit
4
+
5
+ --Program start
6
+ countTestedDevices :: [Int] -> Int
7
+ countTestedDevices batteryPercentages = undefined
8
+
9
+ --Program end
10
+
11
+ -- Test cases
12
+
13
+ test1 :: Test
14
+ test1 = TestCase (assertEqual "for (countTestedDevices [1,1,2,1,3])," 3 (countTestedDevices [1,1,2,1,3]))
15
+
16
+ test2 :: Test
17
+ test2 = TestCase (assertEqual "for (countTestedDevices [0,1,2])," 2 (countTestedDevices [0,1,2]))
18
+
19
+ test3 :: Test
20
+ test3 = TestCase (assertEqual "for (countTestedDevices [54, 43, 50, 48, 97, 39, 90, 92, 55, 87, 85, 66, 7, 44, 73, 88, 94, 87, 89, 98, 2, 38, 3, 91, 57, 59, 89, 19, 71, 15, 47, 36, 27, 90, 14, 15, 20, 2, 16, 37, 91, 97, 48, 38, 92, 53, 22, 100, 51, 90, 95, 7, 92, 89, 16, 15, 90, 39, 92, 36, 78, 59, 17, 43, 90, 48, 95, 9, 29, 45, 48, 65, 30, 47, 87, 21, 1, 98, 20])," 51 (countTestedDevices [54, 43, 50, 48, 97, 39, 90, 92, 55, 87, 85, 66, 7, 44, 73, 88, 94, 87, 89, 98, 2, 38, 3, 91, 57, 59, 89, 19, 71, 15, 47, 36, 27, 90, 14, 15, 20, 2, 16, 37, 91, 97, 48, 38, 92, 53, 22, 100, 51, 90, 95, 7, 92, 89, 16, 15, 90, 39, 92, 36, 78, 59, 17, 43, 90, 48, 95, 9, 29, 45, 48, 65, 30, 47, 87, 21, 1, 98, 20]))
21
+
22
+ test4 :: Test
23
+ test4 = TestCase (assertEqual "for (countTestedDevices [91, 81, 30, 72, 20, 63, 81, 45])," 8 (countTestedDevices [91, 81, 30, 72, 20, 63, 81, 45]))
24
+
25
+ test5 :: Test
26
+ test5 = TestCase (assertEqual "for (countTestedDevices [65, 13, 66, 88, 60, 35, 51, 54, 74, 75, 56, 11, 73, 42, 90, 29, 29, 23, 97, 87, 73, 43, 29, 44, 69, 43, 11, 47, 39, 83, 56, 6, 15, 37, 40, 22, 32, 72, 2, 80, 22, 56, 5, 53, 55, 30, 39, 29, 19, 60, 93, 73, 1, 53, 4, 88, 55, 39, 57, 31, 6, 73, 3, 98, 73, 77, 84, 21, 11, 18, 95, 4, 59, 72, 24, 44, 37, 58, 8, 19, 44, 95, 55, 50, 63, 70, 98, 35, 84, 67, 72, 51, 26, 10, 99, 11, 37, 49])," 62 (countTestedDevices [65, 13, 66, 88, 60, 35, 51, 54, 74, 75, 56, 11, 73, 42, 90, 29, 29, 23, 97, 87, 73, 43, 29, 44, 69, 43, 11, 47, 39, 83, 56, 6, 15, 37, 40, 22, 32, 72, 2, 80, 22, 56, 5, 53, 55, 30, 39, 29, 19, 60, 93, 73, 1, 53, 4, 88, 55, 39, 57, 31, 6, 73, 3, 98, 73, 77, 84, 21, 11, 18, 95, 4, 59, 72, 24, 44, 37, 58, 8, 19, 44, 95, 55, 50, 63, 70, 98, 35, 84, 67, 72, 51, 26, 10, 99, 11, 37, 49]))
27
+
28
+ test6 :: Test
29
+ test6 = TestCase (assertEqual "for (countTestedDevices [31, 81, 10, 45, 1, 86, 23, 14, 99, 53, 66, 78, 22, 81, 3, 51, 53, 33, 69, 54, 36, 41, 84, 64, 7, 52, 32, 14, 55, 72, 30, 49, 69, 60, 92, 31, 13, 61, 15, 0, 94, 68, 85, 52, 100, 60, 95, 61, 37, 82, 8, 0, 52, 9, 68, 25, 34, 26, 0, 79, 63, 18, 23, 60, 51, 72, 48, 25, 48, 74, 64, 13])," 50 (countTestedDevices [31, 81, 10, 45, 1, 86, 23, 14, 99, 53, 66, 78, 22, 81, 3, 51, 53, 33, 69, 54, 36, 41, 84, 64, 7, 52, 32, 14, 55, 72, 30, 49, 69, 60, 92, 31, 13, 61, 15, 0, 94, 68, 85, 52, 100, 60, 95, 61, 37, 82, 8, 0, 52, 9, 68, 25, 34, 26, 0, 79, 63, 18, 23, 60, 51, 72, 48, 25, 48, 74, 64, 13]))
30
+
31
+ test7 :: Test
32
+ test7 = TestCase (assertEqual "for (countTestedDevices [62, 22, 60, 57, 20, 69, 60, 24, 53, 39, 39, 46, 33, 43, 98, 82, 63, 94, 10, 10, 20, 85, 15, 20, 62, 63, 0, 21, 38, 84, 6])," 24 (countTestedDevices [62, 22, 60, 57, 20, 69, 60, 24, 53, 39, 39, 46, 33, 43, 98, 82, 63, 94, 10, 10, 20, 85, 15, 20, 62, 63, 0, 21, 38, 84, 6]))
33
+
34
+ test8 :: Test
35
+ test8 = TestCase (assertEqual "for (countTestedDevices [18, 100, 59, 91, 40, 56, 5, 36, 48, 4, 97, 93, 30, 98, 1, 7, 77, 47, 36, 94])," 16 (countTestedDevices [18, 100, 59, 91, 40, 56, 5, 36, 48, 4, 97, 93, 30, 98, 1, 7, 77, 47, 36, 94]))
36
+
37
+ test9 :: Test
38
+ test9 = TestCase (assertEqual "for (countTestedDevices [22, 81, 76, 86, 38, 36, 84, 69, 72, 55, 85, 96, 57, 28, 30, 26, 6, 64, 79, 65, 57, 95, 61, 45, 54, 58, 75, 2, 9, 60, 99, 77, 53, 8, 71, 59, 6, 31, 67, 81, 100, 100, 82, 29, 86, 49, 80, 35, 12, 9, 42, 47, 35, 75, 61, 42, 43, 21, 64, 19, 27, 54])," 46 (countTestedDevices [22, 81, 76, 86, 38, 36, 84, 69, 72, 55, 85, 96, 57, 28, 30, 26, 6, 64, 79, 65, 57, 95, 61, 45, 54, 58, 75, 2, 9, 60, 99, 77, 53, 8, 71, 59, 6, 31, 67, 81, 100, 100, 82, 29, 86, 49, 80, 35, 12, 9, 42, 47, 35, 75, 61, 42, 43, 21, 64, 19, 27, 54]))
39
+
40
+
41
+ -- Grouping test cases
42
+ tests :: Test
43
+ 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]
44
+
45
+ -- Running the tests
46
+ main :: IO Counts
47
+ main = runTestTT tests
count_tested_devices_after_test_operations/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, countTestedDevices(Arrays.asList(1,1,2,1,3)));
14
+ }
15
+ @Test
16
+ public void test2() {
17
+ assertEquals(2, countTestedDevices(Arrays.asList(0,1,2)));
18
+ }
19
+
20
+ }
count_tested_devices_after_test_operations/meta.json ADDED
@@ -0,0 +1,525 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "id": 3220,
3
+ "name": "count_tested_devices_after_test_operations",
4
+ "difficulty": "Easy",
5
+ "link": "https://leetcode.com/problems/count-tested-devices-after-test-operations/",
6
+ "date": "2023-12-03 00:00:00",
7
+ "task_description": "You are given a **0-indexed** integer array `batteryPercentages` having length `n`, denoting the battery percentages of `n` **0-indexed** devices. Your task is to test each device `i` **in order** from `0` to `n - 1`, by performing the following test operations: If `batteryPercentages[i]` is **greater** than `0`: **Increment** the count of tested devices. **Decrease** the battery percentage of all devices with indices `j` in the range `[i + 1, n - 1]` by `1`, ensuring their battery percentage **never goes below** `0`, i.e, `batteryPercentages[j] = max(0, batteryPercentages[j] - 1)`. Move to the next device. Otherwise, move to the next device without performing any test. Return _an integer denoting the number of devices that will be tested after performing the test operations in order._ **Example 1:** ``` **Input:** batteryPercentages = [1,1,2,1,3] **Output:** 3 **Explanation: **Performing the test operations in order starting from device 0: At device 0, batteryPercentages[0] > 0, so there is now 1 tested device, and batteryPercentages becomes [1,0,1,0,2]. At device 1, batteryPercentages[1] == 0, so we move to the next device without testing. At device 2, batteryPercentages[2] > 0, so there are now 2 tested devices, and batteryPercentages becomes [1,0,1,0,1]. At device 3, batteryPercentages[3] == 0, so we move to the next device without testing. At device 4, batteryPercentages[4] > 0, so there are now 3 tested devices, and batteryPercentages stays the same. So, the answer is 3. ``` **Example 2:** ``` **Input:** batteryPercentages = [0,1,2] **Output:** 2 **Explanation:** Performing the test operations in order starting from device 0: At device 0, batteryPercentages[0] == 0, so we move to the next device without testing. At device 1, batteryPercentages[1] > 0, so there is now 1 tested device, and batteryPercentages becomes [0,1,1]. At device 2, batteryPercentages[2] > 0, so there are now 2 tested devices, and batteryPercentages stays the same. So, the answer is 2. ``` **Constraints:** `1 <= n == batteryPercentages.length <= 100 ` `0 <= batteryPercentages[i] <= 100`",
8
+ "public_test_cases": [
9
+ {
10
+ "label": "Example 1",
11
+ "input": "batteryPercentages = [1,1,2,1,3]",
12
+ "output": "3 "
13
+ },
14
+ {
15
+ "label": "Example 2",
16
+ "input": "batteryPercentages = [0,1,2]",
17
+ "output": "2 "
18
+ }
19
+ ],
20
+ "private_test_cases": [
21
+ {
22
+ "input": [
23
+ 54,
24
+ 43,
25
+ 50,
26
+ 48,
27
+ 97,
28
+ 39,
29
+ 90,
30
+ 92,
31
+ 55,
32
+ 87,
33
+ 85,
34
+ 66,
35
+ 7,
36
+ 44,
37
+ 73,
38
+ 88,
39
+ 94,
40
+ 87,
41
+ 89,
42
+ 98,
43
+ 2,
44
+ 38,
45
+ 3,
46
+ 91,
47
+ 57,
48
+ 59,
49
+ 89,
50
+ 19,
51
+ 71,
52
+ 15,
53
+ 47,
54
+ 36,
55
+ 27,
56
+ 90,
57
+ 14,
58
+ 15,
59
+ 20,
60
+ 2,
61
+ 16,
62
+ 37,
63
+ 91,
64
+ 97,
65
+ 48,
66
+ 38,
67
+ 92,
68
+ 53,
69
+ 22,
70
+ 100,
71
+ 51,
72
+ 90,
73
+ 95,
74
+ 7,
75
+ 92,
76
+ 89,
77
+ 16,
78
+ 15,
79
+ 90,
80
+ 39,
81
+ 92,
82
+ 36,
83
+ 78,
84
+ 59,
85
+ 17,
86
+ 43,
87
+ 90,
88
+ 48,
89
+ 95,
90
+ 9,
91
+ 29,
92
+ 45,
93
+ 48,
94
+ 65,
95
+ 30,
96
+ 47,
97
+ 87,
98
+ 21,
99
+ 1,
100
+ 98,
101
+ 20
102
+ ],
103
+ "output": 51
104
+ },
105
+ {
106
+ "input": [
107
+ 91,
108
+ 81,
109
+ 30,
110
+ 72,
111
+ 20,
112
+ 63,
113
+ 81,
114
+ 45
115
+ ],
116
+ "output": 8
117
+ },
118
+ {
119
+ "input": [
120
+ 65,
121
+ 13,
122
+ 66,
123
+ 88,
124
+ 60,
125
+ 35,
126
+ 51,
127
+ 54,
128
+ 74,
129
+ 75,
130
+ 56,
131
+ 11,
132
+ 73,
133
+ 42,
134
+ 90,
135
+ 29,
136
+ 29,
137
+ 23,
138
+ 97,
139
+ 87,
140
+ 73,
141
+ 43,
142
+ 29,
143
+ 44,
144
+ 69,
145
+ 43,
146
+ 11,
147
+ 47,
148
+ 39,
149
+ 83,
150
+ 56,
151
+ 6,
152
+ 15,
153
+ 37,
154
+ 40,
155
+ 22,
156
+ 32,
157
+ 72,
158
+ 2,
159
+ 80,
160
+ 22,
161
+ 56,
162
+ 5,
163
+ 53,
164
+ 55,
165
+ 30,
166
+ 39,
167
+ 29,
168
+ 19,
169
+ 60,
170
+ 93,
171
+ 73,
172
+ 1,
173
+ 53,
174
+ 4,
175
+ 88,
176
+ 55,
177
+ 39,
178
+ 57,
179
+ 31,
180
+ 6,
181
+ 73,
182
+ 3,
183
+ 98,
184
+ 73,
185
+ 77,
186
+ 84,
187
+ 21,
188
+ 11,
189
+ 18,
190
+ 95,
191
+ 4,
192
+ 59,
193
+ 72,
194
+ 24,
195
+ 44,
196
+ 37,
197
+ 58,
198
+ 8,
199
+ 19,
200
+ 44,
201
+ 95,
202
+ 55,
203
+ 50,
204
+ 63,
205
+ 70,
206
+ 98,
207
+ 35,
208
+ 84,
209
+ 67,
210
+ 72,
211
+ 51,
212
+ 26,
213
+ 10,
214
+ 99,
215
+ 11,
216
+ 37,
217
+ 49
218
+ ],
219
+ "output": 62
220
+ },
221
+ {
222
+ "input": [
223
+ 31,
224
+ 81,
225
+ 10,
226
+ 45,
227
+ 1,
228
+ 86,
229
+ 23,
230
+ 14,
231
+ 99,
232
+ 53,
233
+ 66,
234
+ 78,
235
+ 22,
236
+ 81,
237
+ 3,
238
+ 51,
239
+ 53,
240
+ 33,
241
+ 69,
242
+ 54,
243
+ 36,
244
+ 41,
245
+ 84,
246
+ 64,
247
+ 7,
248
+ 52,
249
+ 32,
250
+ 14,
251
+ 55,
252
+ 72,
253
+ 30,
254
+ 49,
255
+ 69,
256
+ 60,
257
+ 92,
258
+ 31,
259
+ 13,
260
+ 61,
261
+ 15,
262
+ 0,
263
+ 94,
264
+ 68,
265
+ 85,
266
+ 52,
267
+ 100,
268
+ 60,
269
+ 95,
270
+ 61,
271
+ 37,
272
+ 82,
273
+ 8,
274
+ 0,
275
+ 52,
276
+ 9,
277
+ 68,
278
+ 25,
279
+ 34,
280
+ 26,
281
+ 0,
282
+ 79,
283
+ 63,
284
+ 18,
285
+ 23,
286
+ 60,
287
+ 51,
288
+ 72,
289
+ 48,
290
+ 25,
291
+ 48,
292
+ 74,
293
+ 64,
294
+ 13
295
+ ],
296
+ "output": 50
297
+ },
298
+ {
299
+ "input": [
300
+ 62,
301
+ 22,
302
+ 60,
303
+ 57,
304
+ 20,
305
+ 69,
306
+ 60,
307
+ 24,
308
+ 53,
309
+ 39,
310
+ 39,
311
+ 46,
312
+ 33,
313
+ 43,
314
+ 98,
315
+ 82,
316
+ 63,
317
+ 94,
318
+ 10,
319
+ 10,
320
+ 20,
321
+ 85,
322
+ 15,
323
+ 20,
324
+ 62,
325
+ 63,
326
+ 0,
327
+ 21,
328
+ 38,
329
+ 84,
330
+ 6
331
+ ],
332
+ "output": 24
333
+ },
334
+ {
335
+ "input": [
336
+ 18,
337
+ 100,
338
+ 59,
339
+ 91,
340
+ 40,
341
+ 56,
342
+ 5,
343
+ 36,
344
+ 48,
345
+ 4,
346
+ 97,
347
+ 93,
348
+ 30,
349
+ 98,
350
+ 1,
351
+ 7,
352
+ 77,
353
+ 47,
354
+ 36,
355
+ 94
356
+ ],
357
+ "output": 16
358
+ },
359
+ {
360
+ "input": [
361
+ 22,
362
+ 81,
363
+ 76,
364
+ 86,
365
+ 38,
366
+ 36,
367
+ 84,
368
+ 69,
369
+ 72,
370
+ 55,
371
+ 85,
372
+ 96,
373
+ 57,
374
+ 28,
375
+ 30,
376
+ 26,
377
+ 6,
378
+ 64,
379
+ 79,
380
+ 65,
381
+ 57,
382
+ 95,
383
+ 61,
384
+ 45,
385
+ 54,
386
+ 58,
387
+ 75,
388
+ 2,
389
+ 9,
390
+ 60,
391
+ 99,
392
+ 77,
393
+ 53,
394
+ 8,
395
+ 71,
396
+ 59,
397
+ 6,
398
+ 31,
399
+ 67,
400
+ 81,
401
+ 100,
402
+ 100,
403
+ 82,
404
+ 29,
405
+ 86,
406
+ 49,
407
+ 80,
408
+ 35,
409
+ 12,
410
+ 9,
411
+ 42,
412
+ 47,
413
+ 35,
414
+ 75,
415
+ 61,
416
+ 42,
417
+ 43,
418
+ 21,
419
+ 64,
420
+ 19,
421
+ 27,
422
+ 54
423
+ ],
424
+ "output": 46
425
+ },
426
+ {
427
+ "input": [
428
+ 33,
429
+ 61,
430
+ 0,
431
+ 33,
432
+ 81,
433
+ 7,
434
+ 70,
435
+ 27,
436
+ 30,
437
+ 25,
438
+ 66,
439
+ 12,
440
+ 12,
441
+ 68,
442
+ 13,
443
+ 14,
444
+ 62,
445
+ 73,
446
+ 25,
447
+ 67,
448
+ 52,
449
+ 5,
450
+ 74,
451
+ 59,
452
+ 71,
453
+ 32,
454
+ 38,
455
+ 71,
456
+ 61,
457
+ 84,
458
+ 25,
459
+ 34,
460
+ 20,
461
+ 66,
462
+ 54,
463
+ 77,
464
+ 32,
465
+ 99,
466
+ 41,
467
+ 95,
468
+ 84,
469
+ 14,
470
+ 31,
471
+ 92,
472
+ 92,
473
+ 23,
474
+ 55,
475
+ 15,
476
+ 92,
477
+ 86,
478
+ 59,
479
+ 62,
480
+ 35,
481
+ 72,
482
+ 11,
483
+ 61,
484
+ 80,
485
+ 50,
486
+ 3,
487
+ 0,
488
+ 52,
489
+ 60,
490
+ 11
491
+ ],
492
+ "output": 49
493
+ },
494
+ {
495
+ "input": [
496
+ 49,
497
+ 69,
498
+ 25,
499
+ 47,
500
+ 43,
501
+ 80,
502
+ 47,
503
+ 51,
504
+ 79,
505
+ 0
506
+ ],
507
+ "output": 9
508
+ },
509
+ {
510
+ "input": [
511
+ 38,
512
+ 78,
513
+ 0,
514
+ 31,
515
+ 58
516
+ ],
517
+ "output": 4
518
+ }
519
+ ],
520
+ "haskell_template": "countTestedDevices :: [Int] -> Int\ncountTestedDevices batteryPercentages ",
521
+ "ocaml_template": "let countTestedDevices (batteryPercentages: int list) : int = ",
522
+ "scala_template": "def countTestedDevices(batteryPercentages: List[Int]): Int = { \n \n}",
523
+ "java_template": "class Solution {\n public int countTestedDevices(int[] batteryPercentages) {\n \n }\n}",
524
+ "python_template": "class Solution(object):\n def countTestedDevices(self, batteryPercentages):\n \"\"\"\n :type batteryPercentages: List[int]\n :rtype: int\n \"\"\"\n "
525
+ }
count_tested_devices_after_test_operations/ocaml_tests/main.ml ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ module Main = struct
3
+ open OUnit2
4
+
5
+ (* Program start *)
6
+ let countTestedDevices (batteryPercentages: int list) : int = failwith "Not implemented"
7
+
8
+ (* Program end *)
9
+
10
+ (* Test cases *)
11
+
12
+ let test1 _ = assert_equal 3 (countTestedDevices [1;1;2;1;3])
13
+
14
+ let test2 _ = assert_equal 2 (countTestedDevices [0;1;2])
15
+
16
+ let test3 _ = assert_equal 2 (countTestedDevices [54; 43; 50; 48; 97; 39; 90; 92; 55; 87; 85; 66; 7; 44; 73; 88; 94; 87; 89; 98; 2; 38; 3; 91; 57; 59; 89; 19; 71; 15; 47; 36; 27; 90; 14; 15; 20; 2; 16; 37; 91; 97; 48; 38; 92; 53; 22; 100; 51; 90; 95; 7; 92; 89; 16; 15; 90; 39; 92; 36; 78; 59; 17; 43; 90; 48; 95; 9; 29; 45; 48; 65; 30; 47; 87; 21; 1; 98; 20])
17
+
18
+ let test4 _ = assert_equal 2 (countTestedDevices [91; 81; 30; 72; 20; 63; 81; 45])
19
+
20
+ let test5 _ = assert_equal 2 (countTestedDevices [65; 13; 66; 88; 60; 35; 51; 54; 74; 75; 56; 11; 73; 42; 90; 29; 29; 23; 97; 87; 73; 43; 29; 44; 69; 43; 11; 47; 39; 83; 56; 6; 15; 37; 40; 22; 32; 72; 2; 80; 22; 56; 5; 53; 55; 30; 39; 29; 19; 60; 93; 73; 1; 53; 4; 88; 55; 39; 57; 31; 6; 73; 3; 98; 73; 77; 84; 21; 11; 18; 95; 4; 59; 72; 24; 44; 37; 58; 8; 19; 44; 95; 55; 50; 63; 70; 98; 35; 84; 67; 72; 51; 26; 10; 99; 11; 37; 49])
21
+
22
+ let test6 _ = assert_equal 2 (countTestedDevices [31; 81; 10; 45; 1; 86; 23; 14; 99; 53; 66; 78; 22; 81; 3; 51; 53; 33; 69; 54; 36; 41; 84; 64; 7; 52; 32; 14; 55; 72; 30; 49; 69; 60; 92; 31; 13; 61; 15; 0; 94; 68; 85; 52; 100; 60; 95; 61; 37; 82; 8; 0; 52; 9; 68; 25; 34; 26; 0; 79; 63; 18; 23; 60; 51; 72; 48; 25; 48; 74; 64; 13])
23
+
24
+ let test7 _ = assert_equal 2 (countTestedDevices [62; 22; 60; 57; 20; 69; 60; 24; 53; 39; 39; 46; 33; 43; 98; 82; 63; 94; 10; 10; 20; 85; 15; 20; 62; 63; 0; 21; 38; 84; 6])
25
+
26
+ let test8 _ = assert_equal 2 (countTestedDevices [18; 100; 59; 91; 40; 56; 5; 36; 48; 4; 97; 93; 30; 98; 1; 7; 77; 47; 36; 94])
27
+
28
+ let test9 _ = assert_equal 2 (countTestedDevices [22; 81; 76; 86; 38; 36; 84; 69; 72; 55; 85; 96; 57; 28; 30; 26; 6; 64; 79; 65; 57; 95; 61; 45; 54; 58; 75; 2; 9; 60; 99; 77; 53; 8; 71; 59; 6; 31; 67; 81; 100; 100; 82; 29; 86; 49; 80; 35; 12; 9; 42; 47; 35; 75; 61; 42; 43; 21; 64; 19; 27; 54])
29
+
30
+ let test10 _ = assert_equal 2 (countTestedDevices [33; 61; 0; 33; 81; 7; 70; 27; 30; 25; 66; 12; 12; 68; 13; 14; 62; 73; 25; 67; 52; 5; 74; 59; 71; 32; 38; 71; 61; 84; 25; 34; 20; 66; 54; 77; 32; 99; 41; 95; 84; 14; 31; 92; 92; 23; 55; 15; 92; 86; 59; 62; 35; 72; 11; 61; 80; 50; 3; 0; 52; 60; 11])
31
+
32
+
33
+ (* Grouping test cases *)
34
+ let suite = "Test Suite for countTestedDevices" >::: [
35
+
36
+ "test1" >:: test1;
37
+ "test2" >:: test2;
38
+ "test3" >:: test3;
39
+ "test4" >:: test4;
40
+ "test5" >:: test5;
41
+ "test6" >:: test6;
42
+ "test7" >:: test7;
43
+ "test8" >:: test8;
44
+ "test9" >:: test9;
45
+ "test10" >:: test10;
46
+ ]
47
+
48
+
49
+ (* Running the tests *)
50
+ let () = run_test_tt_main suite
51
+ end
count_tested_devices_after_test_operations/scala_tests/MySuite.scala ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ class MySuite extends munit.FunSuite {
3
+
4
+ test("test1") {
5
+ assertEquals(Main.countTestedDevices(List(1,1,2,1,3)), 3)
6
+ }
7
+
8
+ test("test2") {
9
+ assertEquals(Main.countTestedDevices(List(0,1,2)), 2)
10
+ }
11
+
12
+ test("test3") {
13
+ assertEquals(Main.countTestedDevices(54,43,50,48,97,39,90,92,55,87,85,66,7,44,73,88,94,87,89,98,2,38,3,91,57,59,89,19,71,15,47,36,27,90,14,15,20,2,16,37,91,97,48,38,92,53,22,100,51,90,95,7,92,89,16,15,90,39,92,36,78,59,17,43,90,48,95,9,29,45,48,65,30,47,87,21,1,98,20), 51)
14
+ }
15
+
16
+ test("test4") {
17
+ assertEquals(Main.countTestedDevices(91,81,30,72,20,63,81,45), 8)
18
+ }
19
+
20
+ test("test5") {
21
+ assertEquals(Main.countTestedDevices(65,13,66,88,60,35,51,54,74,75,56,11,73,42,90,29,29,23,97,87,73,43,29,44,69,43,11,47,39,83,56,6,15,37,40,22,32,72,2,80,22,56,5,53,55,30,39,29,19,60,93,73,1,53,4,88,55,39,57,31,6,73,3,98,73,77,84,21,11,18,95,4,59,72,24,44,37,58,8,19,44,95,55,50,63,70,98,35,84,67,72,51,26,10,99,11,37,49), 62)
22
+ }
23
+
24
+ test("test6") {
25
+ assertEquals(Main.countTestedDevices(31,81,10,45,1,86,23,14,99,53,66,78,22,81,3,51,53,33,69,54,36,41,84,64,7,52,32,14,55,72,30,49,69,60,92,31,13,61,15,0,94,68,85,52,100,60,95,61,37,82,8,0,52,9,68,25,34,26,0,79,63,18,23,60,51,72,48,25,48,74,64,13), 50)
26
+ }
27
+
28
+ test("test7") {
29
+ assertEquals(Main.countTestedDevices(62,22,60,57,20,69,60,24,53,39,39,46,33,43,98,82,63,94,10,10,20,85,15,20,62,63,0,21,38,84,6), 24)
30
+ }
31
+
32
+ test("test8") {
33
+ assertEquals(Main.countTestedDevices(18,100,59,91,40,56,5,36,48,4,97,93,30,98,1,7,77,47,36,94), 16)
34
+ }
35
+
36
+ test("test9") {
37
+ assertEquals(Main.countTestedDevices(22,81,76,86,38,36,84,69,72,55,85,96,57,28,30,26,6,64,79,65,57,95,61,45,54,58,75,2,9,60,99,77,53,8,71,59,6,31,67,81,100,100,82,29,86,49,80,35,12,9,42,47,35,75,61,42,43,21,64,19,27,54), 46)
38
+ }
39
+
40
+ test("test10") {
41
+ assertEquals(Main.countTestedDevices(33,61,0,33,81,7,70,27,30,25,66,12,12,68,13,14,62,73,25,67,52,5,74,59,71,32,38,71,61,84,25,34,20,66,54,77,32,99,41,95,84,14,31,92,92,23,55,15,92,86,59,62,35,72,11,61,80,50,3,0,52,60,11), 49)
42
+ }
43
+
44
+ }
count_the_hidden_sequences/.DS_Store ADDED
Binary file (6.15 kB). View file
 
count_the_hidden_sequences/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 (numberOfArrays [1,-3,4] 1 6)," 2 (numberOfArrays [1,-3,4] 1 6))
13
+
14
+ test2 :: Test
15
+ test2 = TestCase (assertEqual "for (numberOfArrays [3,-4,5,1,-2] ( -4) 5)," 4 (numberOfArrays [3,-4,5,1,-2] -4 5))
16
+
17
+ test3 :: Test
18
+ test3 = TestCase (assertEqual "for (numberOfArrays [4,-7,2] 3 6)," 0 (numberOfArrays [4,-7,2] 3 6))
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
count_the_hidden_sequences/java_tests/Main.java ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import static org.junit.jupiter.api.Assertions.*;
3
+ import org.junit.jupiter.api.Test;
4
+ import java.util.List;
5
+ import java.util.Arrays;
6
+ import java.util.ArrayList;
7
+ public class Main {
8
+ //Program start
9
+
10
+ //Program end
11
+
12
+ @Test
13
+ public void test1() {
14
+ assertEquals(2, numberOfArrays(new ArrayList<>(Arrays.asList(1,-3,4)), 1, 6));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals(4, numberOfArrays(new ArrayList<>(Arrays.asList(3,-4,5,1,-2)), -4, 5));
19
+ }
20
+ @Test
21
+ public void test3() {
22
+ assertEquals(0, numberOfArrays(new ArrayList<>(Arrays.asList(4,-7,2)), 3, 6));
23
+ }
24
+
25
+ }
count_the_hidden_sequences/meta.json ADDED
@@ -0,0 +1,578 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "id": 2249,
3
+ "name": "count_the_hidden_sequences",
4
+ "difficulty": "Medium",
5
+ "link": "https://leetcode.com/problems/count-the-hidden-sequences/",
6
+ "date": "1641600000000",
7
+ "task_description": "You are given a **0-indexed** array of `n` integers `differences`, which describes the **differences **between each pair of **consecutive **integers of a **hidden** sequence of length `(n + 1)`. More formally, call the hidden sequence `hidden`, then we have that `differences[i] = hidden[i + 1] - hidden[i]`. You are further given two integers `lower` and `upper` that describe the **inclusive** range of values `[lower, upper]` that the hidden sequence can contain. For example, given `differences = [1, -3, 4]`, `lower = 1`, `upper = 6`, the hidden sequence is a sequence of length `4` whose elements are in between `1` and `6` (**inclusive**). `[3, 4, 1, 5]` and `[4, 5, 2, 6]` are possible hidden sequences. `[5, 6, 3, 7]` is not possible since it contains an element greater than `6`. `[1, 2, 3, 4]` is not possible since the differences are not correct. Return _the number of **possible** hidden sequences there are._ If there are no possible sequences, return `0`. **Example 1:** ``` **Input:** differences = [1,-3,4], lower = 1, upper = 6 **Output:** 2 **Explanation:** The possible hidden sequences are: - [3, 4, 1, 5] - [4, 5, 2, 6] Thus, we return 2. ``` **Example 2:** ``` **Input:** differences = [3,-4,5,1,-2], lower = -4, upper = 5 **Output:** 4 **Explanation:** The possible hidden sequences are: - [-3, 0, -4, 1, 2, 0] - [-2, 1, -3, 2, 3, 1] - [-1, 2, -2, 3, 4, 2] - [0, 3, -1, 4, 5, 3] Thus, we return 4. ``` **Example 3:** ``` **Input:** differences = [4,-7,2], lower = 3, upper = 6 **Output:** 0 **Explanation:** There are no possible hidden sequences. Thus, we return 0. ``` **Constraints:** `n == differences.length` `1 <= n <= 105` `-105 <= differences[i] <= 105` `-105 <= lower <= upper <= 105`",
8
+ "public_test_cases": [
9
+ {
10
+ "label": "Example 1",
11
+ "input": "differences = [1,-3,4], lower = 1, upper = 6",
12
+ "output": "2 "
13
+ },
14
+ {
15
+ "label": "Example 2",
16
+ "input": "differences = [3,-4,5,1,-2], lower = -4, upper = 5",
17
+ "output": "4 "
18
+ },
19
+ {
20
+ "label": "Example 3",
21
+ "input": "differences = [4,-7,2], lower = 3, upper = 6",
22
+ "output": "0 "
23
+ }
24
+ ],
25
+ "private_test_cases": [
26
+ {
27
+ "input": [
28
+ [
29
+ -70,
30
+ 69,
31
+ 86,
32
+ -85,
33
+ 96,
34
+ 4,
35
+ 52,
36
+ 48,
37
+ 51,
38
+ -86,
39
+ 71,
40
+ -28,
41
+ 41,
42
+ 16,
43
+ -45,
44
+ -53,
45
+ 73,
46
+ 47,
47
+ -27,
48
+ 33,
49
+ -50,
50
+ -17,
51
+ -73,
52
+ 87,
53
+ -54,
54
+ -17,
55
+ 17,
56
+ -100,
57
+ 101,
58
+ 98,
59
+ -6,
60
+ 22,
61
+ -69,
62
+ -97,
63
+ -89,
64
+ 100,
65
+ -2,
66
+ 40,
67
+ 60,
68
+ 99,
69
+ 16,
70
+ 22,
71
+ -105,
72
+ -27,
73
+ 18,
74
+ -32,
75
+ -95,
76
+ 89,
77
+ 85,
78
+ -67,
79
+ -41,
80
+ -33,
81
+ -7,
82
+ 100
83
+ ],
84
+ 5,
85
+ 100
86
+ ],
87
+ "output": 0
88
+ },
89
+ {
90
+ "input": [
91
+ [
92
+ 27,
93
+ -28,
94
+ -37,
95
+ -47,
96
+ -3,
97
+ 90,
98
+ -46,
99
+ 37,
100
+ -17,
101
+ -14,
102
+ -85,
103
+ 90,
104
+ -53,
105
+ 16,
106
+ 17,
107
+ 17,
108
+ 52,
109
+ 43,
110
+ -89,
111
+ 84,
112
+ 70,
113
+ 2,
114
+ -29,
115
+ 59,
116
+ -70,
117
+ 103,
118
+ 86,
119
+ 58,
120
+ 82,
121
+ 17,
122
+ -48,
123
+ -18
124
+ ],
125
+ 25,
126
+ 53
127
+ ],
128
+ "output": 0
129
+ },
130
+ {
131
+ "input": [
132
+ [
133
+ -13,
134
+ 58,
135
+ 84,
136
+ -26,
137
+ 99,
138
+ -26,
139
+ 6,
140
+ 26,
141
+ -55,
142
+ -70,
143
+ -57,
144
+ 52,
145
+ 72,
146
+ -98,
147
+ 28,
148
+ -99,
149
+ 70,
150
+ 99,
151
+ -23,
152
+ 85,
153
+ 78,
154
+ 64,
155
+ 26,
156
+ 89,
157
+ -42,
158
+ 67,
159
+ -93,
160
+ 56,
161
+ 79,
162
+ 43,
163
+ 49,
164
+ 44,
165
+ -1,
166
+ 60,
167
+ -15,
168
+ 45,
169
+ -88,
170
+ -80,
171
+ 25,
172
+ -78,
173
+ 79,
174
+ 53,
175
+ -71,
176
+ -62,
177
+ -44,
178
+ -89,
179
+ 28,
180
+ -36,
181
+ -82,
182
+ -104,
183
+ -50,
184
+ 46,
185
+ -47,
186
+ 25,
187
+ -50,
188
+ -42,
189
+ -45,
190
+ -76,
191
+ 20
192
+ ],
193
+ -92,
194
+ -4
195
+ ],
196
+ "output": 0
197
+ },
198
+ {
199
+ "input": [
200
+ [
201
+ -77,
202
+ -59,
203
+ -90,
204
+ -45,
205
+ 20,
206
+ -72,
207
+ -68,
208
+ 1,
209
+ -103,
210
+ -11,
211
+ -47,
212
+ 93,
213
+ -10,
214
+ -86,
215
+ -94,
216
+ 76,
217
+ 73
218
+ ],
219
+ -37,
220
+ 48
221
+ ],
222
+ "output": 0
223
+ },
224
+ {
225
+ "input": [
226
+ [
227
+ -105,
228
+ -74,
229
+ -7,
230
+ 68,
231
+ -101,
232
+ -8,
233
+ 49,
234
+ 10,
235
+ 26,
236
+ -83,
237
+ 70,
238
+ 94,
239
+ 60,
240
+ 66,
241
+ 81,
242
+ 98,
243
+ 2,
244
+ 65,
245
+ -69,
246
+ -21,
247
+ -58,
248
+ -42,
249
+ 87,
250
+ -29,
251
+ 78,
252
+ -94,
253
+ -41,
254
+ 36,
255
+ -34,
256
+ 75,
257
+ 94,
258
+ 55,
259
+ -20,
260
+ -38,
261
+ -66,
262
+ 33,
263
+ 105,
264
+ 54,
265
+ 26,
266
+ 78,
267
+ -101,
268
+ 10,
269
+ -31,
270
+ 73,
271
+ 19,
272
+ -81,
273
+ 67,
274
+ -32,
275
+ -11,
276
+ -72,
277
+ -24,
278
+ 34,
279
+ -77,
280
+ 53,
281
+ -74,
282
+ 50,
283
+ 64,
284
+ -62,
285
+ -71,
286
+ 54,
287
+ 54,
288
+ -59,
289
+ -9,
290
+ -21,
291
+ 100,
292
+ -81,
293
+ 66
294
+ ],
295
+ 105,
296
+ 105
297
+ ],
298
+ "output": 0
299
+ },
300
+ {
301
+ "input": [
302
+ [
303
+ 61,
304
+ 33,
305
+ -22,
306
+ 34,
307
+ 13,
308
+ -75,
309
+ -53,
310
+ 90,
311
+ -9,
312
+ 79,
313
+ 55,
314
+ -5,
315
+ 6,
316
+ 55,
317
+ 10,
318
+ -53,
319
+ -104,
320
+ -82,
321
+ 92,
322
+ 46,
323
+ -54,
324
+ -34,
325
+ 85,
326
+ 96,
327
+ -102,
328
+ -28,
329
+ -55,
330
+ -60,
331
+ 19,
332
+ 10,
333
+ 54,
334
+ -63,
335
+ -6,
336
+ 14,
337
+ -80,
338
+ 61,
339
+ -50,
340
+ 43
341
+ ],
342
+ -71,
343
+ 76
344
+ ],
345
+ "output": 0
346
+ },
347
+ {
348
+ "input": [
349
+ [
350
+ 69,
351
+ -12,
352
+ -9,
353
+ 78,
354
+ -50,
355
+ 18,
356
+ -5,
357
+ -28,
358
+ 90,
359
+ 26,
360
+ -60,
361
+ 40,
362
+ -1,
363
+ -95,
364
+ -51,
365
+ 99,
366
+ 64,
367
+ -23,
368
+ -93,
369
+ 6,
370
+ -104,
371
+ -80,
372
+ 26,
373
+ 81,
374
+ -103,
375
+ 56,
376
+ -43,
377
+ 86,
378
+ 66,
379
+ 29,
380
+ -24,
381
+ -86,
382
+ -77,
383
+ 12,
384
+ -36,
385
+ -71,
386
+ 96,
387
+ 10,
388
+ -41,
389
+ -26,
390
+ 72,
391
+ 32,
392
+ -35,
393
+ 99,
394
+ -87
395
+ ],
396
+ 96,
397
+ 104
398
+ ],
399
+ "output": 0
400
+ },
401
+ {
402
+ "input": [
403
+ [
404
+ 6,
405
+ -21,
406
+ 46,
407
+ 90,
408
+ -56,
409
+ -35,
410
+ -91,
411
+ 73,
412
+ -71,
413
+ 23,
414
+ 35,
415
+ 43,
416
+ -13,
417
+ -33,
418
+ 70,
419
+ -92,
420
+ 47,
421
+ 6,
422
+ 32,
423
+ -18,
424
+ 71,
425
+ 20,
426
+ 12,
427
+ -78,
428
+ 40,
429
+ -55,
430
+ -29,
431
+ 48,
432
+ 45,
433
+ 9,
434
+ -83,
435
+ -83,
436
+ 48,
437
+ -52,
438
+ -98,
439
+ 51,
440
+ 17,
441
+ -28,
442
+ -53,
443
+ 46,
444
+ -11,
445
+ -42,
446
+ -83,
447
+ -104,
448
+ -51,
449
+ -88,
450
+ 26
451
+ ],
452
+ -102,
453
+ -72
454
+ ],
455
+ "output": 0
456
+ },
457
+ {
458
+ "input": [
459
+ [
460
+ 53,
461
+ -57,
462
+ -25,
463
+ 29,
464
+ 97,
465
+ 70,
466
+ -62,
467
+ 25,
468
+ 76,
469
+ -58,
470
+ 0,
471
+ 67,
472
+ -9,
473
+ 53,
474
+ -37
475
+ ],
476
+ -65,
477
+ -47
478
+ ],
479
+ "output": 0
480
+ },
481
+ {
482
+ "input": [
483
+ [
484
+ -7,
485
+ 60,
486
+ -76,
487
+ -77,
488
+ -45,
489
+ 17,
490
+ -11,
491
+ 8,
492
+ -78,
493
+ -52,
494
+ 13,
495
+ 33,
496
+ 43,
497
+ -90,
498
+ 61,
499
+ -77,
500
+ -80,
501
+ -32,
502
+ 102,
503
+ -34,
504
+ -33,
505
+ -71,
506
+ -6,
507
+ -71,
508
+ 7,
509
+ 59,
510
+ -93,
511
+ 60,
512
+ 74,
513
+ -53,
514
+ -96,
515
+ 7,
516
+ 43,
517
+ -24,
518
+ -76,
519
+ 72,
520
+ -53,
521
+ -64,
522
+ 23,
523
+ 74,
524
+ -18,
525
+ -7,
526
+ 24,
527
+ 25,
528
+ -20,
529
+ -70,
530
+ 17,
531
+ 90,
532
+ -46,
533
+ 12,
534
+ -103,
535
+ -67,
536
+ -9,
537
+ 83,
538
+ -20,
539
+ 37,
540
+ 22,
541
+ 53,
542
+ -90,
543
+ 87,
544
+ 55,
545
+ -42,
546
+ -60,
547
+ -94,
548
+ -45,
549
+ -23,
550
+ -50,
551
+ 91,
552
+ 71,
553
+ -24,
554
+ -32,
555
+ -94,
556
+ 100,
557
+ -50,
558
+ -47,
559
+ 32,
560
+ 46,
561
+ -11,
562
+ 102,
563
+ 42,
564
+ -53,
565
+ 58
566
+ ],
567
+ 39,
568
+ 62
569
+ ],
570
+ "output": 0
571
+ }
572
+ ],
573
+ "haskell_template": "numberOfArrays :: [Int] -> Int -> Int -> Int\nnumberOfArrays differences lower upper ",
574
+ "ocaml_template": "let numberOfArrays (differences: int list) (lower: int) (upper: int) : int = ",
575
+ "scala_template": "def numberOfArrays(differences: List[Int],lower: Int,upper: Int): Int = { \n \n}",
576
+ "java_template": "public static int numberOfArrays(List<Integer> differences, int lower, int upper) {\n\n}",
577
+ "python_template": "class Solution(object):\n def numberOfArrays(self, differences, lower, upper):\n \"\"\"\n :type differences: List[int]\n :type lower: int\n :type upper: int\n :rtype: int\n \"\"\"\n "
578
+ }
count_the_hidden_sequences/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 2 (numberOfArrays [1;-3;4] 1 6)
12
+
13
+ let test2 _ = assert_equal 4 (numberOfArrays [3;-4;5;1;-2] ( -4) 5)
14
+
15
+ let test3 _ = assert_equal 0 (numberOfArrays [4;-7;2] 3 6)
16
+
17
+
18
+ (* Grouping test cases *)
19
+ let suite = "Test Suite for numberOfArrays" >::: [
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
count_the_hidden_sequences/scala_tests/MySuite.scala ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ class MySuite extends munit.FunSuite {
3
+
4
+ test("test1") {
5
+ assertEquals(Main.numberOfArrays(List(1,-3,4),1,6), 2)
6
+ }
7
+
8
+ test("test2") {
9
+ assertEquals(Main.numberOfArrays(List(3,-4,5,1,-2),-4,5), 4)
10
+ }
11
+
12
+ test("test3") {
13
+ assertEquals(Main.numberOfArrays(List(4,-7,2),3,6), 0)
14
+ }
15
+
16
+ }
count_the_number_of_arrays_with_k_matching_adjacent_elements/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 (countGoodArrays 3 2 1)," 4 (countGoodArrays 3 2 1))
13
+
14
+ test2 :: Test
15
+ test2 = TestCase (assertEqual "for (countGoodArrays 4 2 2)," 6 (countGoodArrays 4 2 2))
16
+
17
+ test3 :: Test
18
+ test3 = TestCase (assertEqual "for (countGoodArrays 5 2 0)," 2 (countGoodArrays 5 2 0))
19
+
20
+ test4 :: Test
21
+ test4 = TestCase (assertEqual "for (countGoodArrays 46602 24391 20531)," 891511181 (countGoodArrays 46602 24391 20531))
22
+
23
+ test5 :: Test
24
+ test5 = TestCase (assertEqual "for (countGoodArrays 17103 5354 10144)," 343110856 (countGoodArrays 17103 5354 10144))
25
+
26
+ test6 :: Test
27
+ test6 = TestCase (assertEqual "for (countGoodArrays 5697 37912 4080)," 738769666 (countGoodArrays 5697 37912 4080))
28
+
29
+ test7 :: Test
30
+ test7 = TestCase (assertEqual "for (countGoodArrays 80119 96321 52737)," 615287085 (countGoodArrays 80119 96321 52737))
31
+
32
+ test8 :: Test
33
+ test8 = TestCase (assertEqual "for (countGoodArrays 98177 38305 44965)," 532242521 (countGoodArrays 98177 38305 44965))
34
+
35
+ test9 :: Test
36
+ test9 = TestCase (assertEqual "for (countGoodArrays 10577 75301 8138)," 82714097 (countGoodArrays 10577 75301 8138))
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
count_the_number_of_arrays_with_k_matching_adjacent_elements/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(4, countGoodArrays(3, 2, 1));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals(6, countGoodArrays(4, 2, 2));
19
+ }
20
+ @Test
21
+ public void test3() {
22
+ assertEquals(2, countGoodArrays(5, 2, 0));
23
+ }
24
+
25
+ }
count_the_number_of_arrays_with_k_matching_adjacent_elements/meta.json ADDED
@@ -0,0 +1,112 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "id": 3682,
3
+ "name": "count_the_number_of_arrays_with_k_matching_adjacent_elements",
4
+ "difficulty": "Hard",
5
+ "link": "https://leetcode.com/problems/count-the-number-of-arrays-with-k-matching-adjacent-elements/",
6
+ "date": "2024-12-22 00:00:00",
7
+ "task_description": "You are given three integers `n`, `m`, `k`. A **good array** `arr` of size `n` is defined as follows: Each element in `arr` is in the **inclusive** range `[1, m]`. _Exactly_ `k` indices `i` (where `1 <= i < n`) satisfy the condition `arr[i - 1] == arr[i]`. Return the number of **good arrays** that can be formed. Since the answer may be very large, return it **modulo **`109 + 7`. **Example 1:** **Input:** n = 3, m = 2, k = 1 **Output:** 4 **Explanation:** There are 4 good arrays. They are `[1, 1, 2]`, `[1, 2, 2]`, `[2, 1, 1]` and `[2, 2, 1]`. Hence, the answer is 4. **Example 2:** **Input:** n = 4, m = 2, k = 2 **Output:** 6 **Explanation:** The good arrays are `[1, 1, 1, 2]`, `[1, 1, 2, 2]`, `[1, 2, 2, 2]`, `[2, 1, 1, 1]`, `[2, 2, 1, 1]` and `[2, 2, 2, 1]`. Hence, the answer is 6. **Example 3:** **Input:** n = 5, m = 2, k = 0 **Output:** 2 **Explanation:** The good arrays are `[1, 2, 1, 2, 1]` and `[2, 1, 2, 1, 2]`. Hence, the answer is 2. **Constraints:** `1 <= n <= 105` `1 <= m <= 105` `0 <= k <= n - 1`",
8
+ "public_test_cases": [
9
+ {
10
+ "label": "Example 1",
11
+ "input": "n = 3, m = 2, k = 1",
12
+ "output": "4 "
13
+ },
14
+ {
15
+ "label": "Example 2",
16
+ "input": "n = 4, m = 2, k = 2",
17
+ "output": "6 "
18
+ },
19
+ {
20
+ "label": "Example 3",
21
+ "input": "n = 5, m = 2, k = 0",
22
+ "output": "2 "
23
+ }
24
+ ],
25
+ "private_test_cases": [
26
+ {
27
+ "input": [
28
+ 46602,
29
+ 24391,
30
+ 20531
31
+ ],
32
+ "output": 891511181
33
+ },
34
+ {
35
+ "input": [
36
+ 17103,
37
+ 5354,
38
+ 10144
39
+ ],
40
+ "output": 343110856
41
+ },
42
+ {
43
+ "input": [
44
+ 5697,
45
+ 37912,
46
+ 4080
47
+ ],
48
+ "output": 738769666
49
+ },
50
+ {
51
+ "input": [
52
+ 80119,
53
+ 96321,
54
+ 52737
55
+ ],
56
+ "output": 615287085
57
+ },
58
+ {
59
+ "input": [
60
+ 98177,
61
+ 38305,
62
+ 44965
63
+ ],
64
+ "output": 532242521
65
+ },
66
+ {
67
+ "input": [
68
+ 10577,
69
+ 75301,
70
+ 8138
71
+ ],
72
+ "output": 82714097
73
+ },
74
+ {
75
+ "input": [
76
+ 25557,
77
+ 67054,
78
+ 13962
79
+ ],
80
+ "output": 763883936
81
+ },
82
+ {
83
+ "input": [
84
+ 62512,
85
+ 2930,
86
+ 56704
87
+ ],
88
+ "output": 628401229
89
+ },
90
+ {
91
+ "input": [
92
+ 89952,
93
+ 94204,
94
+ 41803
95
+ ],
96
+ "output": 623576131
97
+ },
98
+ {
99
+ "input": [
100
+ 43138,
101
+ 58555,
102
+ 14245
103
+ ],
104
+ "output": 969703223
105
+ }
106
+ ],
107
+ "haskell_template": "countGoodArrays :: Int -> Int -> Int -> Int\ncountGoodArrays n m k ",
108
+ "ocaml_template": "let countGoodArrays (n: int) (m: int) (k: int) : int = ",
109
+ "scala_template": "def countGoodArrays(n: Int,m: Int,k: Int): Int = { \n \n}",
110
+ "java_template": "class Solution {\n public int countGoodArrays(int n, int m, int k) {\n \n }\n}",
111
+ "python_template": "class Solution(object):\n def countGoodArrays(self, n, m, k):\n \"\"\"\n :type n: int\n :type m: int\n :type k: int\n :rtype: int\n \"\"\"\n "
112
+ }
count_the_number_of_arrays_with_k_matching_adjacent_elements/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 4 (countGoodArrays 3 2 1)
12
+
13
+ let test2 _ = assert_equal 6 (countGoodArrays 4 2 2)
14
+
15
+ let test3 _ = assert_equal 2 (countGoodArrays 5 2 0)
16
+
17
+ let test4 _ = assert_equal 891511181 (countGoodArrays 46602 24391 20531)
18
+
19
+ let test5 _ = assert_equal 343110856 (countGoodArrays 17103 5354 10144)
20
+
21
+ let test6 _ = assert_equal 738769666 (countGoodArrays 5697 37912 4080)
22
+
23
+ let test7 _ = assert_equal 615287085 (countGoodArrays 80119 96321 52737)
24
+
25
+ let test8 _ = assert_equal 532242521 (countGoodArrays 98177 38305 44965)
26
+
27
+ let test9 _ = assert_equal 82714097 (countGoodArrays 10577 75301 8138)
28
+
29
+ let test10 _ = assert_equal 763883936 (countGoodArrays 25557 67054 13962)
30
+
31
+
32
+ (* Grouping test cases *)
33
+ let suite = "Test Suite for countGoodArrays" >::: [
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
count_the_number_of_arrays_with_k_matching_adjacent_elements/scala_tests/MySuite.scala ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ class MySuite extends munit.FunSuite {
3
+
4
+ test("test1") {
5
+ assertEquals(Main.countGoodArrays(3,2,1), 4)
6
+ }
7
+
8
+ test("test2") {
9
+ assertEquals(Main.countGoodArrays(4,2,2), 6)
10
+ }
11
+
12
+ test("test3") {
13
+ assertEquals(Main.countGoodArrays(5,2,0), 2)
14
+ }
15
+
16
+ test("test4") {
17
+ assertEquals(Main.countGoodArrays(46602,24391,20531), 891511181)
18
+ }
19
+
20
+ test("test5") {
21
+ assertEquals(Main.countGoodArrays(17103,5354,10144), 343110856)
22
+ }
23
+
24
+ test("test6") {
25
+ assertEquals(Main.countGoodArrays(5697,37912,4080), 738769666)
26
+ }
27
+
28
+ test("test7") {
29
+ assertEquals(Main.countGoodArrays(80119,96321,52737), 615287085)
30
+ }
31
+
32
+ test("test8") {
33
+ assertEquals(Main.countGoodArrays(98177,38305,44965), 532242521)
34
+ }
35
+
36
+ test("test9") {
37
+ assertEquals(Main.countGoodArrays(10577,75301,8138), 82714097)
38
+ }
39
+
40
+ test("test10") {
41
+ assertEquals(Main.countGoodArrays(25557,67054,13962), 763883936)
42
+ }
43
+
44
+ }