DatasetRepo commited on
Commit
5b97c37
·
verified ·
1 Parent(s): 621c2eb

01a35ba565c422ec36f98a97d382fe7678d18342875849716a4de188c10fda52

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. find_the_maximum_number_of_elements_in_subset/java_tests/Main.java +20 -0
  3. find_the_maximum_number_of_elements_in_subset/meta.json +0 -0
  4. find_the_maximum_number_of_elements_in_subset/ocaml_tests/main.ml +0 -0
  5. find_the_maximum_number_of_elements_in_subset/scala_tests/MySuite.scala +0 -0
  6. find_the_maximum_number_of_marked_indices/.DS_Store +0 -0
  7. find_the_maximum_number_of_marked_indices/haskell_tests/Main.hs +27 -0
  8. find_the_maximum_number_of_marked_indices/java_tests/Main.java +25 -0
  9. find_the_maximum_number_of_marked_indices/meta.json +3 -0
  10. find_the_maximum_number_of_marked_indices/ocaml_tests/main.ml +29 -0
  11. find_the_maximum_number_of_marked_indices/scala_tests/MySuite.scala +16 -0
  12. find_the_maximum_sequence_value_of_array/haskell_tests/Main.hs +45 -0
  13. find_the_maximum_sequence_value_of_array/java_tests/Main.java +21 -0
  14. find_the_maximum_sequence_value_of_array/meta.json +2283 -0
  15. find_the_maximum_sequence_value_of_array/ocaml_tests/main.ml +50 -0
  16. find_the_maximum_sequence_value_of_array/scala_tests/MySuite.scala +44 -0
  17. find_the_maximum_sum_of_node_values/haskell_tests/Main.hs +45 -0
  18. find_the_maximum_sum_of_node_values/java_tests/Main.java +25 -0
  19. find_the_maximum_sum_of_node_values/meta.json +707 -0
  20. find_the_maximum_sum_of_node_values/ocaml_tests/main.ml +50 -0
  21. find_the_maximum_sum_of_node_values/scala_tests/MySuite.scala +44 -0
  22. find_the_median_of_the_uniqueness_array/haskell_tests/Main.hs +0 -0
  23. find_the_median_of_the_uniqueness_array/java_tests/Main.java +24 -0
  24. find_the_median_of_the_uniqueness_array/meta.json +0 -0
  25. find_the_median_of_the_uniqueness_array/ocaml_tests/main.ml +0 -0
  26. find_the_median_of_the_uniqueness_array/scala_tests/MySuite.scala +0 -0
  27. find_the_minimum_amount_of_time_to_brew_potions/haskell_tests/Main.hs +0 -0
  28. find_the_minimum_amount_of_time_to_brew_potions/java_tests/Main.java +25 -0
  29. find_the_minimum_amount_of_time_to_brew_potions/meta.json +0 -0
  30. find_the_minimum_amount_of_time_to_brew_potions/ocaml_tests/main.ml +0 -0
  31. find_the_minimum_amount_of_time_to_brew_potions/scala_tests/MySuite.scala +0 -0
  32. find_the_minimum_area_to_cover_all_ones_i/haskell_tests/Main.hs +0 -0
  33. find_the_minimum_area_to_cover_all_ones_i/java_tests/Main.java +20 -0
  34. find_the_minimum_area_to_cover_all_ones_i/meta.json +3 -0
  35. find_the_minimum_area_to_cover_all_ones_i/ocaml_tests/main.ml +0 -0
  36. find_the_minimum_area_to_cover_all_ones_i/scala_tests/MySuite.scala +0 -0
  37. find_the_minimum_area_to_cover_all_ones_ii/java_tests/Main.java +20 -0
  38. find_the_minimum_cost_array_permutation/haskell_tests/Main.hs +47 -0
  39. find_the_minimum_cost_array_permutation/java_tests/Main.java +20 -0
  40. find_the_minimum_cost_array_permutation/meta.json +227 -0
  41. find_the_minimum_cost_array_permutation/ocaml_tests/main.ml +51 -0
  42. find_the_minimum_cost_array_permutation/scala_tests/MySuite.scala +44 -0
  43. find_the_minimum_possible_sum_of_a_beautiful_array/haskell_tests/Main.hs +45 -0
  44. find_the_minimum_possible_sum_of_a_beautiful_array/java_tests/Main.java +25 -0
  45. find_the_minimum_possible_sum_of_a_beautiful_array/meta.json +102 -0
  46. find_the_minimum_possible_sum_of_a_beautiful_array/ocaml_tests/main.ml +50 -0
  47. find_the_minimum_possible_sum_of_a_beautiful_array/scala_tests/MySuite.scala +44 -0
  48. find_the_n_th_value_after_k_seconds/haskell_tests/Main.hs +45 -0
  49. find_the_n_th_value_after_k_seconds/java_tests/Main.java +21 -0
  50. find_the_n_th_value_after_k_seconds/meta.json +97 -0
.gitattributes CHANGED
@@ -124,3 +124,5 @@ find_subtree_sizes_after_changes/meta.json filter=lfs diff=lfs merge=lfs -text
124
  find_the_first_player_to_win_k_games_in_a_row/meta.json filter=lfs diff=lfs merge=lfs -text
125
  find_the_k_sum_of_an_array/meta.json filter=lfs diff=lfs merge=lfs -text
126
  find_the_longest_equal_subarray/meta.json filter=lfs diff=lfs merge=lfs -text
 
 
 
124
  find_the_first_player_to_win_k_games_in_a_row/meta.json filter=lfs diff=lfs merge=lfs -text
125
  find_the_k_sum_of_an_array/meta.json filter=lfs diff=lfs merge=lfs -text
126
  find_the_longest_equal_subarray/meta.json filter=lfs diff=lfs merge=lfs -text
127
+ find_the_maximum_number_of_marked_indices/meta.json filter=lfs diff=lfs merge=lfs -text
128
+ find_the_minimum_area_to_cover_all_ones_i/meta.json filter=lfs diff=lfs merge=lfs -text
find_the_maximum_number_of_elements_in_subset/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, maximumLength(Arrays.asList(5,4,1,2,2)));
14
+ }
15
+ @Test
16
+ public void test2() {
17
+ assertEquals(1, maximumLength(Arrays.asList(1,3,2,4)));
18
+ }
19
+
20
+ }
find_the_maximum_number_of_elements_in_subset/meta.json ADDED
The diff for this file is too large to render. See raw diff
 
find_the_maximum_number_of_elements_in_subset/ocaml_tests/main.ml ADDED
The diff for this file is too large to render. See raw diff
 
find_the_maximum_number_of_elements_in_subset/scala_tests/MySuite.scala ADDED
The diff for this file is too large to render. See raw diff
 
find_the_maximum_number_of_marked_indices/.DS_Store ADDED
Binary file (6.15 kB). View file
 
find_the_maximum_number_of_marked_indices/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 (maxNumOfMarkedIndices [3,5,2,4])," 2 (maxNumOfMarkedIndices [3,5,2,4]))
13
+
14
+ test2 :: Test
15
+ test2 = TestCase (assertEqual "for (maxNumOfMarkedIndices [9,2,5,4])," 4 (maxNumOfMarkedIndices [9,2,5,4]))
16
+
17
+ test3 :: Test
18
+ test3 = TestCase (assertEqual "for (maxNumOfMarkedIndices [7,6,8])," 0 (maxNumOfMarkedIndices [7,6,8]))
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
find_the_maximum_number_of_marked_indices/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, maxNumOfMarkedIndices(new ArrayList<>(Arrays.asList(3,5,2,4))));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals(4, maxNumOfMarkedIndices(new ArrayList<>(Arrays.asList(9,2,5,4))));
19
+ }
20
+ @Test
21
+ public void test3() {
22
+ assertEquals(0, maxNumOfMarkedIndices(new ArrayList<>(Arrays.asList(7,6,8))));
23
+ }
24
+
25
+ }
find_the_maximum_number_of_marked_indices/meta.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4af15dbf5ec6d8954bde3c7cc470b5745ff1009c98a4c7f3aab01155068b9d99
3
+ size 14313071
find_the_maximum_number_of_marked_indices/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 (maxNumOfMarkedIndices [3;5;2;4])
12
+
13
+ let test2 _ = assert_equal 4 (maxNumOfMarkedIndices [9;2;5;4])
14
+
15
+ let test3 _ = assert_equal 0 (maxNumOfMarkedIndices [7;6;8])
16
+
17
+
18
+ (* Grouping test cases *)
19
+ let suite = "Test Suite for maxNumOfMarkedIndices" >::: [
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
find_the_maximum_number_of_marked_indices/scala_tests/MySuite.scala ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ class MySuite extends munit.FunSuite {
3
+
4
+ test("test1") {
5
+ assertEquals(Main.maxNumOfMarkedIndices(List(3,5,2,4)), 2)
6
+ }
7
+
8
+ test("test2") {
9
+ assertEquals(Main.maxNumOfMarkedIndices(List(9,2,5,4)), 4)
10
+ }
11
+
12
+ test("test3") {
13
+ assertEquals(Main.maxNumOfMarkedIndices(List(7,6,8)), 0)
14
+ }
15
+
16
+ }
find_the_maximum_sequence_value_of_array/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 (maxValue [2,6,7] 1)," 5 (maxValue [2,6,7] 1))
13
+
14
+ test2 :: Test
15
+ test2 = TestCase (assertEqual "for (maxValue [4,2,5,6,7] 2)," 2 (maxValue [4,2,5,6,7] 2))
16
+
17
+ test3 :: Test
18
+ test3 = TestCase (assertEqual "for (maxValue [16, 9, 22, 18, 19, 10, 19, 14, 13, 8, 12, 3, 13, 21, 15, 15, 19, 20, 19, 20, 23, 7, 7, 2, 5, 11, 25, 2, 21, 1, 19, 3, 20, 6, 4, 12, 11, 7, 14, 16, 8, 6, 6, 13, 22, 2, 9, 1, 17, 26, 19, 23, 5, 12, 22, 1, 9, 6, 26, 6, 21, 13, 5, 16, 20, 4, 6, 20, 13, 22, 11, 12, 8, 11, 22, 20, 23, 8, 5, 1, 23, 20, 12, 2, 21, 20, 3, 4, 8, 1, 18, 17, 21, 1, 17, 14, 22, 20, 23, 25, 11, 23, 17, 3, 24, 1, 4, 21, 23, 5, 17, 22, 1, 17, 14, 24, 26, 18, 25, 12, 3, 25, 11, 6, 9, 26, 24, 16, 5, 15, 14, 19, 23, 10, 25, 11, 1, 5, 12, 21, 2, 16, 19, 22, 18, 3, 22, 18, 19, 7, 21, 6, 2, 11, 22, 14, 21, 12, 24, 11, 5, 12, 17, 14, 15, 23, 1, 9, 9, 1, 7, 19, 15, 10, 13, 6, 22, 14, 5, 9, 10, 10, 13, 7, 18, 20, 22, 3, 17, 16, 20, 12, 15, 16, 17, 17, 5, 1, 25, 16, 14, 7, 25, 24, 11, 18, 15, 21, 6, 20, 24, 7, 10, 21, 4, 6, 20, 12, 8, 10, 25, 3, 3, 8, 5, 24, 12, 10, 7, 24, 25, 8, 4, 1, 8, 18, 15, 15, 11, 26, 8, 12, 24, 24, 13, 15, 18, 25, 17, 19] 24)," 31 (maxValue [16, 9, 22, 18, 19, 10, 19, 14, 13, 8, 12, 3, 13, 21, 15, 15, 19, 20, 19, 20, 23, 7, 7, 2, 5, 11, 25, 2, 21, 1, 19, 3, 20, 6, 4, 12, 11, 7, 14, 16, 8, 6, 6, 13, 22, 2, 9, 1, 17, 26, 19, 23, 5, 12, 22, 1, 9, 6, 26, 6, 21, 13, 5, 16, 20, 4, 6, 20, 13, 22, 11, 12, 8, 11, 22, 20, 23, 8, 5, 1, 23, 20, 12, 2, 21, 20, 3, 4, 8, 1, 18, 17, 21, 1, 17, 14, 22, 20, 23, 25, 11, 23, 17, 3, 24, 1, 4, 21, 23, 5, 17, 22, 1, 17, 14, 24, 26, 18, 25, 12, 3, 25, 11, 6, 9, 26, 24, 16, 5, 15, 14, 19, 23, 10, 25, 11, 1, 5, 12, 21, 2, 16, 19, 22, 18, 3, 22, 18, 19, 7, 21, 6, 2, 11, 22, 14, 21, 12, 24, 11, 5, 12, 17, 14, 15, 23, 1, 9, 9, 1, 7, 19, 15, 10, 13, 6, 22, 14, 5, 9, 10, 10, 13, 7, 18, 20, 22, 3, 17, 16, 20, 12, 15, 16, 17, 17, 5, 1, 25, 16, 14, 7, 25, 24, 11, 18, 15, 21, 6, 20, 24, 7, 10, 21, 4, 6, 20, 12, 8, 10, 25, 3, 3, 8, 5, 24, 12, 10, 7, 24, 25, 8, 4, 1, 8, 18, 15, 15, 11, 26, 8, 12, 24, 24, 13, 15, 18, 25, 17, 19] 24))
19
+
20
+ test4 :: Test
21
+ test4 = TestCase (assertEqual "for (maxValue [6, 12, 2, 26, 20, 24, 7, 14, 22, 23, 25, 24, 14, 6, 6, 26, 21, 12, 26, 13, 4, 15, 16, 8, 24, 8, 11, 26, 10, 13, 19, 12, 9, 18, 7, 22, 13, 25, 13, 16, 14, 8, 25, 9, 6, 15, 20, 17, 20, 18, 21, 8, 5, 6, 20, 20, 24, 17, 23, 9, 24, 26, 12, 21, 23, 6, 9, 18, 20, 20, 24, 13, 12, 1, 20, 6, 20, 4, 22, 10, 9, 24, 13, 2, 23, 22, 14, 15, 18, 13, 8, 7, 22, 1, 7, 14, 16, 22, 21, 24, 17, 9, 11, 12, 7, 3, 17, 9, 11, 5, 5, 10, 19, 7, 23, 2, 9, 26, 15, 21, 21, 2, 15, 24, 13, 23, 20, 3, 5, 17, 19, 4, 5, 2, 14, 13, 25, 12, 8, 8, 8, 5, 23, 10, 24, 9, 25, 3, 20, 19, 4, 17, 15, 25, 8, 20, 17, 18, 10, 2, 21, 21, 6, 15, 25, 15, 20, 1, 1, 12, 24, 17, 18, 2, 1, 20, 23, 22, 1, 3, 10, 17, 15, 8, 11, 13, 14, 4, 25, 10, 8, 16, 22, 21, 3, 16, 12, 5, 6, 25, 12, 2, 18, 20, 8, 26, 8, 23, 11, 20, 1, 25, 19, 15, 5, 24, 3, 7, 10, 12, 2, 1, 22, 3, 21, 14, 7, 25, 24, 12, 1, 2, 24, 22, 26, 3, 21, 12, 15, 15, 25, 2, 14, 13, 5, 18, 6, 12, 23, 18, 4, 24, 5, 19, 20, 9, 19, 26, 4, 6, 6, 19, 1, 5, 1, 1, 16, 21, 20, 6, 15, 4, 1, 6, 9, 18, 3, 24, 7, 3, 17, 16, 10, 23, 9, 18, 11, 16, 4, 12, 1, 2, 14, 21, 3, 19, 24, 19, 11, 25, 20, 23, 15, 22, 24, 11, 18, 10, 13, 11, 12, 13, 24, 6, 9, 24, 11, 14, 18, 13, 15, 15, 6, 24, 3, 6, 12, 12, 26, 9, 25, 2, 15, 1, 14] 114)," 16 (maxValue [6, 12, 2, 26, 20, 24, 7, 14, 22, 23, 25, 24, 14, 6, 6, 26, 21, 12, 26, 13, 4, 15, 16, 8, 24, 8, 11, 26, 10, 13, 19, 12, 9, 18, 7, 22, 13, 25, 13, 16, 14, 8, 25, 9, 6, 15, 20, 17, 20, 18, 21, 8, 5, 6, 20, 20, 24, 17, 23, 9, 24, 26, 12, 21, 23, 6, 9, 18, 20, 20, 24, 13, 12, 1, 20, 6, 20, 4, 22, 10, 9, 24, 13, 2, 23, 22, 14, 15, 18, 13, 8, 7, 22, 1, 7, 14, 16, 22, 21, 24, 17, 9, 11, 12, 7, 3, 17, 9, 11, 5, 5, 10, 19, 7, 23, 2, 9, 26, 15, 21, 21, 2, 15, 24, 13, 23, 20, 3, 5, 17, 19, 4, 5, 2, 14, 13, 25, 12, 8, 8, 8, 5, 23, 10, 24, 9, 25, 3, 20, 19, 4, 17, 15, 25, 8, 20, 17, 18, 10, 2, 21, 21, 6, 15, 25, 15, 20, 1, 1, 12, 24, 17, 18, 2, 1, 20, 23, 22, 1, 3, 10, 17, 15, 8, 11, 13, 14, 4, 25, 10, 8, 16, 22, 21, 3, 16, 12, 5, 6, 25, 12, 2, 18, 20, 8, 26, 8, 23, 11, 20, 1, 25, 19, 15, 5, 24, 3, 7, 10, 12, 2, 1, 22, 3, 21, 14, 7, 25, 24, 12, 1, 2, 24, 22, 26, 3, 21, 12, 15, 15, 25, 2, 14, 13, 5, 18, 6, 12, 23, 18, 4, 24, 5, 19, 20, 9, 19, 26, 4, 6, 6, 19, 1, 5, 1, 1, 16, 21, 20, 6, 15, 4, 1, 6, 9, 18, 3, 24, 7, 3, 17, 16, 10, 23, 9, 18, 11, 16, 4, 12, 1, 2, 14, 21, 3, 19, 24, 19, 11, 25, 20, 23, 15, 22, 24, 11, 18, 10, 13, 11, 12, 13, 24, 6, 9, 24, 11, 14, 18, 13, 15, 15, 6, 24, 3, 6, 12, 12, 26, 9, 25, 2, 15, 1, 14] 114))
22
+
23
+ test5 :: Test
24
+ test5 = TestCase (assertEqual "for (maxValue [9, 19, 5, 13, 13, 8, 5, 26, 7, 11, 8, 3, 12, 18, 19, 12, 16, 9, 26, 6, 20, 24, 3, 11, 13, 4, 2, 7, 2, 6, 12, 23, 16, 22, 3, 17, 13, 10, 19, 17, 10, 10, 2, 2, 24, 19, 6, 10, 3, 22, 17, 7, 19, 25, 16, 18, 6, 24, 13, 13, 9, 22, 9, 25, 15, 1, 3, 25, 6, 25, 17, 26, 14, 4, 17, 13, 8, 4, 7, 8, 23, 1, 25, 14, 19, 26, 12, 3, 12, 16, 24, 25, 11, 14, 13, 12, 13, 17, 25, 19, 8, 12, 15, 23, 26, 26, 13, 9, 3, 4, 6, 7, 10, 17, 1, 7, 24, 13, 3, 4, 18, 9, 17, 15, 4, 24, 1, 24, 8, 14, 13, 2, 25, 2, 7, 21, 23, 22, 25, 10, 2, 9, 3, 7, 13, 9, 5, 15, 15, 20, 20, 12, 25, 2, 17, 9, 26, 14, 20, 12, 2, 23, 6, 11, 20, 10, 17, 1, 20, 12, 16, 17, 4, 3, 14, 12, 8, 25, 15, 15, 16, 6, 10, 12, 21, 9, 6, 13, 18, 26, 9, 15, 5, 17, 6, 9, 23, 20, 11, 16, 24, 16, 24, 16, 7, 4, 4, 11, 15, 22, 3, 7, 9, 12, 24, 8, 20, 24, 26, 13, 13, 19, 3, 17, 19, 9, 8, 19, 1, 10, 19, 1, 2, 20, 12, 16, 7, 24, 7, 24, 2, 23, 14, 9, 2, 19, 25, 11, 2, 3, 12, 6, 19, 15, 15, 9, 7, 12, 3, 24, 6, 7, 17, 17, 26, 13, 12, 14, 22, 21, 4, 9, 25, 8, 9, 11, 10, 23, 19, 7, 3, 26, 13, 18, 23, 12, 21, 25, 25, 16, 19, 12, 18, 15, 15, 10, 22, 6, 12, 4, 25, 2, 21, 22, 5, 12, 3, 15, 9, 11, 19, 8, 20, 11, 14, 12, 23, 1, 20, 10, 2, 6, 15, 23, 2, 9, 16, 15, 21, 24, 20, 21, 25, 13, 24, 18, 10, 16, 25, 23, 13, 23, 25, 7, 26, 15, 16, 16, 16, 24, 22, 4, 3, 3, 7, 21, 2, 1, 9, 9, 10, 13, 20, 18, 24, 17, 23, 7] 29)," 31 (maxValue [9, 19, 5, 13, 13, 8, 5, 26, 7, 11, 8, 3, 12, 18, 19, 12, 16, 9, 26, 6, 20, 24, 3, 11, 13, 4, 2, 7, 2, 6, 12, 23, 16, 22, 3, 17, 13, 10, 19, 17, 10, 10, 2, 2, 24, 19, 6, 10, 3, 22, 17, 7, 19, 25, 16, 18, 6, 24, 13, 13, 9, 22, 9, 25, 15, 1, 3, 25, 6, 25, 17, 26, 14, 4, 17, 13, 8, 4, 7, 8, 23, 1, 25, 14, 19, 26, 12, 3, 12, 16, 24, 25, 11, 14, 13, 12, 13, 17, 25, 19, 8, 12, 15, 23, 26, 26, 13, 9, 3, 4, 6, 7, 10, 17, 1, 7, 24, 13, 3, 4, 18, 9, 17, 15, 4, 24, 1, 24, 8, 14, 13, 2, 25, 2, 7, 21, 23, 22, 25, 10, 2, 9, 3, 7, 13, 9, 5, 15, 15, 20, 20, 12, 25, 2, 17, 9, 26, 14, 20, 12, 2, 23, 6, 11, 20, 10, 17, 1, 20, 12, 16, 17, 4, 3, 14, 12, 8, 25, 15, 15, 16, 6, 10, 12, 21, 9, 6, 13, 18, 26, 9, 15, 5, 17, 6, 9, 23, 20, 11, 16, 24, 16, 24, 16, 7, 4, 4, 11, 15, 22, 3, 7, 9, 12, 24, 8, 20, 24, 26, 13, 13, 19, 3, 17, 19, 9, 8, 19, 1, 10, 19, 1, 2, 20, 12, 16, 7, 24, 7, 24, 2, 23, 14, 9, 2, 19, 25, 11, 2, 3, 12, 6, 19, 15, 15, 9, 7, 12, 3, 24, 6, 7, 17, 17, 26, 13, 12, 14, 22, 21, 4, 9, 25, 8, 9, 11, 10, 23, 19, 7, 3, 26, 13, 18, 23, 12, 21, 25, 25, 16, 19, 12, 18, 15, 15, 10, 22, 6, 12, 4, 25, 2, 21, 22, 5, 12, 3, 15, 9, 11, 19, 8, 20, 11, 14, 12, 23, 1, 20, 10, 2, 6, 15, 23, 2, 9, 16, 15, 21, 24, 20, 21, 25, 13, 24, 18, 10, 16, 25, 23, 13, 23, 25, 7, 26, 15, 16, 16, 16, 24, 22, 4, 3, 3, 7, 21, 2, 1, 9, 9, 10, 13, 20, 18, 24, 17, 23, 7] 29))
25
+
26
+ test6 :: Test
27
+ test6 = TestCase (assertEqual "for (maxValue [17, 9, 22, 3, 1, 5, 7, 5, 17, 6, 23, 16, 20, 11, 4, 9, 14, 16, 10, 20, 8, 4, 14, 4, 19, 9, 7, 5, 10, 20, 6, 1, 23, 4, 12, 17, 11, 20, 17, 9, 10, 4, 25, 16, 2, 17, 1, 19, 23, 21, 6, 14, 19, 23, 11, 24, 22, 7, 7, 13, 26, 12, 25, 15, 12, 26, 11, 13, 20, 1, 15, 10, 26, 21, 14, 18, 16, 15, 4, 21, 16, 17, 4, 18, 19, 20, 7, 22, 18, 1, 13, 9, 3, 5, 16, 8, 5, 26, 24, 12, 1, 15, 12, 4, 8, 16, 25, 17, 25, 11, 14, 21, 13, 5, 25, 24, 22, 21, 18, 13, 15, 12, 14, 19] 37)," 24 (maxValue [17, 9, 22, 3, 1, 5, 7, 5, 17, 6, 23, 16, 20, 11, 4, 9, 14, 16, 10, 20, 8, 4, 14, 4, 19, 9, 7, 5, 10, 20, 6, 1, 23, 4, 12, 17, 11, 20, 17, 9, 10, 4, 25, 16, 2, 17, 1, 19, 23, 21, 6, 14, 19, 23, 11, 24, 22, 7, 7, 13, 26, 12, 25, 15, 12, 26, 11, 13, 20, 1, 15, 10, 26, 21, 14, 18, 16, 15, 4, 21, 16, 17, 4, 18, 19, 20, 7, 22, 18, 1, 13, 9, 3, 5, 16, 8, 5, 26, 24, 12, 1, 15, 12, 4, 8, 16, 25, 17, 25, 11, 14, 21, 13, 5, 25, 24, 22, 21, 18, 13, 15, 12, 14, 19] 37))
28
+
29
+ test7 :: Test
30
+ test7 = TestCase (assertEqual "for (maxValue [13, 18, 14, 14, 1, 19, 25, 6, 2, 2, 26, 9, 5, 23, 10, 10, 11, 13, 15, 2, 25, 22, 16, 2, 14, 22, 22, 24, 8, 9, 2, 14, 1, 18, 11, 13, 3, 5, 9, 26, 5, 6, 24, 7, 17, 24, 8, 3, 25, 11, 24, 17, 15, 19, 16, 25, 2, 2, 6, 4, 1, 23, 11, 1, 8, 18, 3, 9, 23, 9, 4, 8, 11, 19, 25, 6, 13, 24, 18, 9, 21, 4, 5, 2, 24, 19, 14, 15, 2, 7, 24, 3, 18, 11, 2, 19, 15, 8, 12, 4, 15, 6, 7, 3, 6, 1, 11, 23, 15, 25, 2, 20, 10, 13, 2, 8, 2, 19, 5, 20, 5, 6, 15, 4, 13, 7, 13, 20, 1, 15, 7, 3, 20, 4, 25, 16, 22, 8, 7, 17, 19, 22, 14, 7, 14, 14, 23, 5, 25, 17, 5, 23, 3, 4, 16, 6, 25, 7, 1, 10, 16, 9, 20, 14, 2, 24, 26, 3, 8, 11, 24, 1, 4, 23, 26, 12, 15, 18, 16, 25, 17, 3, 1, 11, 9, 5, 23, 26, 14, 9, 7, 8, 4, 13, 5, 6, 2, 25, 15, 6, 17, 3, 12, 3, 8, 17, 14, 7, 19, 18, 23, 19, 8, 19, 25, 1, 6, 3, 25, 13, 26, 4, 5, 7, 16, 13, 11, 20, 13, 7, 23, 17, 16, 17, 13, 20, 5, 19, 14, 10, 21, 26, 1, 7, 1, 6, 9, 16, 15, 24, 10, 13, 3, 12, 21, 1, 24, 21, 21, 15, 26, 5, 18, 9, 14, 15, 10, 21, 6, 12, 9, 8, 1, 4, 12, 2, 7, 18, 21, 21, 22, 22, 7, 26, 21] 50)," 28 (maxValue [13, 18, 14, 14, 1, 19, 25, 6, 2, 2, 26, 9, 5, 23, 10, 10, 11, 13, 15, 2, 25, 22, 16, 2, 14, 22, 22, 24, 8, 9, 2, 14, 1, 18, 11, 13, 3, 5, 9, 26, 5, 6, 24, 7, 17, 24, 8, 3, 25, 11, 24, 17, 15, 19, 16, 25, 2, 2, 6, 4, 1, 23, 11, 1, 8, 18, 3, 9, 23, 9, 4, 8, 11, 19, 25, 6, 13, 24, 18, 9, 21, 4, 5, 2, 24, 19, 14, 15, 2, 7, 24, 3, 18, 11, 2, 19, 15, 8, 12, 4, 15, 6, 7, 3, 6, 1, 11, 23, 15, 25, 2, 20, 10, 13, 2, 8, 2, 19, 5, 20, 5, 6, 15, 4, 13, 7, 13, 20, 1, 15, 7, 3, 20, 4, 25, 16, 22, 8, 7, 17, 19, 22, 14, 7, 14, 14, 23, 5, 25, 17, 5, 23, 3, 4, 16, 6, 25, 7, 1, 10, 16, 9, 20, 14, 2, 24, 26, 3, 8, 11, 24, 1, 4, 23, 26, 12, 15, 18, 16, 25, 17, 3, 1, 11, 9, 5, 23, 26, 14, 9, 7, 8, 4, 13, 5, 6, 2, 25, 15, 6, 17, 3, 12, 3, 8, 17, 14, 7, 19, 18, 23, 19, 8, 19, 25, 1, 6, 3, 25, 13, 26, 4, 5, 7, 16, 13, 11, 20, 13, 7, 23, 17, 16, 17, 13, 20, 5, 19, 14, 10, 21, 26, 1, 7, 1, 6, 9, 16, 15, 24, 10, 13, 3, 12, 21, 1, 24, 21, 21, 15, 26, 5, 18, 9, 14, 15, 10, 21, 6, 12, 9, 8, 1, 4, 12, 2, 7, 18, 21, 21, 22, 22, 7, 26, 21] 50))
31
+
32
+ test8 :: Test
33
+ test8 = TestCase (assertEqual "for (maxValue [20, 1, 12, 11, 22, 26, 5, 4, 4, 22, 4, 8, 24, 5, 7, 9, 21, 8, 3, 12, 18, 1, 19, 6, 18, 9, 9, 20, 16, 3, 21, 25, 5, 14, 25, 11, 5, 2, 6, 8, 25, 15, 15, 16, 16, 24, 11, 9, 12, 3, 16, 1, 15, 22, 17, 8, 5, 17, 9, 15, 2, 15, 26, 14, 6, 14, 6, 23, 18, 10, 19, 16, 16, 20, 17, 6, 1, 26, 16, 21, 9, 22, 26, 24, 11, 6, 6, 13, 18, 14, 7, 3, 14, 15, 14, 5, 3, 11, 16, 3, 10, 1, 7, 18, 26, 25, 24, 12, 17, 11, 17, 7, 5, 12, 26, 23, 16, 1, 5, 16, 6, 9, 5, 1, 4, 12, 17, 15, 1, 24, 13, 8, 19, 4, 19, 1, 13, 6, 1, 20, 16, 4, 14, 6, 17, 13, 22, 25, 6, 9, 3, 10, 24, 1, 17, 10, 14, 18, 15, 26, 19, 10, 20, 2, 3, 6, 11, 22, 23, 3, 18, 26, 9, 12, 16, 25, 5, 1, 12, 7, 10, 20, 20, 8, 22, 21, 22, 23, 4, 6, 10, 26, 16, 18, 2, 7, 25, 2, 9, 10, 1, 13, 3, 6, 21, 24, 23, 24, 19, 4, 6, 1, 16, 22, 6, 7, 20, 22, 19, 24, 3] 24)," 31 (maxValue [20, 1, 12, 11, 22, 26, 5, 4, 4, 22, 4, 8, 24, 5, 7, 9, 21, 8, 3, 12, 18, 1, 19, 6, 18, 9, 9, 20, 16, 3, 21, 25, 5, 14, 25, 11, 5, 2, 6, 8, 25, 15, 15, 16, 16, 24, 11, 9, 12, 3, 16, 1, 15, 22, 17, 8, 5, 17, 9, 15, 2, 15, 26, 14, 6, 14, 6, 23, 18, 10, 19, 16, 16, 20, 17, 6, 1, 26, 16, 21, 9, 22, 26, 24, 11, 6, 6, 13, 18, 14, 7, 3, 14, 15, 14, 5, 3, 11, 16, 3, 10, 1, 7, 18, 26, 25, 24, 12, 17, 11, 17, 7, 5, 12, 26, 23, 16, 1, 5, 16, 6, 9, 5, 1, 4, 12, 17, 15, 1, 24, 13, 8, 19, 4, 19, 1, 13, 6, 1, 20, 16, 4, 14, 6, 17, 13, 22, 25, 6, 9, 3, 10, 24, 1, 17, 10, 14, 18, 15, 26, 19, 10, 20, 2, 3, 6, 11, 22, 23, 3, 18, 26, 9, 12, 16, 25, 5, 1, 12, 7, 10, 20, 20, 8, 22, 21, 22, 23, 4, 6, 10, 26, 16, 18, 2, 7, 25, 2, 9, 10, 1, 13, 3, 6, 21, 24, 23, 24, 19, 4, 6, 1, 16, 22, 6, 7, 20, 22, 19, 24, 3] 24))
34
+
35
+ test9 :: Test
36
+ test9 = TestCase (assertEqual "for (maxValue [3, 9, 7, 23, 26, 2, 17, 24, 8, 3, 13, 3, 21, 7, 15, 24, 12, 18, 23, 21, 14, 2, 23, 18, 18, 4, 17, 12, 3, 10, 5, 15, 23, 5, 16, 5, 2, 23, 16, 26, 7, 16, 4, 14, 13, 22, 7, 11, 16, 21, 8, 13, 22, 2, 19, 14, 25, 3, 8, 17, 21, 22, 3, 15, 22, 20, 16, 10, 13, 24, 4, 5, 18, 5, 22, 17, 20, 12, 6, 21, 21, 15, 21, 4, 23, 3, 8, 10, 26, 9, 16, 15, 12, 23, 24, 10, 22, 3, 6, 2, 21, 20, 1, 7, 3, 25, 11, 25, 18, 14, 23, 13, 26, 23, 19, 3, 10, 22, 4, 9, 6, 1, 1, 26, 26, 4, 19, 2, 9, 18, 15, 5, 2, 24, 20, 4, 1, 5, 20, 16, 10, 19, 5, 20, 19, 14, 23, 17, 17, 25, 16, 3, 10, 20, 26, 19, 21, 26, 21, 23, 14, 9, 2, 1, 12, 15, 7, 5, 18, 26, 19, 4, 20, 13, 5, 21, 22, 22, 16, 11, 19, 11, 14, 2, 22, 7, 5, 18, 3, 24, 11, 4, 3, 25, 6, 9, 19, 12, 14, 22, 13, 7, 8, 11, 4, 10, 5, 16, 23, 5, 16, 21, 2, 10, 19, 13, 24, 20, 14, 5, 21, 14, 12, 22, 26, 19, 24, 19, 1, 19, 6, 24, 24, 11, 9, 22, 2, 2, 8, 21, 24, 22, 20, 4, 10, 26, 5, 20, 4, 4, 21, 1, 22, 23, 7, 16, 26, 20, 8, 22, 22, 4, 21, 9, 17, 20, 7, 9, 3, 21, 16, 3, 5] 6)," 31 (maxValue [3, 9, 7, 23, 26, 2, 17, 24, 8, 3, 13, 3, 21, 7, 15, 24, 12, 18, 23, 21, 14, 2, 23, 18, 18, 4, 17, 12, 3, 10, 5, 15, 23, 5, 16, 5, 2, 23, 16, 26, 7, 16, 4, 14, 13, 22, 7, 11, 16, 21, 8, 13, 22, 2, 19, 14, 25, 3, 8, 17, 21, 22, 3, 15, 22, 20, 16, 10, 13, 24, 4, 5, 18, 5, 22, 17, 20, 12, 6, 21, 21, 15, 21, 4, 23, 3, 8, 10, 26, 9, 16, 15, 12, 23, 24, 10, 22, 3, 6, 2, 21, 20, 1, 7, 3, 25, 11, 25, 18, 14, 23, 13, 26, 23, 19, 3, 10, 22, 4, 9, 6, 1, 1, 26, 26, 4, 19, 2, 9, 18, 15, 5, 2, 24, 20, 4, 1, 5, 20, 16, 10, 19, 5, 20, 19, 14, 23, 17, 17, 25, 16, 3, 10, 20, 26, 19, 21, 26, 21, 23, 14, 9, 2, 1, 12, 15, 7, 5, 18, 26, 19, 4, 20, 13, 5, 21, 22, 22, 16, 11, 19, 11, 14, 2, 22, 7, 5, 18, 3, 24, 11, 4, 3, 25, 6, 9, 19, 12, 14, 22, 13, 7, 8, 11, 4, 10, 5, 16, 23, 5, 16, 21, 2, 10, 19, 13, 24, 20, 14, 5, 21, 14, 12, 22, 26, 19, 24, 19, 1, 19, 6, 24, 24, 11, 9, 22, 2, 2, 8, 21, 24, 22, 20, 4, 10, 26, 5, 20, 4, 4, 21, 1, 22, 23, 7, 16, 26, 20, 8, 22, 22, 4, 21, 9, 17, 20, 7, 9, 3, 21, 16, 3, 5] 6))
37
+
38
+
39
+ -- Grouping test cases
40
+ tests :: Test
41
+ tests = TestList [TestLabel "Test1" test1, TestLabel "Test2" test2, TestLabel "Test3" test3, TestLabel "Test4" test4, TestLabel "Test5" test5, TestLabel "Test6" test6, TestLabel "Test7" test7, TestLabel "Test8" test8, TestLabel "Test9" test9]
42
+
43
+ -- Running the tests
44
+ main :: IO Counts
45
+ main = runTestTT tests
find_the_maximum_sequence_value_of_array/java_tests/Main.java ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import static org.junit.jupiter.api.Assertions.*;
3
+ import org.junit.jupiter.api.Test;
4
+ import java.util.List;
5
+ import java.util.Arrays;
6
+ import java.util.ArrayList;
7
+ public class Main {
8
+ //Program start
9
+
10
+ //Program end
11
+
12
+ @Test
13
+ public void test1() {
14
+ assertEquals(5, maxValue(new ArrayList<>(Arrays.asList(2,6,7)), 1));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals(2, maxValue(new ArrayList<>(Arrays.asList(4,2,5,6,7)), 2));
19
+ }
20
+
21
+ }
find_the_maximum_sequence_value_of_array/meta.json ADDED
@@ -0,0 +1,2283 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "id": 3575,
3
+ "name": "find_the_maximum_sequence_value_of_array",
4
+ "difficulty": "Hard",
5
+ "link": "https://leetcode.com/problems/find-the-maximum-sequence-value-of-array/",
6
+ "date": "2024-08-31 00:00:00",
7
+ "task_description": "You are given an integer array `nums` and a **positive** integer `k`. The **value** of a sequence `seq` of size `2 * x` is defined as: `(seq[0] OR seq[1] OR ... OR seq[x - 1]) XOR (seq[x] OR seq[x + 1] OR ... OR seq[2 * x - 1])`. Return the **maximum** **value** of any subsequence of `nums` having size `2 * k`. **Example 1:** **Input:** nums = [2,6,7], k = 1 **Output:** 5 **Explanation:** The subsequence `[2, 7]` has the maximum value of `2 XOR 7 = 5`. **Example 2:** **Input:** nums = [4,2,5,6,7], k = 2 **Output:** 2 **Explanation:** The subsequence `[4, 5, 6, 7]` has the maximum value of `(4 OR 5) XOR (6 OR 7) = 2`. **Constraints:** `2 <= nums.length <= 400` `1 <= nums[i] < 27` `1 <= k <= nums.length / 2`",
8
+ "public_test_cases": [
9
+ {
10
+ "label": "Example 1",
11
+ "input": "nums = [2,6,7], k = 1",
12
+ "output": "5 "
13
+ },
14
+ {
15
+ "label": "Example 2",
16
+ "input": "nums = [4,2,5,6,7], k = 2",
17
+ "output": "2 "
18
+ }
19
+ ],
20
+ "private_test_cases": [
21
+ {
22
+ "input": [
23
+ [
24
+ 16,
25
+ 9,
26
+ 22,
27
+ 18,
28
+ 19,
29
+ 10,
30
+ 19,
31
+ 14,
32
+ 13,
33
+ 8,
34
+ 12,
35
+ 3,
36
+ 13,
37
+ 21,
38
+ 15,
39
+ 15,
40
+ 19,
41
+ 20,
42
+ 19,
43
+ 20,
44
+ 23,
45
+ 7,
46
+ 7,
47
+ 2,
48
+ 5,
49
+ 11,
50
+ 25,
51
+ 2,
52
+ 21,
53
+ 1,
54
+ 19,
55
+ 3,
56
+ 20,
57
+ 6,
58
+ 4,
59
+ 12,
60
+ 11,
61
+ 7,
62
+ 14,
63
+ 16,
64
+ 8,
65
+ 6,
66
+ 6,
67
+ 13,
68
+ 22,
69
+ 2,
70
+ 9,
71
+ 1,
72
+ 17,
73
+ 26,
74
+ 19,
75
+ 23,
76
+ 5,
77
+ 12,
78
+ 22,
79
+ 1,
80
+ 9,
81
+ 6,
82
+ 26,
83
+ 6,
84
+ 21,
85
+ 13,
86
+ 5,
87
+ 16,
88
+ 20,
89
+ 4,
90
+ 6,
91
+ 20,
92
+ 13,
93
+ 22,
94
+ 11,
95
+ 12,
96
+ 8,
97
+ 11,
98
+ 22,
99
+ 20,
100
+ 23,
101
+ 8,
102
+ 5,
103
+ 1,
104
+ 23,
105
+ 20,
106
+ 12,
107
+ 2,
108
+ 21,
109
+ 20,
110
+ 3,
111
+ 4,
112
+ 8,
113
+ 1,
114
+ 18,
115
+ 17,
116
+ 21,
117
+ 1,
118
+ 17,
119
+ 14,
120
+ 22,
121
+ 20,
122
+ 23,
123
+ 25,
124
+ 11,
125
+ 23,
126
+ 17,
127
+ 3,
128
+ 24,
129
+ 1,
130
+ 4,
131
+ 21,
132
+ 23,
133
+ 5,
134
+ 17,
135
+ 22,
136
+ 1,
137
+ 17,
138
+ 14,
139
+ 24,
140
+ 26,
141
+ 18,
142
+ 25,
143
+ 12,
144
+ 3,
145
+ 25,
146
+ 11,
147
+ 6,
148
+ 9,
149
+ 26,
150
+ 24,
151
+ 16,
152
+ 5,
153
+ 15,
154
+ 14,
155
+ 19,
156
+ 23,
157
+ 10,
158
+ 25,
159
+ 11,
160
+ 1,
161
+ 5,
162
+ 12,
163
+ 21,
164
+ 2,
165
+ 16,
166
+ 19,
167
+ 22,
168
+ 18,
169
+ 3,
170
+ 22,
171
+ 18,
172
+ 19,
173
+ 7,
174
+ 21,
175
+ 6,
176
+ 2,
177
+ 11,
178
+ 22,
179
+ 14,
180
+ 21,
181
+ 12,
182
+ 24,
183
+ 11,
184
+ 5,
185
+ 12,
186
+ 17,
187
+ 14,
188
+ 15,
189
+ 23,
190
+ 1,
191
+ 9,
192
+ 9,
193
+ 1,
194
+ 7,
195
+ 19,
196
+ 15,
197
+ 10,
198
+ 13,
199
+ 6,
200
+ 22,
201
+ 14,
202
+ 5,
203
+ 9,
204
+ 10,
205
+ 10,
206
+ 13,
207
+ 7,
208
+ 18,
209
+ 20,
210
+ 22,
211
+ 3,
212
+ 17,
213
+ 16,
214
+ 20,
215
+ 12,
216
+ 15,
217
+ 16,
218
+ 17,
219
+ 17,
220
+ 5,
221
+ 1,
222
+ 25,
223
+ 16,
224
+ 14,
225
+ 7,
226
+ 25,
227
+ 24,
228
+ 11,
229
+ 18,
230
+ 15,
231
+ 21,
232
+ 6,
233
+ 20,
234
+ 24,
235
+ 7,
236
+ 10,
237
+ 21,
238
+ 4,
239
+ 6,
240
+ 20,
241
+ 12,
242
+ 8,
243
+ 10,
244
+ 25,
245
+ 3,
246
+ 3,
247
+ 8,
248
+ 5,
249
+ 24,
250
+ 12,
251
+ 10,
252
+ 7,
253
+ 24,
254
+ 25,
255
+ 8,
256
+ 4,
257
+ 1,
258
+ 8,
259
+ 18,
260
+ 15,
261
+ 15,
262
+ 11,
263
+ 26,
264
+ 8,
265
+ 12,
266
+ 24,
267
+ 24,
268
+ 13,
269
+ 15,
270
+ 18,
271
+ 25,
272
+ 17,
273
+ 19
274
+ ],
275
+ 24
276
+ ],
277
+ "output": 31
278
+ },
279
+ {
280
+ "input": [
281
+ [
282
+ 6,
283
+ 12,
284
+ 2,
285
+ 26,
286
+ 20,
287
+ 24,
288
+ 7,
289
+ 14,
290
+ 22,
291
+ 23,
292
+ 25,
293
+ 24,
294
+ 14,
295
+ 6,
296
+ 6,
297
+ 26,
298
+ 21,
299
+ 12,
300
+ 26,
301
+ 13,
302
+ 4,
303
+ 15,
304
+ 16,
305
+ 8,
306
+ 24,
307
+ 8,
308
+ 11,
309
+ 26,
310
+ 10,
311
+ 13,
312
+ 19,
313
+ 12,
314
+ 9,
315
+ 18,
316
+ 7,
317
+ 22,
318
+ 13,
319
+ 25,
320
+ 13,
321
+ 16,
322
+ 14,
323
+ 8,
324
+ 25,
325
+ 9,
326
+ 6,
327
+ 15,
328
+ 20,
329
+ 17,
330
+ 20,
331
+ 18,
332
+ 21,
333
+ 8,
334
+ 5,
335
+ 6,
336
+ 20,
337
+ 20,
338
+ 24,
339
+ 17,
340
+ 23,
341
+ 9,
342
+ 24,
343
+ 26,
344
+ 12,
345
+ 21,
346
+ 23,
347
+ 6,
348
+ 9,
349
+ 18,
350
+ 20,
351
+ 20,
352
+ 24,
353
+ 13,
354
+ 12,
355
+ 1,
356
+ 20,
357
+ 6,
358
+ 20,
359
+ 4,
360
+ 22,
361
+ 10,
362
+ 9,
363
+ 24,
364
+ 13,
365
+ 2,
366
+ 23,
367
+ 22,
368
+ 14,
369
+ 15,
370
+ 18,
371
+ 13,
372
+ 8,
373
+ 7,
374
+ 22,
375
+ 1,
376
+ 7,
377
+ 14,
378
+ 16,
379
+ 22,
380
+ 21,
381
+ 24,
382
+ 17,
383
+ 9,
384
+ 11,
385
+ 12,
386
+ 7,
387
+ 3,
388
+ 17,
389
+ 9,
390
+ 11,
391
+ 5,
392
+ 5,
393
+ 10,
394
+ 19,
395
+ 7,
396
+ 23,
397
+ 2,
398
+ 9,
399
+ 26,
400
+ 15,
401
+ 21,
402
+ 21,
403
+ 2,
404
+ 15,
405
+ 24,
406
+ 13,
407
+ 23,
408
+ 20,
409
+ 3,
410
+ 5,
411
+ 17,
412
+ 19,
413
+ 4,
414
+ 5,
415
+ 2,
416
+ 14,
417
+ 13,
418
+ 25,
419
+ 12,
420
+ 8,
421
+ 8,
422
+ 8,
423
+ 5,
424
+ 23,
425
+ 10,
426
+ 24,
427
+ 9,
428
+ 25,
429
+ 3,
430
+ 20,
431
+ 19,
432
+ 4,
433
+ 17,
434
+ 15,
435
+ 25,
436
+ 8,
437
+ 20,
438
+ 17,
439
+ 18,
440
+ 10,
441
+ 2,
442
+ 21,
443
+ 21,
444
+ 6,
445
+ 15,
446
+ 25,
447
+ 15,
448
+ 20,
449
+ 1,
450
+ 1,
451
+ 12,
452
+ 24,
453
+ 17,
454
+ 18,
455
+ 2,
456
+ 1,
457
+ 20,
458
+ 23,
459
+ 22,
460
+ 1,
461
+ 3,
462
+ 10,
463
+ 17,
464
+ 15,
465
+ 8,
466
+ 11,
467
+ 13,
468
+ 14,
469
+ 4,
470
+ 25,
471
+ 10,
472
+ 8,
473
+ 16,
474
+ 22,
475
+ 21,
476
+ 3,
477
+ 16,
478
+ 12,
479
+ 5,
480
+ 6,
481
+ 25,
482
+ 12,
483
+ 2,
484
+ 18,
485
+ 20,
486
+ 8,
487
+ 26,
488
+ 8,
489
+ 23,
490
+ 11,
491
+ 20,
492
+ 1,
493
+ 25,
494
+ 19,
495
+ 15,
496
+ 5,
497
+ 24,
498
+ 3,
499
+ 7,
500
+ 10,
501
+ 12,
502
+ 2,
503
+ 1,
504
+ 22,
505
+ 3,
506
+ 21,
507
+ 14,
508
+ 7,
509
+ 25,
510
+ 24,
511
+ 12,
512
+ 1,
513
+ 2,
514
+ 24,
515
+ 22,
516
+ 26,
517
+ 3,
518
+ 21,
519
+ 12,
520
+ 15,
521
+ 15,
522
+ 25,
523
+ 2,
524
+ 14,
525
+ 13,
526
+ 5,
527
+ 18,
528
+ 6,
529
+ 12,
530
+ 23,
531
+ 18,
532
+ 4,
533
+ 24,
534
+ 5,
535
+ 19,
536
+ 20,
537
+ 9,
538
+ 19,
539
+ 26,
540
+ 4,
541
+ 6,
542
+ 6,
543
+ 19,
544
+ 1,
545
+ 5,
546
+ 1,
547
+ 1,
548
+ 16,
549
+ 21,
550
+ 20,
551
+ 6,
552
+ 15,
553
+ 4,
554
+ 1,
555
+ 6,
556
+ 9,
557
+ 18,
558
+ 3,
559
+ 24,
560
+ 7,
561
+ 3,
562
+ 17,
563
+ 16,
564
+ 10,
565
+ 23,
566
+ 9,
567
+ 18,
568
+ 11,
569
+ 16,
570
+ 4,
571
+ 12,
572
+ 1,
573
+ 2,
574
+ 14,
575
+ 21,
576
+ 3,
577
+ 19,
578
+ 24,
579
+ 19,
580
+ 11,
581
+ 25,
582
+ 20,
583
+ 23,
584
+ 15,
585
+ 22,
586
+ 24,
587
+ 11,
588
+ 18,
589
+ 10,
590
+ 13,
591
+ 11,
592
+ 12,
593
+ 13,
594
+ 24,
595
+ 6,
596
+ 9,
597
+ 24,
598
+ 11,
599
+ 14,
600
+ 18,
601
+ 13,
602
+ 15,
603
+ 15,
604
+ 6,
605
+ 24,
606
+ 3,
607
+ 6,
608
+ 12,
609
+ 12,
610
+ 26,
611
+ 9,
612
+ 25,
613
+ 2,
614
+ 15,
615
+ 1,
616
+ 14
617
+ ],
618
+ 114
619
+ ],
620
+ "output": 16
621
+ },
622
+ {
623
+ "input": [
624
+ [
625
+ 9,
626
+ 19,
627
+ 5,
628
+ 13,
629
+ 13,
630
+ 8,
631
+ 5,
632
+ 26,
633
+ 7,
634
+ 11,
635
+ 8,
636
+ 3,
637
+ 12,
638
+ 18,
639
+ 19,
640
+ 12,
641
+ 16,
642
+ 9,
643
+ 26,
644
+ 6,
645
+ 20,
646
+ 24,
647
+ 3,
648
+ 11,
649
+ 13,
650
+ 4,
651
+ 2,
652
+ 7,
653
+ 2,
654
+ 6,
655
+ 12,
656
+ 23,
657
+ 16,
658
+ 22,
659
+ 3,
660
+ 17,
661
+ 13,
662
+ 10,
663
+ 19,
664
+ 17,
665
+ 10,
666
+ 10,
667
+ 2,
668
+ 2,
669
+ 24,
670
+ 19,
671
+ 6,
672
+ 10,
673
+ 3,
674
+ 22,
675
+ 17,
676
+ 7,
677
+ 19,
678
+ 25,
679
+ 16,
680
+ 18,
681
+ 6,
682
+ 24,
683
+ 13,
684
+ 13,
685
+ 9,
686
+ 22,
687
+ 9,
688
+ 25,
689
+ 15,
690
+ 1,
691
+ 3,
692
+ 25,
693
+ 6,
694
+ 25,
695
+ 17,
696
+ 26,
697
+ 14,
698
+ 4,
699
+ 17,
700
+ 13,
701
+ 8,
702
+ 4,
703
+ 7,
704
+ 8,
705
+ 23,
706
+ 1,
707
+ 25,
708
+ 14,
709
+ 19,
710
+ 26,
711
+ 12,
712
+ 3,
713
+ 12,
714
+ 16,
715
+ 24,
716
+ 25,
717
+ 11,
718
+ 14,
719
+ 13,
720
+ 12,
721
+ 13,
722
+ 17,
723
+ 25,
724
+ 19,
725
+ 8,
726
+ 12,
727
+ 15,
728
+ 23,
729
+ 26,
730
+ 26,
731
+ 13,
732
+ 9,
733
+ 3,
734
+ 4,
735
+ 6,
736
+ 7,
737
+ 10,
738
+ 17,
739
+ 1,
740
+ 7,
741
+ 24,
742
+ 13,
743
+ 3,
744
+ 4,
745
+ 18,
746
+ 9,
747
+ 17,
748
+ 15,
749
+ 4,
750
+ 24,
751
+ 1,
752
+ 24,
753
+ 8,
754
+ 14,
755
+ 13,
756
+ 2,
757
+ 25,
758
+ 2,
759
+ 7,
760
+ 21,
761
+ 23,
762
+ 22,
763
+ 25,
764
+ 10,
765
+ 2,
766
+ 9,
767
+ 3,
768
+ 7,
769
+ 13,
770
+ 9,
771
+ 5,
772
+ 15,
773
+ 15,
774
+ 20,
775
+ 20,
776
+ 12,
777
+ 25,
778
+ 2,
779
+ 17,
780
+ 9,
781
+ 26,
782
+ 14,
783
+ 20,
784
+ 12,
785
+ 2,
786
+ 23,
787
+ 6,
788
+ 11,
789
+ 20,
790
+ 10,
791
+ 17,
792
+ 1,
793
+ 20,
794
+ 12,
795
+ 16,
796
+ 17,
797
+ 4,
798
+ 3,
799
+ 14,
800
+ 12,
801
+ 8,
802
+ 25,
803
+ 15,
804
+ 15,
805
+ 16,
806
+ 6,
807
+ 10,
808
+ 12,
809
+ 21,
810
+ 9,
811
+ 6,
812
+ 13,
813
+ 18,
814
+ 26,
815
+ 9,
816
+ 15,
817
+ 5,
818
+ 17,
819
+ 6,
820
+ 9,
821
+ 23,
822
+ 20,
823
+ 11,
824
+ 16,
825
+ 24,
826
+ 16,
827
+ 24,
828
+ 16,
829
+ 7,
830
+ 4,
831
+ 4,
832
+ 11,
833
+ 15,
834
+ 22,
835
+ 3,
836
+ 7,
837
+ 9,
838
+ 12,
839
+ 24,
840
+ 8,
841
+ 20,
842
+ 24,
843
+ 26,
844
+ 13,
845
+ 13,
846
+ 19,
847
+ 3,
848
+ 17,
849
+ 19,
850
+ 9,
851
+ 8,
852
+ 19,
853
+ 1,
854
+ 10,
855
+ 19,
856
+ 1,
857
+ 2,
858
+ 20,
859
+ 12,
860
+ 16,
861
+ 7,
862
+ 24,
863
+ 7,
864
+ 24,
865
+ 2,
866
+ 23,
867
+ 14,
868
+ 9,
869
+ 2,
870
+ 19,
871
+ 25,
872
+ 11,
873
+ 2,
874
+ 3,
875
+ 12,
876
+ 6,
877
+ 19,
878
+ 15,
879
+ 15,
880
+ 9,
881
+ 7,
882
+ 12,
883
+ 3,
884
+ 24,
885
+ 6,
886
+ 7,
887
+ 17,
888
+ 17,
889
+ 26,
890
+ 13,
891
+ 12,
892
+ 14,
893
+ 22,
894
+ 21,
895
+ 4,
896
+ 9,
897
+ 25,
898
+ 8,
899
+ 9,
900
+ 11,
901
+ 10,
902
+ 23,
903
+ 19,
904
+ 7,
905
+ 3,
906
+ 26,
907
+ 13,
908
+ 18,
909
+ 23,
910
+ 12,
911
+ 21,
912
+ 25,
913
+ 25,
914
+ 16,
915
+ 19,
916
+ 12,
917
+ 18,
918
+ 15,
919
+ 15,
920
+ 10,
921
+ 22,
922
+ 6,
923
+ 12,
924
+ 4,
925
+ 25,
926
+ 2,
927
+ 21,
928
+ 22,
929
+ 5,
930
+ 12,
931
+ 3,
932
+ 15,
933
+ 9,
934
+ 11,
935
+ 19,
936
+ 8,
937
+ 20,
938
+ 11,
939
+ 14,
940
+ 12,
941
+ 23,
942
+ 1,
943
+ 20,
944
+ 10,
945
+ 2,
946
+ 6,
947
+ 15,
948
+ 23,
949
+ 2,
950
+ 9,
951
+ 16,
952
+ 15,
953
+ 21,
954
+ 24,
955
+ 20,
956
+ 21,
957
+ 25,
958
+ 13,
959
+ 24,
960
+ 18,
961
+ 10,
962
+ 16,
963
+ 25,
964
+ 23,
965
+ 13,
966
+ 23,
967
+ 25,
968
+ 7,
969
+ 26,
970
+ 15,
971
+ 16,
972
+ 16,
973
+ 16,
974
+ 24,
975
+ 22,
976
+ 4,
977
+ 3,
978
+ 3,
979
+ 7,
980
+ 21,
981
+ 2,
982
+ 1,
983
+ 9,
984
+ 9,
985
+ 10,
986
+ 13,
987
+ 20,
988
+ 18,
989
+ 24,
990
+ 17,
991
+ 23,
992
+ 7
993
+ ],
994
+ 29
995
+ ],
996
+ "output": 31
997
+ },
998
+ {
999
+ "input": [
1000
+ [
1001
+ 17,
1002
+ 9,
1003
+ 22,
1004
+ 3,
1005
+ 1,
1006
+ 5,
1007
+ 7,
1008
+ 5,
1009
+ 17,
1010
+ 6,
1011
+ 23,
1012
+ 16,
1013
+ 20,
1014
+ 11,
1015
+ 4,
1016
+ 9,
1017
+ 14,
1018
+ 16,
1019
+ 10,
1020
+ 20,
1021
+ 8,
1022
+ 4,
1023
+ 14,
1024
+ 4,
1025
+ 19,
1026
+ 9,
1027
+ 7,
1028
+ 5,
1029
+ 10,
1030
+ 20,
1031
+ 6,
1032
+ 1,
1033
+ 23,
1034
+ 4,
1035
+ 12,
1036
+ 17,
1037
+ 11,
1038
+ 20,
1039
+ 17,
1040
+ 9,
1041
+ 10,
1042
+ 4,
1043
+ 25,
1044
+ 16,
1045
+ 2,
1046
+ 17,
1047
+ 1,
1048
+ 19,
1049
+ 23,
1050
+ 21,
1051
+ 6,
1052
+ 14,
1053
+ 19,
1054
+ 23,
1055
+ 11,
1056
+ 24,
1057
+ 22,
1058
+ 7,
1059
+ 7,
1060
+ 13,
1061
+ 26,
1062
+ 12,
1063
+ 25,
1064
+ 15,
1065
+ 12,
1066
+ 26,
1067
+ 11,
1068
+ 13,
1069
+ 20,
1070
+ 1,
1071
+ 15,
1072
+ 10,
1073
+ 26,
1074
+ 21,
1075
+ 14,
1076
+ 18,
1077
+ 16,
1078
+ 15,
1079
+ 4,
1080
+ 21,
1081
+ 16,
1082
+ 17,
1083
+ 4,
1084
+ 18,
1085
+ 19,
1086
+ 20,
1087
+ 7,
1088
+ 22,
1089
+ 18,
1090
+ 1,
1091
+ 13,
1092
+ 9,
1093
+ 3,
1094
+ 5,
1095
+ 16,
1096
+ 8,
1097
+ 5,
1098
+ 26,
1099
+ 24,
1100
+ 12,
1101
+ 1,
1102
+ 15,
1103
+ 12,
1104
+ 4,
1105
+ 8,
1106
+ 16,
1107
+ 25,
1108
+ 17,
1109
+ 25,
1110
+ 11,
1111
+ 14,
1112
+ 21,
1113
+ 13,
1114
+ 5,
1115
+ 25,
1116
+ 24,
1117
+ 22,
1118
+ 21,
1119
+ 18,
1120
+ 13,
1121
+ 15,
1122
+ 12,
1123
+ 14,
1124
+ 19
1125
+ ],
1126
+ 37
1127
+ ],
1128
+ "output": 24
1129
+ },
1130
+ {
1131
+ "input": [
1132
+ [
1133
+ 13,
1134
+ 18,
1135
+ 14,
1136
+ 14,
1137
+ 1,
1138
+ 19,
1139
+ 25,
1140
+ 6,
1141
+ 2,
1142
+ 2,
1143
+ 26,
1144
+ 9,
1145
+ 5,
1146
+ 23,
1147
+ 10,
1148
+ 10,
1149
+ 11,
1150
+ 13,
1151
+ 15,
1152
+ 2,
1153
+ 25,
1154
+ 22,
1155
+ 16,
1156
+ 2,
1157
+ 14,
1158
+ 22,
1159
+ 22,
1160
+ 24,
1161
+ 8,
1162
+ 9,
1163
+ 2,
1164
+ 14,
1165
+ 1,
1166
+ 18,
1167
+ 11,
1168
+ 13,
1169
+ 3,
1170
+ 5,
1171
+ 9,
1172
+ 26,
1173
+ 5,
1174
+ 6,
1175
+ 24,
1176
+ 7,
1177
+ 17,
1178
+ 24,
1179
+ 8,
1180
+ 3,
1181
+ 25,
1182
+ 11,
1183
+ 24,
1184
+ 17,
1185
+ 15,
1186
+ 19,
1187
+ 16,
1188
+ 25,
1189
+ 2,
1190
+ 2,
1191
+ 6,
1192
+ 4,
1193
+ 1,
1194
+ 23,
1195
+ 11,
1196
+ 1,
1197
+ 8,
1198
+ 18,
1199
+ 3,
1200
+ 9,
1201
+ 23,
1202
+ 9,
1203
+ 4,
1204
+ 8,
1205
+ 11,
1206
+ 19,
1207
+ 25,
1208
+ 6,
1209
+ 13,
1210
+ 24,
1211
+ 18,
1212
+ 9,
1213
+ 21,
1214
+ 4,
1215
+ 5,
1216
+ 2,
1217
+ 24,
1218
+ 19,
1219
+ 14,
1220
+ 15,
1221
+ 2,
1222
+ 7,
1223
+ 24,
1224
+ 3,
1225
+ 18,
1226
+ 11,
1227
+ 2,
1228
+ 19,
1229
+ 15,
1230
+ 8,
1231
+ 12,
1232
+ 4,
1233
+ 15,
1234
+ 6,
1235
+ 7,
1236
+ 3,
1237
+ 6,
1238
+ 1,
1239
+ 11,
1240
+ 23,
1241
+ 15,
1242
+ 25,
1243
+ 2,
1244
+ 20,
1245
+ 10,
1246
+ 13,
1247
+ 2,
1248
+ 8,
1249
+ 2,
1250
+ 19,
1251
+ 5,
1252
+ 20,
1253
+ 5,
1254
+ 6,
1255
+ 15,
1256
+ 4,
1257
+ 13,
1258
+ 7,
1259
+ 13,
1260
+ 20,
1261
+ 1,
1262
+ 15,
1263
+ 7,
1264
+ 3,
1265
+ 20,
1266
+ 4,
1267
+ 25,
1268
+ 16,
1269
+ 22,
1270
+ 8,
1271
+ 7,
1272
+ 17,
1273
+ 19,
1274
+ 22,
1275
+ 14,
1276
+ 7,
1277
+ 14,
1278
+ 14,
1279
+ 23,
1280
+ 5,
1281
+ 25,
1282
+ 17,
1283
+ 5,
1284
+ 23,
1285
+ 3,
1286
+ 4,
1287
+ 16,
1288
+ 6,
1289
+ 25,
1290
+ 7,
1291
+ 1,
1292
+ 10,
1293
+ 16,
1294
+ 9,
1295
+ 20,
1296
+ 14,
1297
+ 2,
1298
+ 24,
1299
+ 26,
1300
+ 3,
1301
+ 8,
1302
+ 11,
1303
+ 24,
1304
+ 1,
1305
+ 4,
1306
+ 23,
1307
+ 26,
1308
+ 12,
1309
+ 15,
1310
+ 18,
1311
+ 16,
1312
+ 25,
1313
+ 17,
1314
+ 3,
1315
+ 1,
1316
+ 11,
1317
+ 9,
1318
+ 5,
1319
+ 23,
1320
+ 26,
1321
+ 14,
1322
+ 9,
1323
+ 7,
1324
+ 8,
1325
+ 4,
1326
+ 13,
1327
+ 5,
1328
+ 6,
1329
+ 2,
1330
+ 25,
1331
+ 15,
1332
+ 6,
1333
+ 17,
1334
+ 3,
1335
+ 12,
1336
+ 3,
1337
+ 8,
1338
+ 17,
1339
+ 14,
1340
+ 7,
1341
+ 19,
1342
+ 18,
1343
+ 23,
1344
+ 19,
1345
+ 8,
1346
+ 19,
1347
+ 25,
1348
+ 1,
1349
+ 6,
1350
+ 3,
1351
+ 25,
1352
+ 13,
1353
+ 26,
1354
+ 4,
1355
+ 5,
1356
+ 7,
1357
+ 16,
1358
+ 13,
1359
+ 11,
1360
+ 20,
1361
+ 13,
1362
+ 7,
1363
+ 23,
1364
+ 17,
1365
+ 16,
1366
+ 17,
1367
+ 13,
1368
+ 20,
1369
+ 5,
1370
+ 19,
1371
+ 14,
1372
+ 10,
1373
+ 21,
1374
+ 26,
1375
+ 1,
1376
+ 7,
1377
+ 1,
1378
+ 6,
1379
+ 9,
1380
+ 16,
1381
+ 15,
1382
+ 24,
1383
+ 10,
1384
+ 13,
1385
+ 3,
1386
+ 12,
1387
+ 21,
1388
+ 1,
1389
+ 24,
1390
+ 21,
1391
+ 21,
1392
+ 15,
1393
+ 26,
1394
+ 5,
1395
+ 18,
1396
+ 9,
1397
+ 14,
1398
+ 15,
1399
+ 10,
1400
+ 21,
1401
+ 6,
1402
+ 12,
1403
+ 9,
1404
+ 8,
1405
+ 1,
1406
+ 4,
1407
+ 12,
1408
+ 2,
1409
+ 7,
1410
+ 18,
1411
+ 21,
1412
+ 21,
1413
+ 22,
1414
+ 22,
1415
+ 7,
1416
+ 26,
1417
+ 21
1418
+ ],
1419
+ 50
1420
+ ],
1421
+ "output": 28
1422
+ },
1423
+ {
1424
+ "input": [
1425
+ [
1426
+ 20,
1427
+ 1,
1428
+ 12,
1429
+ 11,
1430
+ 22,
1431
+ 26,
1432
+ 5,
1433
+ 4,
1434
+ 4,
1435
+ 22,
1436
+ 4,
1437
+ 8,
1438
+ 24,
1439
+ 5,
1440
+ 7,
1441
+ 9,
1442
+ 21,
1443
+ 8,
1444
+ 3,
1445
+ 12,
1446
+ 18,
1447
+ 1,
1448
+ 19,
1449
+ 6,
1450
+ 18,
1451
+ 9,
1452
+ 9,
1453
+ 20,
1454
+ 16,
1455
+ 3,
1456
+ 21,
1457
+ 25,
1458
+ 5,
1459
+ 14,
1460
+ 25,
1461
+ 11,
1462
+ 5,
1463
+ 2,
1464
+ 6,
1465
+ 8,
1466
+ 25,
1467
+ 15,
1468
+ 15,
1469
+ 16,
1470
+ 16,
1471
+ 24,
1472
+ 11,
1473
+ 9,
1474
+ 12,
1475
+ 3,
1476
+ 16,
1477
+ 1,
1478
+ 15,
1479
+ 22,
1480
+ 17,
1481
+ 8,
1482
+ 5,
1483
+ 17,
1484
+ 9,
1485
+ 15,
1486
+ 2,
1487
+ 15,
1488
+ 26,
1489
+ 14,
1490
+ 6,
1491
+ 14,
1492
+ 6,
1493
+ 23,
1494
+ 18,
1495
+ 10,
1496
+ 19,
1497
+ 16,
1498
+ 16,
1499
+ 20,
1500
+ 17,
1501
+ 6,
1502
+ 1,
1503
+ 26,
1504
+ 16,
1505
+ 21,
1506
+ 9,
1507
+ 22,
1508
+ 26,
1509
+ 24,
1510
+ 11,
1511
+ 6,
1512
+ 6,
1513
+ 13,
1514
+ 18,
1515
+ 14,
1516
+ 7,
1517
+ 3,
1518
+ 14,
1519
+ 15,
1520
+ 14,
1521
+ 5,
1522
+ 3,
1523
+ 11,
1524
+ 16,
1525
+ 3,
1526
+ 10,
1527
+ 1,
1528
+ 7,
1529
+ 18,
1530
+ 26,
1531
+ 25,
1532
+ 24,
1533
+ 12,
1534
+ 17,
1535
+ 11,
1536
+ 17,
1537
+ 7,
1538
+ 5,
1539
+ 12,
1540
+ 26,
1541
+ 23,
1542
+ 16,
1543
+ 1,
1544
+ 5,
1545
+ 16,
1546
+ 6,
1547
+ 9,
1548
+ 5,
1549
+ 1,
1550
+ 4,
1551
+ 12,
1552
+ 17,
1553
+ 15,
1554
+ 1,
1555
+ 24,
1556
+ 13,
1557
+ 8,
1558
+ 19,
1559
+ 4,
1560
+ 19,
1561
+ 1,
1562
+ 13,
1563
+ 6,
1564
+ 1,
1565
+ 20,
1566
+ 16,
1567
+ 4,
1568
+ 14,
1569
+ 6,
1570
+ 17,
1571
+ 13,
1572
+ 22,
1573
+ 25,
1574
+ 6,
1575
+ 9,
1576
+ 3,
1577
+ 10,
1578
+ 24,
1579
+ 1,
1580
+ 17,
1581
+ 10,
1582
+ 14,
1583
+ 18,
1584
+ 15,
1585
+ 26,
1586
+ 19,
1587
+ 10,
1588
+ 20,
1589
+ 2,
1590
+ 3,
1591
+ 6,
1592
+ 11,
1593
+ 22,
1594
+ 23,
1595
+ 3,
1596
+ 18,
1597
+ 26,
1598
+ 9,
1599
+ 12,
1600
+ 16,
1601
+ 25,
1602
+ 5,
1603
+ 1,
1604
+ 12,
1605
+ 7,
1606
+ 10,
1607
+ 20,
1608
+ 20,
1609
+ 8,
1610
+ 22,
1611
+ 21,
1612
+ 22,
1613
+ 23,
1614
+ 4,
1615
+ 6,
1616
+ 10,
1617
+ 26,
1618
+ 16,
1619
+ 18,
1620
+ 2,
1621
+ 7,
1622
+ 25,
1623
+ 2,
1624
+ 9,
1625
+ 10,
1626
+ 1,
1627
+ 13,
1628
+ 3,
1629
+ 6,
1630
+ 21,
1631
+ 24,
1632
+ 23,
1633
+ 24,
1634
+ 19,
1635
+ 4,
1636
+ 6,
1637
+ 1,
1638
+ 16,
1639
+ 22,
1640
+ 6,
1641
+ 7,
1642
+ 20,
1643
+ 22,
1644
+ 19,
1645
+ 24,
1646
+ 3
1647
+ ],
1648
+ 24
1649
+ ],
1650
+ "output": 31
1651
+ },
1652
+ {
1653
+ "input": [
1654
+ [
1655
+ 3,
1656
+ 9,
1657
+ 7,
1658
+ 23,
1659
+ 26,
1660
+ 2,
1661
+ 17,
1662
+ 24,
1663
+ 8,
1664
+ 3,
1665
+ 13,
1666
+ 3,
1667
+ 21,
1668
+ 7,
1669
+ 15,
1670
+ 24,
1671
+ 12,
1672
+ 18,
1673
+ 23,
1674
+ 21,
1675
+ 14,
1676
+ 2,
1677
+ 23,
1678
+ 18,
1679
+ 18,
1680
+ 4,
1681
+ 17,
1682
+ 12,
1683
+ 3,
1684
+ 10,
1685
+ 5,
1686
+ 15,
1687
+ 23,
1688
+ 5,
1689
+ 16,
1690
+ 5,
1691
+ 2,
1692
+ 23,
1693
+ 16,
1694
+ 26,
1695
+ 7,
1696
+ 16,
1697
+ 4,
1698
+ 14,
1699
+ 13,
1700
+ 22,
1701
+ 7,
1702
+ 11,
1703
+ 16,
1704
+ 21,
1705
+ 8,
1706
+ 13,
1707
+ 22,
1708
+ 2,
1709
+ 19,
1710
+ 14,
1711
+ 25,
1712
+ 3,
1713
+ 8,
1714
+ 17,
1715
+ 21,
1716
+ 22,
1717
+ 3,
1718
+ 15,
1719
+ 22,
1720
+ 20,
1721
+ 16,
1722
+ 10,
1723
+ 13,
1724
+ 24,
1725
+ 4,
1726
+ 5,
1727
+ 18,
1728
+ 5,
1729
+ 22,
1730
+ 17,
1731
+ 20,
1732
+ 12,
1733
+ 6,
1734
+ 21,
1735
+ 21,
1736
+ 15,
1737
+ 21,
1738
+ 4,
1739
+ 23,
1740
+ 3,
1741
+ 8,
1742
+ 10,
1743
+ 26,
1744
+ 9,
1745
+ 16,
1746
+ 15,
1747
+ 12,
1748
+ 23,
1749
+ 24,
1750
+ 10,
1751
+ 22,
1752
+ 3,
1753
+ 6,
1754
+ 2,
1755
+ 21,
1756
+ 20,
1757
+ 1,
1758
+ 7,
1759
+ 3,
1760
+ 25,
1761
+ 11,
1762
+ 25,
1763
+ 18,
1764
+ 14,
1765
+ 23,
1766
+ 13,
1767
+ 26,
1768
+ 23,
1769
+ 19,
1770
+ 3,
1771
+ 10,
1772
+ 22,
1773
+ 4,
1774
+ 9,
1775
+ 6,
1776
+ 1,
1777
+ 1,
1778
+ 26,
1779
+ 26,
1780
+ 4,
1781
+ 19,
1782
+ 2,
1783
+ 9,
1784
+ 18,
1785
+ 15,
1786
+ 5,
1787
+ 2,
1788
+ 24,
1789
+ 20,
1790
+ 4,
1791
+ 1,
1792
+ 5,
1793
+ 20,
1794
+ 16,
1795
+ 10,
1796
+ 19,
1797
+ 5,
1798
+ 20,
1799
+ 19,
1800
+ 14,
1801
+ 23,
1802
+ 17,
1803
+ 17,
1804
+ 25,
1805
+ 16,
1806
+ 3,
1807
+ 10,
1808
+ 20,
1809
+ 26,
1810
+ 19,
1811
+ 21,
1812
+ 26,
1813
+ 21,
1814
+ 23,
1815
+ 14,
1816
+ 9,
1817
+ 2,
1818
+ 1,
1819
+ 12,
1820
+ 15,
1821
+ 7,
1822
+ 5,
1823
+ 18,
1824
+ 26,
1825
+ 19,
1826
+ 4,
1827
+ 20,
1828
+ 13,
1829
+ 5,
1830
+ 21,
1831
+ 22,
1832
+ 22,
1833
+ 16,
1834
+ 11,
1835
+ 19,
1836
+ 11,
1837
+ 14,
1838
+ 2,
1839
+ 22,
1840
+ 7,
1841
+ 5,
1842
+ 18,
1843
+ 3,
1844
+ 24,
1845
+ 11,
1846
+ 4,
1847
+ 3,
1848
+ 25,
1849
+ 6,
1850
+ 9,
1851
+ 19,
1852
+ 12,
1853
+ 14,
1854
+ 22,
1855
+ 13,
1856
+ 7,
1857
+ 8,
1858
+ 11,
1859
+ 4,
1860
+ 10,
1861
+ 5,
1862
+ 16,
1863
+ 23,
1864
+ 5,
1865
+ 16,
1866
+ 21,
1867
+ 2,
1868
+ 10,
1869
+ 19,
1870
+ 13,
1871
+ 24,
1872
+ 20,
1873
+ 14,
1874
+ 5,
1875
+ 21,
1876
+ 14,
1877
+ 12,
1878
+ 22,
1879
+ 26,
1880
+ 19,
1881
+ 24,
1882
+ 19,
1883
+ 1,
1884
+ 19,
1885
+ 6,
1886
+ 24,
1887
+ 24,
1888
+ 11,
1889
+ 9,
1890
+ 22,
1891
+ 2,
1892
+ 2,
1893
+ 8,
1894
+ 21,
1895
+ 24,
1896
+ 22,
1897
+ 20,
1898
+ 4,
1899
+ 10,
1900
+ 26,
1901
+ 5,
1902
+ 20,
1903
+ 4,
1904
+ 4,
1905
+ 21,
1906
+ 1,
1907
+ 22,
1908
+ 23,
1909
+ 7,
1910
+ 16,
1911
+ 26,
1912
+ 20,
1913
+ 8,
1914
+ 22,
1915
+ 22,
1916
+ 4,
1917
+ 21,
1918
+ 9,
1919
+ 17,
1920
+ 20,
1921
+ 7,
1922
+ 9,
1923
+ 3,
1924
+ 21,
1925
+ 16,
1926
+ 3,
1927
+ 5
1928
+ ],
1929
+ 6
1930
+ ],
1931
+ "output": 31
1932
+ },
1933
+ {
1934
+ "input": [
1935
+ [
1936
+ 23,
1937
+ 19,
1938
+ 3,
1939
+ 16,
1940
+ 2,
1941
+ 10,
1942
+ 20,
1943
+ 14,
1944
+ 5,
1945
+ 5,
1946
+ 3,
1947
+ 21,
1948
+ 4,
1949
+ 23,
1950
+ 10,
1951
+ 15,
1952
+ 5,
1953
+ 22,
1954
+ 10,
1955
+ 23,
1956
+ 8,
1957
+ 10,
1958
+ 23,
1959
+ 6,
1960
+ 15,
1961
+ 20,
1962
+ 8,
1963
+ 19,
1964
+ 2,
1965
+ 10,
1966
+ 16,
1967
+ 21,
1968
+ 21,
1969
+ 14,
1970
+ 1,
1971
+ 6,
1972
+ 13,
1973
+ 17,
1974
+ 3,
1975
+ 16,
1976
+ 20,
1977
+ 5,
1978
+ 10,
1979
+ 1,
1980
+ 15,
1981
+ 10,
1982
+ 8,
1983
+ 23,
1984
+ 7,
1985
+ 2,
1986
+ 25,
1987
+ 24,
1988
+ 7,
1989
+ 9,
1990
+ 7,
1991
+ 23,
1992
+ 21,
1993
+ 10,
1994
+ 20,
1995
+ 18,
1996
+ 25,
1997
+ 5,
1998
+ 7,
1999
+ 5,
2000
+ 4,
2001
+ 14,
2002
+ 18,
2003
+ 19,
2004
+ 22,
2005
+ 17,
2006
+ 25,
2007
+ 12,
2008
+ 4,
2009
+ 7,
2010
+ 4,
2011
+ 5,
2012
+ 6,
2013
+ 10,
2014
+ 13,
2015
+ 9,
2016
+ 23,
2017
+ 15,
2018
+ 23,
2019
+ 7,
2020
+ 26,
2021
+ 11,
2022
+ 19,
2023
+ 16,
2024
+ 20,
2025
+ 18,
2026
+ 18,
2027
+ 12,
2028
+ 18,
2029
+ 19,
2030
+ 4,
2031
+ 2,
2032
+ 17,
2033
+ 21,
2034
+ 2,
2035
+ 19,
2036
+ 19,
2037
+ 21,
2038
+ 1,
2039
+ 16,
2040
+ 7,
2041
+ 18,
2042
+ 24,
2043
+ 16,
2044
+ 24,
2045
+ 9,
2046
+ 1,
2047
+ 10,
2048
+ 15,
2049
+ 12,
2050
+ 20,
2051
+ 15,
2052
+ 8,
2053
+ 15,
2054
+ 13,
2055
+ 26,
2056
+ 16,
2057
+ 7
2058
+ ],
2059
+ 59
2060
+ ],
2061
+ "output": 0
2062
+ },
2063
+ {
2064
+ "input": [
2065
+ [
2066
+ 20,
2067
+ 6,
2068
+ 22,
2069
+ 25,
2070
+ 4,
2071
+ 26,
2072
+ 20,
2073
+ 6,
2074
+ 19,
2075
+ 16,
2076
+ 20,
2077
+ 18,
2078
+ 20,
2079
+ 14,
2080
+ 5,
2081
+ 25,
2082
+ 22,
2083
+ 19,
2084
+ 1,
2085
+ 20,
2086
+ 21,
2087
+ 25,
2088
+ 14,
2089
+ 17,
2090
+ 1,
2091
+ 5,
2092
+ 21,
2093
+ 4,
2094
+ 21,
2095
+ 5,
2096
+ 10,
2097
+ 19,
2098
+ 10,
2099
+ 17,
2100
+ 26,
2101
+ 7,
2102
+ 1,
2103
+ 21,
2104
+ 9,
2105
+ 18,
2106
+ 23,
2107
+ 1,
2108
+ 7,
2109
+ 3,
2110
+ 6,
2111
+ 25,
2112
+ 21,
2113
+ 2,
2114
+ 18,
2115
+ 12,
2116
+ 11,
2117
+ 16,
2118
+ 22,
2119
+ 16,
2120
+ 26,
2121
+ 25,
2122
+ 8,
2123
+ 22,
2124
+ 2,
2125
+ 26,
2126
+ 17,
2127
+ 20,
2128
+ 17,
2129
+ 4,
2130
+ 9,
2131
+ 26,
2132
+ 13,
2133
+ 14,
2134
+ 7,
2135
+ 10,
2136
+ 14,
2137
+ 3,
2138
+ 13,
2139
+ 22,
2140
+ 26,
2141
+ 10,
2142
+ 4,
2143
+ 15,
2144
+ 21,
2145
+ 16,
2146
+ 2,
2147
+ 24,
2148
+ 3,
2149
+ 19,
2150
+ 14,
2151
+ 1,
2152
+ 3,
2153
+ 26,
2154
+ 5,
2155
+ 2,
2156
+ 8,
2157
+ 2,
2158
+ 15,
2159
+ 3,
2160
+ 24,
2161
+ 20,
2162
+ 17,
2163
+ 22,
2164
+ 15,
2165
+ 2,
2166
+ 17,
2167
+ 26,
2168
+ 22,
2169
+ 5,
2170
+ 3,
2171
+ 16,
2172
+ 19,
2173
+ 7,
2174
+ 13,
2175
+ 2,
2176
+ 17,
2177
+ 3,
2178
+ 3,
2179
+ 18,
2180
+ 5,
2181
+ 19,
2182
+ 21,
2183
+ 21,
2184
+ 16,
2185
+ 6,
2186
+ 5,
2187
+ 16,
2188
+ 19,
2189
+ 18,
2190
+ 10,
2191
+ 11,
2192
+ 22,
2193
+ 10,
2194
+ 17,
2195
+ 12,
2196
+ 25,
2197
+ 25,
2198
+ 6,
2199
+ 12,
2200
+ 1,
2201
+ 25,
2202
+ 19,
2203
+ 5,
2204
+ 5,
2205
+ 11,
2206
+ 3,
2207
+ 9,
2208
+ 9,
2209
+ 13,
2210
+ 7,
2211
+ 24,
2212
+ 21,
2213
+ 15,
2214
+ 24,
2215
+ 22,
2216
+ 16,
2217
+ 20,
2218
+ 17,
2219
+ 19,
2220
+ 7,
2221
+ 5,
2222
+ 2,
2223
+ 17,
2224
+ 11,
2225
+ 19,
2226
+ 14,
2227
+ 18,
2228
+ 13,
2229
+ 7,
2230
+ 5,
2231
+ 10,
2232
+ 10,
2233
+ 6,
2234
+ 17,
2235
+ 24,
2236
+ 24,
2237
+ 6,
2238
+ 8,
2239
+ 12,
2240
+ 17,
2241
+ 5,
2242
+ 17,
2243
+ 10,
2244
+ 19,
2245
+ 23,
2246
+ 24,
2247
+ 13,
2248
+ 5,
2249
+ 25,
2250
+ 19,
2251
+ 24,
2252
+ 14,
2253
+ 12,
2254
+ 6,
2255
+ 26,
2256
+ 6,
2257
+ 18,
2258
+ 17,
2259
+ 24
2260
+ ],
2261
+ 66
2262
+ ],
2263
+ "output": 16
2264
+ },
2265
+ {
2266
+ "input": [
2267
+ [
2268
+ 18,
2269
+ 20,
2270
+ 3,
2271
+ 13
2272
+ ],
2273
+ 2
2274
+ ],
2275
+ "output": 25
2276
+ }
2277
+ ],
2278
+ "haskell_template": "maxValue :: [Int] -> Int -> Int\nmaxValue nums k ",
2279
+ "ocaml_template": "let maxValue (nums: int list) (k: int) : int = ",
2280
+ "scala_template": "def maxValue(nums: List[Int],k: Int): Int = { \n \n}",
2281
+ "java_template": "class Solution {\n public int maxValue(int[] nums, int k) {\n \n }\n}",
2282
+ "python_template": "class Solution(object):\n def maxValue(self, nums, k):\n \"\"\"\n :type nums: List[int]\n :type k: int\n :rtype: int\n \"\"\"\n "
2283
+ }
find_the_maximum_sequence_value_of_array/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 5 (maxValue [2;6;7] 1)
12
+
13
+ let test2 _ = assert_equal 2 (maxValue [4;2;5;6;7] 2)
14
+
15
+ let test3 _ = assert_equal 31 (maxValue [16; 9; 22; 18; 19; 10; 19; 14; 13; 8; 12; 3; 13; 21; 15; 15; 19; 20; 19; 20; 23; 7; 7; 2; 5; 11; 25; 2; 21; 1; 19; 3; 20; 6; 4; 12; 11; 7; 14; 16; 8; 6; 6; 13; 22; 2; 9; 1; 17; 26; 19; 23; 5; 12; 22; 1; 9; 6; 26; 6; 21; 13; 5; 16; 20; 4; 6; 20; 13; 22; 11; 12; 8; 11; 22; 20; 23; 8; 5; 1; 23; 20; 12; 2; 21; 20; 3; 4; 8; 1; 18; 17; 21; 1; 17; 14; 22; 20; 23; 25; 11; 23; 17; 3; 24; 1; 4; 21; 23; 5; 17; 22; 1; 17; 14; 24; 26; 18; 25; 12; 3; 25; 11; 6; 9; 26; 24; 16; 5; 15; 14; 19; 23; 10; 25; 11; 1; 5; 12; 21; 2; 16; 19; 22; 18; 3; 22; 18; 19; 7; 21; 6; 2; 11; 22; 14; 21; 12; 24; 11; 5; 12; 17; 14; 15; 23; 1; 9; 9; 1; 7; 19; 15; 10; 13; 6; 22; 14; 5; 9; 10; 10; 13; 7; 18; 20; 22; 3; 17; 16; 20; 12; 15; 16; 17; 17; 5; 1; 25; 16; 14; 7; 25; 24; 11; 18; 15; 21; 6; 20; 24; 7; 10; 21; 4; 6; 20; 12; 8; 10; 25; 3; 3; 8; 5; 24; 12; 10; 7; 24; 25; 8; 4; 1; 8; 18; 15; 15; 11; 26; 8; 12; 24; 24; 13; 15; 18; 25; 17; 19] 24)
16
+
17
+ let test4 _ = assert_equal 16 (maxValue [6; 12; 2; 26; 20; 24; 7; 14; 22; 23; 25; 24; 14; 6; 6; 26; 21; 12; 26; 13; 4; 15; 16; 8; 24; 8; 11; 26; 10; 13; 19; 12; 9; 18; 7; 22; 13; 25; 13; 16; 14; 8; 25; 9; 6; 15; 20; 17; 20; 18; 21; 8; 5; 6; 20; 20; 24; 17; 23; 9; 24; 26; 12; 21; 23; 6; 9; 18; 20; 20; 24; 13; 12; 1; 20; 6; 20; 4; 22; 10; 9; 24; 13; 2; 23; 22; 14; 15; 18; 13; 8; 7; 22; 1; 7; 14; 16; 22; 21; 24; 17; 9; 11; 12; 7; 3; 17; 9; 11; 5; 5; 10; 19; 7; 23; 2; 9; 26; 15; 21; 21; 2; 15; 24; 13; 23; 20; 3; 5; 17; 19; 4; 5; 2; 14; 13; 25; 12; 8; 8; 8; 5; 23; 10; 24; 9; 25; 3; 20; 19; 4; 17; 15; 25; 8; 20; 17; 18; 10; 2; 21; 21; 6; 15; 25; 15; 20; 1; 1; 12; 24; 17; 18; 2; 1; 20; 23; 22; 1; 3; 10; 17; 15; 8; 11; 13; 14; 4; 25; 10; 8; 16; 22; 21; 3; 16; 12; 5; 6; 25; 12; 2; 18; 20; 8; 26; 8; 23; 11; 20; 1; 25; 19; 15; 5; 24; 3; 7; 10; 12; 2; 1; 22; 3; 21; 14; 7; 25; 24; 12; 1; 2; 24; 22; 26; 3; 21; 12; 15; 15; 25; 2; 14; 13; 5; 18; 6; 12; 23; 18; 4; 24; 5; 19; 20; 9; 19; 26; 4; 6; 6; 19; 1; 5; 1; 1; 16; 21; 20; 6; 15; 4; 1; 6; 9; 18; 3; 24; 7; 3; 17; 16; 10; 23; 9; 18; 11; 16; 4; 12; 1; 2; 14; 21; 3; 19; 24; 19; 11; 25; 20; 23; 15; 22; 24; 11; 18; 10; 13; 11; 12; 13; 24; 6; 9; 24; 11; 14; 18; 13; 15; 15; 6; 24; 3; 6; 12; 12; 26; 9; 25; 2; 15; 1; 14] 114)
18
+
19
+ let test5 _ = assert_equal 31 (maxValue [9; 19; 5; 13; 13; 8; 5; 26; 7; 11; 8; 3; 12; 18; 19; 12; 16; 9; 26; 6; 20; 24; 3; 11; 13; 4; 2; 7; 2; 6; 12; 23; 16; 22; 3; 17; 13; 10; 19; 17; 10; 10; 2; 2; 24; 19; 6; 10; 3; 22; 17; 7; 19; 25; 16; 18; 6; 24; 13; 13; 9; 22; 9; 25; 15; 1; 3; 25; 6; 25; 17; 26; 14; 4; 17; 13; 8; 4; 7; 8; 23; 1; 25; 14; 19; 26; 12; 3; 12; 16; 24; 25; 11; 14; 13; 12; 13; 17; 25; 19; 8; 12; 15; 23; 26; 26; 13; 9; 3; 4; 6; 7; 10; 17; 1; 7; 24; 13; 3; 4; 18; 9; 17; 15; 4; 24; 1; 24; 8; 14; 13; 2; 25; 2; 7; 21; 23; 22; 25; 10; 2; 9; 3; 7; 13; 9; 5; 15; 15; 20; 20; 12; 25; 2; 17; 9; 26; 14; 20; 12; 2; 23; 6; 11; 20; 10; 17; 1; 20; 12; 16; 17; 4; 3; 14; 12; 8; 25; 15; 15; 16; 6; 10; 12; 21; 9; 6; 13; 18; 26; 9; 15; 5; 17; 6; 9; 23; 20; 11; 16; 24; 16; 24; 16; 7; 4; 4; 11; 15; 22; 3; 7; 9; 12; 24; 8; 20; 24; 26; 13; 13; 19; 3; 17; 19; 9; 8; 19; 1; 10; 19; 1; 2; 20; 12; 16; 7; 24; 7; 24; 2; 23; 14; 9; 2; 19; 25; 11; 2; 3; 12; 6; 19; 15; 15; 9; 7; 12; 3; 24; 6; 7; 17; 17; 26; 13; 12; 14; 22; 21; 4; 9; 25; 8; 9; 11; 10; 23; 19; 7; 3; 26; 13; 18; 23; 12; 21; 25; 25; 16; 19; 12; 18; 15; 15; 10; 22; 6; 12; 4; 25; 2; 21; 22; 5; 12; 3; 15; 9; 11; 19; 8; 20; 11; 14; 12; 23; 1; 20; 10; 2; 6; 15; 23; 2; 9; 16; 15; 21; 24; 20; 21; 25; 13; 24; 18; 10; 16; 25; 23; 13; 23; 25; 7; 26; 15; 16; 16; 16; 24; 22; 4; 3; 3; 7; 21; 2; 1; 9; 9; 10; 13; 20; 18; 24; 17; 23; 7] 29)
20
+
21
+ let test6 _ = assert_equal 24 (maxValue [17; 9; 22; 3; 1; 5; 7; 5; 17; 6; 23; 16; 20; 11; 4; 9; 14; 16; 10; 20; 8; 4; 14; 4; 19; 9; 7; 5; 10; 20; 6; 1; 23; 4; 12; 17; 11; 20; 17; 9; 10; 4; 25; 16; 2; 17; 1; 19; 23; 21; 6; 14; 19; 23; 11; 24; 22; 7; 7; 13; 26; 12; 25; 15; 12; 26; 11; 13; 20; 1; 15; 10; 26; 21; 14; 18; 16; 15; 4; 21; 16; 17; 4; 18; 19; 20; 7; 22; 18; 1; 13; 9; 3; 5; 16; 8; 5; 26; 24; 12; 1; 15; 12; 4; 8; 16; 25; 17; 25; 11; 14; 21; 13; 5; 25; 24; 22; 21; 18; 13; 15; 12; 14; 19] 37)
22
+
23
+ let test7 _ = assert_equal 28 (maxValue [13; 18; 14; 14; 1; 19; 25; 6; 2; 2; 26; 9; 5; 23; 10; 10; 11; 13; 15; 2; 25; 22; 16; 2; 14; 22; 22; 24; 8; 9; 2; 14; 1; 18; 11; 13; 3; 5; 9; 26; 5; 6; 24; 7; 17; 24; 8; 3; 25; 11; 24; 17; 15; 19; 16; 25; 2; 2; 6; 4; 1; 23; 11; 1; 8; 18; 3; 9; 23; 9; 4; 8; 11; 19; 25; 6; 13; 24; 18; 9; 21; 4; 5; 2; 24; 19; 14; 15; 2; 7; 24; 3; 18; 11; 2; 19; 15; 8; 12; 4; 15; 6; 7; 3; 6; 1; 11; 23; 15; 25; 2; 20; 10; 13; 2; 8; 2; 19; 5; 20; 5; 6; 15; 4; 13; 7; 13; 20; 1; 15; 7; 3; 20; 4; 25; 16; 22; 8; 7; 17; 19; 22; 14; 7; 14; 14; 23; 5; 25; 17; 5; 23; 3; 4; 16; 6; 25; 7; 1; 10; 16; 9; 20; 14; 2; 24; 26; 3; 8; 11; 24; 1; 4; 23; 26; 12; 15; 18; 16; 25; 17; 3; 1; 11; 9; 5; 23; 26; 14; 9; 7; 8; 4; 13; 5; 6; 2; 25; 15; 6; 17; 3; 12; 3; 8; 17; 14; 7; 19; 18; 23; 19; 8; 19; 25; 1; 6; 3; 25; 13; 26; 4; 5; 7; 16; 13; 11; 20; 13; 7; 23; 17; 16; 17; 13; 20; 5; 19; 14; 10; 21; 26; 1; 7; 1; 6; 9; 16; 15; 24; 10; 13; 3; 12; 21; 1; 24; 21; 21; 15; 26; 5; 18; 9; 14; 15; 10; 21; 6; 12; 9; 8; 1; 4; 12; 2; 7; 18; 21; 21; 22; 22; 7; 26; 21] 50)
24
+
25
+ let test8 _ = assert_equal 31 (maxValue [20; 1; 12; 11; 22; 26; 5; 4; 4; 22; 4; 8; 24; 5; 7; 9; 21; 8; 3; 12; 18; 1; 19; 6; 18; 9; 9; 20; 16; 3; 21; 25; 5; 14; 25; 11; 5; 2; 6; 8; 25; 15; 15; 16; 16; 24; 11; 9; 12; 3; 16; 1; 15; 22; 17; 8; 5; 17; 9; 15; 2; 15; 26; 14; 6; 14; 6; 23; 18; 10; 19; 16; 16; 20; 17; 6; 1; 26; 16; 21; 9; 22; 26; 24; 11; 6; 6; 13; 18; 14; 7; 3; 14; 15; 14; 5; 3; 11; 16; 3; 10; 1; 7; 18; 26; 25; 24; 12; 17; 11; 17; 7; 5; 12; 26; 23; 16; 1; 5; 16; 6; 9; 5; 1; 4; 12; 17; 15; 1; 24; 13; 8; 19; 4; 19; 1; 13; 6; 1; 20; 16; 4; 14; 6; 17; 13; 22; 25; 6; 9; 3; 10; 24; 1; 17; 10; 14; 18; 15; 26; 19; 10; 20; 2; 3; 6; 11; 22; 23; 3; 18; 26; 9; 12; 16; 25; 5; 1; 12; 7; 10; 20; 20; 8; 22; 21; 22; 23; 4; 6; 10; 26; 16; 18; 2; 7; 25; 2; 9; 10; 1; 13; 3; 6; 21; 24; 23; 24; 19; 4; 6; 1; 16; 22; 6; 7; 20; 22; 19; 24; 3] 24)
26
+
27
+ let test9 _ = assert_equal 31 (maxValue [3; 9; 7; 23; 26; 2; 17; 24; 8; 3; 13; 3; 21; 7; 15; 24; 12; 18; 23; 21; 14; 2; 23; 18; 18; 4; 17; 12; 3; 10; 5; 15; 23; 5; 16; 5; 2; 23; 16; 26; 7; 16; 4; 14; 13; 22; 7; 11; 16; 21; 8; 13; 22; 2; 19; 14; 25; 3; 8; 17; 21; 22; 3; 15; 22; 20; 16; 10; 13; 24; 4; 5; 18; 5; 22; 17; 20; 12; 6; 21; 21; 15; 21; 4; 23; 3; 8; 10; 26; 9; 16; 15; 12; 23; 24; 10; 22; 3; 6; 2; 21; 20; 1; 7; 3; 25; 11; 25; 18; 14; 23; 13; 26; 23; 19; 3; 10; 22; 4; 9; 6; 1; 1; 26; 26; 4; 19; 2; 9; 18; 15; 5; 2; 24; 20; 4; 1; 5; 20; 16; 10; 19; 5; 20; 19; 14; 23; 17; 17; 25; 16; 3; 10; 20; 26; 19; 21; 26; 21; 23; 14; 9; 2; 1; 12; 15; 7; 5; 18; 26; 19; 4; 20; 13; 5; 21; 22; 22; 16; 11; 19; 11; 14; 2; 22; 7; 5; 18; 3; 24; 11; 4; 3; 25; 6; 9; 19; 12; 14; 22; 13; 7; 8; 11; 4; 10; 5; 16; 23; 5; 16; 21; 2; 10; 19; 13; 24; 20; 14; 5; 21; 14; 12; 22; 26; 19; 24; 19; 1; 19; 6; 24; 24; 11; 9; 22; 2; 2; 8; 21; 24; 22; 20; 4; 10; 26; 5; 20; 4; 4; 21; 1; 22; 23; 7; 16; 26; 20; 8; 22; 22; 4; 21; 9; 17; 20; 7; 9; 3; 21; 16; 3; 5] 6)
28
+
29
+ let test10 _ = assert_equal 0 (maxValue [23; 19; 3; 16; 2; 10; 20; 14; 5; 5; 3; 21; 4; 23; 10; 15; 5; 22; 10; 23; 8; 10; 23; 6; 15; 20; 8; 19; 2; 10; 16; 21; 21; 14; 1; 6; 13; 17; 3; 16; 20; 5; 10; 1; 15; 10; 8; 23; 7; 2; 25; 24; 7; 9; 7; 23; 21; 10; 20; 18; 25; 5; 7; 5; 4; 14; 18; 19; 22; 17; 25; 12; 4; 7; 4; 5; 6; 10; 13; 9; 23; 15; 23; 7; 26; 11; 19; 16; 20; 18; 18; 12; 18; 19; 4; 2; 17; 21; 2; 19; 19; 21; 1; 16; 7; 18; 24; 16; 24; 9; 1; 10; 15; 12; 20; 15; 8; 15; 13; 26; 16; 7] 59)
30
+
31
+
32
+ (* Grouping test cases *)
33
+ let suite = "Test Suite for maxValue" >::: [
34
+
35
+ "test1" >:: test1;
36
+ "test2" >:: test2;
37
+ "test3" >:: test3;
38
+ "test4" >:: test4;
39
+ "test5" >:: test5;
40
+ "test6" >:: test6;
41
+ "test7" >:: test7;
42
+ "test8" >:: test8;
43
+ "test9" >:: test9;
44
+ "test10" >:: test10;
45
+ ]
46
+
47
+
48
+ (* Running the tests *)
49
+ let () = run_test_tt_main suite
50
+ end
find_the_maximum_sequence_value_of_array/scala_tests/MySuite.scala ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ class MySuite extends munit.FunSuite {
3
+
4
+ test("test1") {
5
+ assertEquals(Main.maxValue(List(2,6,7),1), 5)
6
+ }
7
+
8
+ test("test2") {
9
+ assertEquals(Main.maxValue(List(4,2,5,6,7),2), 2)
10
+ }
11
+
12
+ test("test3") {
13
+ assertEquals(Main.maxValue(List(16, 9, 22, 18, 19, 10, 19, 14, 13, 8, 12, 3, 13, 21, 15, 15, 19, 20, 19, 20, 23, 7, 7, 2, 5, 11, 25, 2, 21, 1, 19, 3, 20, 6, 4, 12, 11, 7, 14, 16, 8, 6, 6, 13, 22, 2, 9, 1, 17, 26, 19, 23, 5, 12, 22, 1, 9, 6, 26, 6, 21, 13, 5, 16, 20, 4, 6, 20, 13, 22, 11, 12, 8, 11, 22, 20, 23, 8, 5, 1, 23, 20, 12, 2, 21, 20, 3, 4, 8, 1, 18, 17, 21, 1, 17, 14, 22, 20, 23, 25, 11, 23, 17, 3, 24, 1, 4, 21, 23, 5, 17, 22, 1, 17, 14, 24, 26, 18, 25, 12, 3, 25, 11, 6, 9, 26, 24, 16, 5, 15, 14, 19, 23, 10, 25, 11, 1, 5, 12, 21, 2, 16, 19, 22, 18, 3, 22, 18, 19, 7, 21, 6, 2, 11, 22, 14, 21, 12, 24, 11, 5, 12, 17, 14, 15, 23, 1, 9, 9, 1, 7, 19, 15, 10, 13, 6, 22, 14, 5, 9, 10, 10, 13, 7, 18, 20, 22, 3, 17, 16, 20, 12, 15, 16, 17, 17, 5, 1, 25, 16, 14, 7, 25, 24, 11, 18, 15, 21, 6, 20, 24, 7, 10, 21, 4, 6, 20, 12, 8, 10, 25, 3, 3, 8, 5, 24, 12, 10, 7, 24, 25, 8, 4, 1, 8, 18, 15, 15, 11, 26, 8, 12, 24, 24, 13, 15, 18, 25, 17, 19),24), 31)
14
+ }
15
+
16
+ test("test4") {
17
+ assertEquals(Main.maxValue(List(6, 12, 2, 26, 20, 24, 7, 14, 22, 23, 25, 24, 14, 6, 6, 26, 21, 12, 26, 13, 4, 15, 16, 8, 24, 8, 11, 26, 10, 13, 19, 12, 9, 18, 7, 22, 13, 25, 13, 16, 14, 8, 25, 9, 6, 15, 20, 17, 20, 18, 21, 8, 5, 6, 20, 20, 24, 17, 23, 9, 24, 26, 12, 21, 23, 6, 9, 18, 20, 20, 24, 13, 12, 1, 20, 6, 20, 4, 22, 10, 9, 24, 13, 2, 23, 22, 14, 15, 18, 13, 8, 7, 22, 1, 7, 14, 16, 22, 21, 24, 17, 9, 11, 12, 7, 3, 17, 9, 11, 5, 5, 10, 19, 7, 23, 2, 9, 26, 15, 21, 21, 2, 15, 24, 13, 23, 20, 3, 5, 17, 19, 4, 5, 2, 14, 13, 25, 12, 8, 8, 8, 5, 23, 10, 24, 9, 25, 3, 20, 19, 4, 17, 15, 25, 8, 20, 17, 18, 10, 2, 21, 21, 6, 15, 25, 15, 20, 1, 1, 12, 24, 17, 18, 2, 1, 20, 23, 22, 1, 3, 10, 17, 15, 8, 11, 13, 14, 4, 25, 10, 8, 16, 22, 21, 3, 16, 12, 5, 6, 25, 12, 2, 18, 20, 8, 26, 8, 23, 11, 20, 1, 25, 19, 15, 5, 24, 3, 7, 10, 12, 2, 1, 22, 3, 21, 14, 7, 25, 24, 12, 1, 2, 24, 22, 26, 3, 21, 12, 15, 15, 25, 2, 14, 13, 5, 18, 6, 12, 23, 18, 4, 24, 5, 19, 20, 9, 19, 26, 4, 6, 6, 19, 1, 5, 1, 1, 16, 21, 20, 6, 15, 4, 1, 6, 9, 18, 3, 24, 7, 3, 17, 16, 10, 23, 9, 18, 11, 16, 4, 12, 1, 2, 14, 21, 3, 19, 24, 19, 11, 25, 20, 23, 15, 22, 24, 11, 18, 10, 13, 11, 12, 13, 24, 6, 9, 24, 11, 14, 18, 13, 15, 15, 6, 24, 3, 6, 12, 12, 26, 9, 25, 2, 15, 1, 14),114), 16)
18
+ }
19
+
20
+ test("test5") {
21
+ assertEquals(Main.maxValue(List(9, 19, 5, 13, 13, 8, 5, 26, 7, 11, 8, 3, 12, 18, 19, 12, 16, 9, 26, 6, 20, 24, 3, 11, 13, 4, 2, 7, 2, 6, 12, 23, 16, 22, 3, 17, 13, 10, 19, 17, 10, 10, 2, 2, 24, 19, 6, 10, 3, 22, 17, 7, 19, 25, 16, 18, 6, 24, 13, 13, 9, 22, 9, 25, 15, 1, 3, 25, 6, 25, 17, 26, 14, 4, 17, 13, 8, 4, 7, 8, 23, 1, 25, 14, 19, 26, 12, 3, 12, 16, 24, 25, 11, 14, 13, 12, 13, 17, 25, 19, 8, 12, 15, 23, 26, 26, 13, 9, 3, 4, 6, 7, 10, 17, 1, 7, 24, 13, 3, 4, 18, 9, 17, 15, 4, 24, 1, 24, 8, 14, 13, 2, 25, 2, 7, 21, 23, 22, 25, 10, 2, 9, 3, 7, 13, 9, 5, 15, 15, 20, 20, 12, 25, 2, 17, 9, 26, 14, 20, 12, 2, 23, 6, 11, 20, 10, 17, 1, 20, 12, 16, 17, 4, 3, 14, 12, 8, 25, 15, 15, 16, 6, 10, 12, 21, 9, 6, 13, 18, 26, 9, 15, 5, 17, 6, 9, 23, 20, 11, 16, 24, 16, 24, 16, 7, 4, 4, 11, 15, 22, 3, 7, 9, 12, 24, 8, 20, 24, 26, 13, 13, 19, 3, 17, 19, 9, 8, 19, 1, 10, 19, 1, 2, 20, 12, 16, 7, 24, 7, 24, 2, 23, 14, 9, 2, 19, 25, 11, 2, 3, 12, 6, 19, 15, 15, 9, 7, 12, 3, 24, 6, 7, 17, 17, 26, 13, 12, 14, 22, 21, 4, 9, 25, 8, 9, 11, 10, 23, 19, 7, 3, 26, 13, 18, 23, 12, 21, 25, 25, 16, 19, 12, 18, 15, 15, 10, 22, 6, 12, 4, 25, 2, 21, 22, 5, 12, 3, 15, 9, 11, 19, 8, 20, 11, 14, 12, 23, 1, 20, 10, 2, 6, 15, 23, 2, 9, 16, 15, 21, 24, 20, 21, 25, 13, 24, 18, 10, 16, 25, 23, 13, 23, 25, 7, 26, 15, 16, 16, 16, 24, 22, 4, 3, 3, 7, 21, 2, 1, 9, 9, 10, 13, 20, 18, 24, 17, 23, 7),29), 31)
22
+ }
23
+
24
+ test("test6") {
25
+ assertEquals(Main.maxValue(List(17, 9, 22, 3, 1, 5, 7, 5, 17, 6, 23, 16, 20, 11, 4, 9, 14, 16, 10, 20, 8, 4, 14, 4, 19, 9, 7, 5, 10, 20, 6, 1, 23, 4, 12, 17, 11, 20, 17, 9, 10, 4, 25, 16, 2, 17, 1, 19, 23, 21, 6, 14, 19, 23, 11, 24, 22, 7, 7, 13, 26, 12, 25, 15, 12, 26, 11, 13, 20, 1, 15, 10, 26, 21, 14, 18, 16, 15, 4, 21, 16, 17, 4, 18, 19, 20, 7, 22, 18, 1, 13, 9, 3, 5, 16, 8, 5, 26, 24, 12, 1, 15, 12, 4, 8, 16, 25, 17, 25, 11, 14, 21, 13, 5, 25, 24, 22, 21, 18, 13, 15, 12, 14, 19),37), 24)
26
+ }
27
+
28
+ test("test7") {
29
+ assertEquals(Main.maxValue(List(13, 18, 14, 14, 1, 19, 25, 6, 2, 2, 26, 9, 5, 23, 10, 10, 11, 13, 15, 2, 25, 22, 16, 2, 14, 22, 22, 24, 8, 9, 2, 14, 1, 18, 11, 13, 3, 5, 9, 26, 5, 6, 24, 7, 17, 24, 8, 3, 25, 11, 24, 17, 15, 19, 16, 25, 2, 2, 6, 4, 1, 23, 11, 1, 8, 18, 3, 9, 23, 9, 4, 8, 11, 19, 25, 6, 13, 24, 18, 9, 21, 4, 5, 2, 24, 19, 14, 15, 2, 7, 24, 3, 18, 11, 2, 19, 15, 8, 12, 4, 15, 6, 7, 3, 6, 1, 11, 23, 15, 25, 2, 20, 10, 13, 2, 8, 2, 19, 5, 20, 5, 6, 15, 4, 13, 7, 13, 20, 1, 15, 7, 3, 20, 4, 25, 16, 22, 8, 7, 17, 19, 22, 14, 7, 14, 14, 23, 5, 25, 17, 5, 23, 3, 4, 16, 6, 25, 7, 1, 10, 16, 9, 20, 14, 2, 24, 26, 3, 8, 11, 24, 1, 4, 23, 26, 12, 15, 18, 16, 25, 17, 3, 1, 11, 9, 5, 23, 26, 14, 9, 7, 8, 4, 13, 5, 6, 2, 25, 15, 6, 17, 3, 12, 3, 8, 17, 14, 7, 19, 18, 23, 19, 8, 19, 25, 1, 6, 3, 25, 13, 26, 4, 5, 7, 16, 13, 11, 20, 13, 7, 23, 17, 16, 17, 13, 20, 5, 19, 14, 10, 21, 26, 1, 7, 1, 6, 9, 16, 15, 24, 10, 13, 3, 12, 21, 1, 24, 21, 21, 15, 26, 5, 18, 9, 14, 15, 10, 21, 6, 12, 9, 8, 1, 4, 12, 2, 7, 18, 21, 21, 22, 22, 7, 26, 21),50), 28)
30
+ }
31
+
32
+ test("test8") {
33
+ assertEquals(Main.maxValue(List(20, 1, 12, 11, 22, 26, 5, 4, 4, 22, 4, 8, 24, 5, 7, 9, 21, 8, 3, 12, 18, 1, 19, 6, 18, 9, 9, 20, 16, 3, 21, 25, 5, 14, 25, 11, 5, 2, 6, 8, 25, 15, 15, 16, 16, 24, 11, 9, 12, 3, 16, 1, 15, 22, 17, 8, 5, 17, 9, 15, 2, 15, 26, 14, 6, 14, 6, 23, 18, 10, 19, 16, 16, 20, 17, 6, 1, 26, 16, 21, 9, 22, 26, 24, 11, 6, 6, 13, 18, 14, 7, 3, 14, 15, 14, 5, 3, 11, 16, 3, 10, 1, 7, 18, 26, 25, 24, 12, 17, 11, 17, 7, 5, 12, 26, 23, 16, 1, 5, 16, 6, 9, 5, 1, 4, 12, 17, 15, 1, 24, 13, 8, 19, 4, 19, 1, 13, 6, 1, 20, 16, 4, 14, 6, 17, 13, 22, 25, 6, 9, 3, 10, 24, 1, 17, 10, 14, 18, 15, 26, 19, 10, 20, 2, 3, 6, 11, 22, 23, 3, 18, 26, 9, 12, 16, 25, 5, 1, 12, 7, 10, 20, 20, 8, 22, 21, 22, 23, 4, 6, 10, 26, 16, 18, 2, 7, 25, 2, 9, 10, 1, 13, 3, 6, 21, 24, 23, 24, 19, 4, 6, 1, 16, 22, 6, 7, 20, 22, 19, 24, 3),24), 31)
34
+ }
35
+
36
+ test("test9") {
37
+ assertEquals(Main.maxValue(List(3, 9, 7, 23, 26, 2, 17, 24, 8, 3, 13, 3, 21, 7, 15, 24, 12, 18, 23, 21, 14, 2, 23, 18, 18, 4, 17, 12, 3, 10, 5, 15, 23, 5, 16, 5, 2, 23, 16, 26, 7, 16, 4, 14, 13, 22, 7, 11, 16, 21, 8, 13, 22, 2, 19, 14, 25, 3, 8, 17, 21, 22, 3, 15, 22, 20, 16, 10, 13, 24, 4, 5, 18, 5, 22, 17, 20, 12, 6, 21, 21, 15, 21, 4, 23, 3, 8, 10, 26, 9, 16, 15, 12, 23, 24, 10, 22, 3, 6, 2, 21, 20, 1, 7, 3, 25, 11, 25, 18, 14, 23, 13, 26, 23, 19, 3, 10, 22, 4, 9, 6, 1, 1, 26, 26, 4, 19, 2, 9, 18, 15, 5, 2, 24, 20, 4, 1, 5, 20, 16, 10, 19, 5, 20, 19, 14, 23, 17, 17, 25, 16, 3, 10, 20, 26, 19, 21, 26, 21, 23, 14, 9, 2, 1, 12, 15, 7, 5, 18, 26, 19, 4, 20, 13, 5, 21, 22, 22, 16, 11, 19, 11, 14, 2, 22, 7, 5, 18, 3, 24, 11, 4, 3, 25, 6, 9, 19, 12, 14, 22, 13, 7, 8, 11, 4, 10, 5, 16, 23, 5, 16, 21, 2, 10, 19, 13, 24, 20, 14, 5, 21, 14, 12, 22, 26, 19, 24, 19, 1, 19, 6, 24, 24, 11, 9, 22, 2, 2, 8, 21, 24, 22, 20, 4, 10, 26, 5, 20, 4, 4, 21, 1, 22, 23, 7, 16, 26, 20, 8, 22, 22, 4, 21, 9, 17, 20, 7, 9, 3, 21, 16, 3, 5),6), 31)
38
+ }
39
+
40
+ test("test10") {
41
+ assertEquals(Main.maxValue(List(23, 19, 3, 16, 2, 10, 20, 14, 5, 5, 3, 21, 4, 23, 10, 15, 5, 22, 10, 23, 8, 10, 23, 6, 15, 20, 8, 19, 2, 10, 16, 21, 21, 14, 1, 6, 13, 17, 3, 16, 20, 5, 10, 1, 15, 10, 8, 23, 7, 2, 25, 24, 7, 9, 7, 23, 21, 10, 20, 18, 25, 5, 7, 5, 4, 14, 18, 19, 22, 17, 25, 12, 4, 7, 4, 5, 6, 10, 13, 9, 23, 15, 23, 7, 26, 11, 19, 16, 20, 18, 18, 12, 18, 19, 4, 2, 17, 21, 2, 19, 19, 21, 1, 16, 7, 18, 24, 16, 24, 9, 1, 10, 15, 12, 20, 15, 8, 15, 13, 26, 16, 7),59), 0)
42
+ }
43
+
44
+ }
find_the_maximum_sum_of_node_values/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 (maximumValueSum [1,2,1] 3 [[0,1],[0,2]])," 6 (maximumValueSum [1,2,1] 3 [[0,1],[0,2]]))
13
+
14
+ test2 :: Test
15
+ test2 = TestCase (assertEqual "for (maximumValueSum [2,3] 7 [[0,1]])," 9 (maximumValueSum [2,3] 7 [[0,1]]))
16
+
17
+ test3 :: Test
18
+ test3 = TestCase (assertEqual "for (maximumValueSum [7,7,7,7,7,7] 3 [[0,1],[0,2],[0,3],[0,4],[0,5]])," 42 (maximumValueSum [7,7,7,7,7,7] 3 [[0,1],[0,2],[0,3],[0,4],[0,5]]))
19
+
20
+ test4 :: Test
21
+ test4 = TestCase (assertEqual "for (maximumValueSum [977538041, 914985843, 221838576, 501483518, 488047899, 707773864, 824502743, 115109856, 140156554, 10586824, 50988438, 577753314, 285640935, 817005225, 299414865, 884300312, 659005571, 683658123] 220908190 [[0, 1], [1, 2], [2, 3], [1, 4], [4, 5], [5, 6], [3, 7], [1, 8], [8, 9], [1, 10], [10, 11], [7, 12], [8, 13], [7, 14], [11, 15], [11, 16], [10, 17]])," 10809396445 (maximumValueSum [977538041, 914985843, 221838576, 501483518, 488047899, 707773864, 824502743, 115109856, 140156554, 10586824, 50988438, 577753314, 285640935, 817005225, 299414865, 884300312, 659005571, 683658123] 220908190 [[0, 1], [1, 2], [2, 3], [1, 4], [4, 5], [5, 6], [3, 7], [1, 8], [8, 9], [1, 10], [10, 11], [7, 12], [8, 13], [7, 14], [11, 15], [11, 16], [10, 17]]))
22
+
23
+ test5 :: Test
24
+ test5 = TestCase (assertEqual "for (maximumValueSum [949981876, 11477663, 618727282, 869248515, 954828286, 963523325, 746318200, 14800663, 364276796, 12281068, 398856652, 421492724, 555042350, 87423989, 10573301, 636578468, 292942321, 225186788] 763265655 [[0, 1], [0, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [3, 8], [4, 9], [2, 10], [5, 11], [9, 12], [9, 13], [5, 14], [2, 15], [1, 16], [14, 17]])," 14404175351 (maximumValueSum [949981876, 11477663, 618727282, 869248515, 954828286, 963523325, 746318200, 14800663, 364276796, 12281068, 398856652, 421492724, 555042350, 87423989, 10573301, 636578468, 292942321, 225186788] 763265655 [[0, 1], [0, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [3, 8], [4, 9], [2, 10], [5, 11], [9, 12], [9, 13], [5, 14], [2, 15], [1, 16], [14, 17]]))
25
+
26
+ test6 :: Test
27
+ test6 = TestCase (assertEqual "for (maximumValueSum [745311166, 850593829, 117376415, 112862397, 220549307, 911445538, 834876316, 849475440, 81818436, 406272938, 128674880, 833156998, 214081401, 606693707, 796952554, 274223460, 426632282, 314538858, 518198322, 575086589] 968161642 [[0, 1], [0, 2], [2, 3], [2, 4], [2, 5], [4, 6], [4, 7], [5, 8], [1, 9], [8, 10], [2, 11], [6, 12], [10, 13], [7, 14], [4, 15], [6, 16], [7, 17], [0, 18], [0, 19]])," 16066485697 (maximumValueSum [745311166, 850593829, 117376415, 112862397, 220549307, 911445538, 834876316, 849475440, 81818436, 406272938, 128674880, 833156998, 214081401, 606693707, 796952554, 274223460, 426632282, 314538858, 518198322, 575086589] 968161642 [[0, 1], [0, 2], [2, 3], [2, 4], [2, 5], [4, 6], [4, 7], [5, 8], [1, 9], [8, 10], [2, 11], [6, 12], [10, 13], [7, 14], [4, 15], [6, 16], [7, 17], [0, 18], [0, 19]]))
28
+
29
+ test7 :: Test
30
+ test7 = TestCase (assertEqual "for (maximumValueSum [44291611, 386215946, 375861387, 504839330, 84457102, 951788380, 827948560, 246022760] 310790086 [[0, 1], [1, 2], [1, 3], [3, 4], [0, 5], [4, 6], [4, 7]])," 3959341884 (maximumValueSum [44291611, 386215946, 375861387, 504839330, 84457102, 951788380, 827948560, 246022760] 310790086 [[0, 1], [1, 2], [1, 3], [3, 4], [0, 5], [4, 6], [4, 7]]))
31
+
32
+ test8 :: Test
33
+ test8 = TestCase (assertEqual "for (maximumValueSum [391658618, 10284122, 964167617, 293237510, 906154707, 888486155, 390244058, 246905744, 453161757, 289165279, 993194070, 458759549, 870761519] 91858911 [[0, 1], [0, 2], [1, 3], [0, 4], [0, 5], [0, 6], [0, 7], [6, 8], [5, 9], [9, 10], [6, 11], [3, 12]])," 7583473179 (maximumValueSum [391658618, 10284122, 964167617, 293237510, 906154707, 888486155, 390244058, 246905744, 453161757, 289165279, 993194070, 458759549, 870761519] 91858911 [[0, 1], [0, 2], [1, 3], [0, 4], [0, 5], [0, 6], [0, 7], [6, 8], [5, 9], [9, 10], [6, 11], [3, 12]]))
34
+
35
+ test9 :: Test
36
+ test9 = TestCase (assertEqual "for (maximumValueSum [53742462, 631248016, 157640466, 540450446, 197211472, 908831573, 636352024, 681393970, 968786857, 802549093, 344688510, 537896129, 227515237, 662975492, 951612635, 253708898, 187242418, 354643418, 814465367] 388231932 [[0, 1], [1, 2], [0, 3], [2, 4], [1, 5], [4, 6], [3, 7], [2, 8], [4, 9], [1, 10], [6, 11], [7, 12], [9, 13], [12, 14], [0, 15], [11, 16], [15, 17], [17, 18]])," 13239291355 (maximumValueSum [53742462, 631248016, 157640466, 540450446, 197211472, 908831573, 636352024, 681393970, 968786857, 802549093, 344688510, 537896129, 227515237, 662975492, 951612635, 253708898, 187242418, 354643418, 814465367] 388231932 [[0, 1], [1, 2], [0, 3], [2, 4], [1, 5], [4, 6], [3, 7], [2, 8], [4, 9], [1, 10], [6, 11], [7, 12], [9, 13], [12, 14], [0, 15], [11, 16], [15, 17], [17, 18]]))
37
+
38
+
39
+ -- Grouping test cases
40
+ tests :: Test
41
+ tests = TestList [TestLabel "Test1" test1, TestLabel "Test2" test2, TestLabel "Test3" test3, TestLabel "Test4" test4, TestLabel "Test5" test5, TestLabel "Test6" test6, TestLabel "Test7" test7, TestLabel "Test8" test8, TestLabel "Test9" test9]
42
+
43
+ -- Running the tests
44
+ main :: IO Counts
45
+ main = runTestTT tests
find_the_maximum_sum_of_node_values/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(6, maximumValueSum(new ArrayList<>(Arrays.asList(1,2,1)), 3, new ArrayList<>(Arrays.asList(new ArrayList<>(Arrays.asList(0,1)),new ArrayList<>(Arrays.asList(0,2))))));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals(9, maximumValueSum(new ArrayList<>(Arrays.asList(2,3)), 7, new ArrayList<>(Arrays.asList(new ArrayList<>(Arrays.asList(0,1))))));
19
+ }
20
+ @Test
21
+ public void test3() {
22
+ assertEquals(42, maximumValueSum(new ArrayList<>(Arrays.asList(7,7,7,7,7,7)), 3, new ArrayList<>(Arrays.asList(new ArrayList<>(Arrays.asList(0,1)),new ArrayList<>(Arrays.asList(0,2)),new ArrayList<>(Arrays.asList(0,3)),new ArrayList<>(Arrays.asList(0,4)),new ArrayList<>(Arrays.asList(0,5))))));
23
+ }
24
+
25
+ }
find_the_maximum_sum_of_node_values/meta.json ADDED
@@ -0,0 +1,707 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "id": 3307,
3
+ "name": "find_the_maximum_sum_of_node_values",
4
+ "difficulty": "Hard",
5
+ "link": "https://leetcode.com/problems/find-the-maximum-sum-of-node-values/",
6
+ "date": "2024-02-17 00:00:00",
7
+ "task_description": "There exists an **undirected** tree with `n` nodes numbered `0` to `n - 1`. You are given a **0-indexed** 2D integer array `edges` of length `n - 1`, where `edges[i] = [ui, vi]` indicates that there is an edge between nodes `ui` and `vi` in the tree. You are also given a **positive** integer `k`, and a **0-indexed** array of **non-negative** integers `nums` of length `n`, where `nums[i]` represents the **value** of the node numbered `i`. Alice wants the sum of values of tree nodes to be **maximum**, for which Alice can perform the following operation **any** number of times (**including zero**) on the tree: Choose any edge `[u, v]` connecting the nodes `u` and `v`, and update their values as follows: `nums[u] = nums[u] XOR k` `nums[v] = nums[v] XOR k` Return _the **maximum** possible **sum** of the **values** Alice can achieve by performing the operation **any** number of times_. **Example 1:** ``` **Input:** nums = [1,2,1], k = 3, edges = [[0,1],[0,2]] **Output:** 6 **Explanation:** Alice can achieve the maximum sum of 6 using a single operation: - Choose the edge [0,2]. nums[0] and nums[2] become: 1 XOR 3 = 2, and the array nums becomes: [1,2,1] -> [2,2,2]. The total sum of values is 2 + 2 + 2 = 6. It can be shown that 6 is the maximum achievable sum of values. ``` **Example 2:** ``` **Input:** nums = [2,3], k = 7, edges = [[0,1]] **Output:** 9 **Explanation:** Alice can achieve the maximum sum of 9 using a single operation: - Choose the edge [0,1]. nums[0] becomes: 2 XOR 7 = 5 and nums[1] become: 3 XOR 7 = 4, and the array nums becomes: [2,3] -> [5,4]. The total sum of values is 5 + 4 = 9. It can be shown that 9 is the maximum achievable sum of values. ``` **Example 3:** ``` **Input:** nums = [7,7,7,7,7,7], k = 3, edges = [[0,1],[0,2],[0,3],[0,4],[0,5]] **Output:** 42 **Explanation:** The maximum achievable sum is 42 which can be achieved by Alice performing no operations. ``` **Constraints:** `2 <= n == nums.length <= 2 * 104` `1 <= k <= 109` `0 <= nums[i] <= 109` `edges.length == n - 1` `edges[i].length == 2` `0 <= edges[i][0], edges[i][1] <= n - 1` The input is generated such that `edges` represent a valid tree.",
8
+ "public_test_cases": [
9
+ {
10
+ "label": "Example 1",
11
+ "input": "nums = [1,2,1], k = 3, edges = [[0,1],[0,2]]",
12
+ "output": "6 "
13
+ },
14
+ {
15
+ "label": "Example 2",
16
+ "input": "nums = [2,3], k = 7, edges = [[0,1]]",
17
+ "output": "9 "
18
+ },
19
+ {
20
+ "label": "Example 3",
21
+ "input": "nums = [7,7,7,7,7,7], k = 3, edges = [[0,1],[0,2],[0,3],[0,4],[0,5]]",
22
+ "output": "42 "
23
+ }
24
+ ],
25
+ "private_test_cases": [
26
+ {
27
+ "input": [
28
+ [
29
+ 977538041,
30
+ 914985843,
31
+ 221838576,
32
+ 501483518,
33
+ 488047899,
34
+ 707773864,
35
+ 824502743,
36
+ 115109856,
37
+ 140156554,
38
+ 10586824,
39
+ 50988438,
40
+ 577753314,
41
+ 285640935,
42
+ 817005225,
43
+ 299414865,
44
+ 884300312,
45
+ 659005571,
46
+ 683658123
47
+ ],
48
+ 220908190,
49
+ [
50
+ [
51
+ 0,
52
+ 1
53
+ ],
54
+ [
55
+ 1,
56
+ 2
57
+ ],
58
+ [
59
+ 2,
60
+ 3
61
+ ],
62
+ [
63
+ 1,
64
+ 4
65
+ ],
66
+ [
67
+ 4,
68
+ 5
69
+ ],
70
+ [
71
+ 5,
72
+ 6
73
+ ],
74
+ [
75
+ 3,
76
+ 7
77
+ ],
78
+ [
79
+ 1,
80
+ 8
81
+ ],
82
+ [
83
+ 8,
84
+ 9
85
+ ],
86
+ [
87
+ 1,
88
+ 10
89
+ ],
90
+ [
91
+ 10,
92
+ 11
93
+ ],
94
+ [
95
+ 7,
96
+ 12
97
+ ],
98
+ [
99
+ 8,
100
+ 13
101
+ ],
102
+ [
103
+ 7,
104
+ 14
105
+ ],
106
+ [
107
+ 11,
108
+ 15
109
+ ],
110
+ [
111
+ 11,
112
+ 16
113
+ ],
114
+ [
115
+ 10,
116
+ 17
117
+ ]
118
+ ]
119
+ ],
120
+ "output": 10809396445
121
+ },
122
+ {
123
+ "input": [
124
+ [
125
+ 949981876,
126
+ 11477663,
127
+ 618727282,
128
+ 869248515,
129
+ 954828286,
130
+ 963523325,
131
+ 746318200,
132
+ 14800663,
133
+ 364276796,
134
+ 12281068,
135
+ 398856652,
136
+ 421492724,
137
+ 555042350,
138
+ 87423989,
139
+ 10573301,
140
+ 636578468,
141
+ 292942321,
142
+ 225186788
143
+ ],
144
+ 763265655,
145
+ [
146
+ [
147
+ 0,
148
+ 1
149
+ ],
150
+ [
151
+ 0,
152
+ 2
153
+ ],
154
+ [
155
+ 2,
156
+ 3
157
+ ],
158
+ [
159
+ 2,
160
+ 4
161
+ ],
162
+ [
163
+ 2,
164
+ 5
165
+ ],
166
+ [
167
+ 2,
168
+ 6
169
+ ],
170
+ [
171
+ 2,
172
+ 7
173
+ ],
174
+ [
175
+ 3,
176
+ 8
177
+ ],
178
+ [
179
+ 4,
180
+ 9
181
+ ],
182
+ [
183
+ 2,
184
+ 10
185
+ ],
186
+ [
187
+ 5,
188
+ 11
189
+ ],
190
+ [
191
+ 9,
192
+ 12
193
+ ],
194
+ [
195
+ 9,
196
+ 13
197
+ ],
198
+ [
199
+ 5,
200
+ 14
201
+ ],
202
+ [
203
+ 2,
204
+ 15
205
+ ],
206
+ [
207
+ 1,
208
+ 16
209
+ ],
210
+ [
211
+ 14,
212
+ 17
213
+ ]
214
+ ]
215
+ ],
216
+ "output": 14404175351
217
+ },
218
+ {
219
+ "input": [
220
+ [
221
+ 745311166,
222
+ 850593829,
223
+ 117376415,
224
+ 112862397,
225
+ 220549307,
226
+ 911445538,
227
+ 834876316,
228
+ 849475440,
229
+ 81818436,
230
+ 406272938,
231
+ 128674880,
232
+ 833156998,
233
+ 214081401,
234
+ 606693707,
235
+ 796952554,
236
+ 274223460,
237
+ 426632282,
238
+ 314538858,
239
+ 518198322,
240
+ 575086589
241
+ ],
242
+ 968161642,
243
+ [
244
+ [
245
+ 0,
246
+ 1
247
+ ],
248
+ [
249
+ 0,
250
+ 2
251
+ ],
252
+ [
253
+ 2,
254
+ 3
255
+ ],
256
+ [
257
+ 2,
258
+ 4
259
+ ],
260
+ [
261
+ 2,
262
+ 5
263
+ ],
264
+ [
265
+ 4,
266
+ 6
267
+ ],
268
+ [
269
+ 4,
270
+ 7
271
+ ],
272
+ [
273
+ 5,
274
+ 8
275
+ ],
276
+ [
277
+ 1,
278
+ 9
279
+ ],
280
+ [
281
+ 8,
282
+ 10
283
+ ],
284
+ [
285
+ 2,
286
+ 11
287
+ ],
288
+ [
289
+ 6,
290
+ 12
291
+ ],
292
+ [
293
+ 10,
294
+ 13
295
+ ],
296
+ [
297
+ 7,
298
+ 14
299
+ ],
300
+ [
301
+ 4,
302
+ 15
303
+ ],
304
+ [
305
+ 6,
306
+ 16
307
+ ],
308
+ [
309
+ 7,
310
+ 17
311
+ ],
312
+ [
313
+ 0,
314
+ 18
315
+ ],
316
+ [
317
+ 0,
318
+ 19
319
+ ]
320
+ ]
321
+ ],
322
+ "output": 16066485697
323
+ },
324
+ {
325
+ "input": [
326
+ [
327
+ 44291611,
328
+ 386215946,
329
+ 375861387,
330
+ 504839330,
331
+ 84457102,
332
+ 951788380,
333
+ 827948560,
334
+ 246022760
335
+ ],
336
+ 310790086,
337
+ [
338
+ [
339
+ 0,
340
+ 1
341
+ ],
342
+ [
343
+ 1,
344
+ 2
345
+ ],
346
+ [
347
+ 1,
348
+ 3
349
+ ],
350
+ [
351
+ 3,
352
+ 4
353
+ ],
354
+ [
355
+ 0,
356
+ 5
357
+ ],
358
+ [
359
+ 4,
360
+ 6
361
+ ],
362
+ [
363
+ 4,
364
+ 7
365
+ ]
366
+ ]
367
+ ],
368
+ "output": 3959341884
369
+ },
370
+ {
371
+ "input": [
372
+ [
373
+ 391658618,
374
+ 10284122,
375
+ 964167617,
376
+ 293237510,
377
+ 906154707,
378
+ 888486155,
379
+ 390244058,
380
+ 246905744,
381
+ 453161757,
382
+ 289165279,
383
+ 993194070,
384
+ 458759549,
385
+ 870761519
386
+ ],
387
+ 91858911,
388
+ [
389
+ [
390
+ 0,
391
+ 1
392
+ ],
393
+ [
394
+ 0,
395
+ 2
396
+ ],
397
+ [
398
+ 1,
399
+ 3
400
+ ],
401
+ [
402
+ 0,
403
+ 4
404
+ ],
405
+ [
406
+ 0,
407
+ 5
408
+ ],
409
+ [
410
+ 0,
411
+ 6
412
+ ],
413
+ [
414
+ 0,
415
+ 7
416
+ ],
417
+ [
418
+ 6,
419
+ 8
420
+ ],
421
+ [
422
+ 5,
423
+ 9
424
+ ],
425
+ [
426
+ 9,
427
+ 10
428
+ ],
429
+ [
430
+ 6,
431
+ 11
432
+ ],
433
+ [
434
+ 3,
435
+ 12
436
+ ]
437
+ ]
438
+ ],
439
+ "output": 7583473179
440
+ },
441
+ {
442
+ "input": [
443
+ [
444
+ 53742462,
445
+ 631248016,
446
+ 157640466,
447
+ 540450446,
448
+ 197211472,
449
+ 908831573,
450
+ 636352024,
451
+ 681393970,
452
+ 968786857,
453
+ 802549093,
454
+ 344688510,
455
+ 537896129,
456
+ 227515237,
457
+ 662975492,
458
+ 951612635,
459
+ 253708898,
460
+ 187242418,
461
+ 354643418,
462
+ 814465367
463
+ ],
464
+ 388231932,
465
+ [
466
+ [
467
+ 0,
468
+ 1
469
+ ],
470
+ [
471
+ 1,
472
+ 2
473
+ ],
474
+ [
475
+ 0,
476
+ 3
477
+ ],
478
+ [
479
+ 2,
480
+ 4
481
+ ],
482
+ [
483
+ 1,
484
+ 5
485
+ ],
486
+ [
487
+ 4,
488
+ 6
489
+ ],
490
+ [
491
+ 3,
492
+ 7
493
+ ],
494
+ [
495
+ 2,
496
+ 8
497
+ ],
498
+ [
499
+ 4,
500
+ 9
501
+ ],
502
+ [
503
+ 1,
504
+ 10
505
+ ],
506
+ [
507
+ 6,
508
+ 11
509
+ ],
510
+ [
511
+ 7,
512
+ 12
513
+ ],
514
+ [
515
+ 9,
516
+ 13
517
+ ],
518
+ [
519
+ 12,
520
+ 14
521
+ ],
522
+ [
523
+ 0,
524
+ 15
525
+ ],
526
+ [
527
+ 11,
528
+ 16
529
+ ],
530
+ [
531
+ 15,
532
+ 17
533
+ ],
534
+ [
535
+ 17,
536
+ 18
537
+ ]
538
+ ]
539
+ ],
540
+ "output": 13239291355
541
+ },
542
+ {
543
+ "input": [
544
+ [
545
+ 758447137,
546
+ 880113334,
547
+ 787117314,
548
+ 856409518,
549
+ 206165459,
550
+ 211673441,
551
+ 263751924,
552
+ 50113537,
553
+ 365786360,
554
+ 973281897,
555
+ 802884572,
556
+ 115956002,
557
+ 959594603,
558
+ 369557175,
559
+ 466404199
560
+ ],
561
+ 527701175,
562
+ [
563
+ [
564
+ 0,
565
+ 1
566
+ ],
567
+ [
568
+ 1,
569
+ 2
570
+ ],
571
+ [
572
+ 0,
573
+ 3
574
+ ],
575
+ [
576
+ 3,
577
+ 4
578
+ ],
579
+ [
580
+ 4,
581
+ 5
582
+ ],
583
+ [
584
+ 3,
585
+ 6
586
+ ],
587
+ [
588
+ 0,
589
+ 7
590
+ ],
591
+ [
592
+ 4,
593
+ 8
594
+ ],
595
+ [
596
+ 0,
597
+ 9
598
+ ],
599
+ [
600
+ 0,
601
+ 10
602
+ ],
603
+ [
604
+ 3,
605
+ 11
606
+ ],
607
+ [
608
+ 5,
609
+ 12
610
+ ],
611
+ [
612
+ 5,
613
+ 13
614
+ ],
615
+ [
616
+ 9,
617
+ 14
618
+ ]
619
+ ]
620
+ ],
621
+ "output": 9227506124
622
+ },
623
+ {
624
+ "input": [
625
+ [
626
+ 51048371,
627
+ 621626174,
628
+ 853340026,
629
+ 830724220
630
+ ],
631
+ 40294959,
632
+ [
633
+ [
634
+ 0,
635
+ 1
636
+ ],
637
+ [
638
+ 1,
639
+ 2
640
+ ],
641
+ [
642
+ 1,
643
+ 3
644
+ ]
645
+ ]
646
+ ],
647
+ "output": 2436397713
648
+ },
649
+ {
650
+ "input": [
651
+ [
652
+ 767012436,
653
+ 885436648,
654
+ 428157424,
655
+ 175690002,
656
+ 647025660
657
+ ],
658
+ 936546775,
659
+ [
660
+ [
661
+ 0,
662
+ 1
663
+ ],
664
+ [
665
+ 1,
666
+ 2
667
+ ],
668
+ [
669
+ 2,
670
+ 3
671
+ ],
672
+ [
673
+ 0,
674
+ 4
675
+ ]
676
+ ]
677
+ ],
678
+ "output": 4111543332
679
+ },
680
+ {
681
+ "input": [
682
+ [
683
+ 856753637,
684
+ 507824822,
685
+ 132625986
686
+ ],
687
+ 384817920,
688
+ [
689
+ [
690
+ 0,
691
+ 1
692
+ ],
693
+ [
694
+ 0,
695
+ 2
696
+ ]
697
+ ]
698
+ ],
699
+ "output": 1497204445
700
+ }
701
+ ],
702
+ "haskell_template": "maximumValueSum :: [Int] -> Int -> [[Int]] -> Int\nmaximumValueSum nums k edges ",
703
+ "ocaml_template": "let maximumValueSum (nums: int list) (k: int) (edges: int list list) : int = ",
704
+ "scala_template": "def maximumValueSum(nums: List[Int],k: Int,edges: List[List[Int]]): Int = { \n \n}",
705
+ "java_template": "class Solution {\n public long maximumValueSum(int[] nums, int k, int[][] edges) {\n \n }\n}",
706
+ "python_template": "class Solution(object):\n def maximumValueSum(self, nums, k, edges):\n \"\"\"\n :type nums: List[int]\n :type k: int\n :type edges: List[List[int]]\n :rtype: int\n \"\"\"\n "
707
+ }
find_the_maximum_sum_of_node_values/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 6 (maximumValueSum [1;2;1] 3 [[0;1];[0;2]])
12
+
13
+ let test2 _ = assert_equal 9 (maximumValueSum [2;3] 7 [[0;1]])
14
+
15
+ let test3 _ = assert_equal 42 (maximumValueSum [7;7;7;7;7;7] 3 [[0;1];[0;2];[0;3];[0;4];[0;5]])
16
+
17
+ let test4 _ = assert_equal 10809396445 (maximumValueSum [977538041; 914985843; 221838576; 501483518; 488047899; 707773864; 824502743; 115109856; 140156554; 10586824; 50988438; 577753314; 285640935; 817005225; 299414865; 884300312; 659005571; 683658123] 220908190 [[0; 1]; [1; 2]; [2; 3]; [1; 4]; [4; 5]; [5; 6]; [3; 7]; [1; 8]; [8; 9]; [1; 10]; [10; 11]; [7; 12]; [8; 13]; [7; 14]; [11; 15]; [11; 16]; [10; 17]])
18
+
19
+ let test5 _ = assert_equal 14404175351 (maximumValueSum [949981876; 11477663; 618727282; 869248515; 954828286; 963523325; 746318200; 14800663; 364276796; 12281068; 398856652; 421492724; 555042350; 87423989; 10573301; 636578468; 292942321; 225186788] 763265655 [[0; 1]; [0; 2]; [2; 3]; [2; 4]; [2; 5]; [2; 6]; [2; 7]; [3; 8]; [4; 9]; [2; 10]; [5; 11]; [9; 12]; [9; 13]; [5; 14]; [2; 15]; [1; 16]; [14; 17]])
20
+
21
+ let test6 _ = assert_equal 16066485697 (maximumValueSum [745311166; 850593829; 117376415; 112862397; 220549307; 911445538; 834876316; 849475440; 81818436; 406272938; 128674880; 833156998; 214081401; 606693707; 796952554; 274223460; 426632282; 314538858; 518198322; 575086589] 968161642 [[0; 1]; [0; 2]; [2; 3]; [2; 4]; [2; 5]; [4; 6]; [4; 7]; [5; 8]; [1; 9]; [8; 10]; [2; 11]; [6; 12]; [10; 13]; [7; 14]; [4; 15]; [6; 16]; [7; 17]; [0; 18]; [0; 19]])
22
+
23
+ let test7 _ = assert_equal 3959341884 (maximumValueSum [44291611; 386215946; 375861387; 504839330; 84457102; 951788380; 827948560; 246022760] 310790086 [[0; 1]; [1; 2]; [1; 3]; [3; 4]; [0; 5]; [4; 6]; [4; 7]])
24
+
25
+ let test8 _ = assert_equal 7583473179 (maximumValueSum [391658618; 10284122; 964167617; 293237510; 906154707; 888486155; 390244058; 246905744; 453161757; 289165279; 993194070; 458759549; 870761519] 91858911 [[0; 1]; [0; 2]; [1; 3]; [0; 4]; [0; 5]; [0; 6]; [0; 7]; [6; 8]; [5; 9]; [9; 10]; [6; 11]; [3; 12]])
26
+
27
+ let test9 _ = assert_equal 13239291355 (maximumValueSum [53742462; 631248016; 157640466; 540450446; 197211472; 908831573; 636352024; 681393970; 968786857; 802549093; 344688510; 537896129; 227515237; 662975492; 951612635; 253708898; 187242418; 354643418; 814465367] 388231932 [[0; 1]; [1; 2]; [0; 3]; [2; 4]; [1; 5]; [4; 6]; [3; 7]; [2; 8]; [4; 9]; [1; 10]; [6; 11]; [7; 12]; [9; 13]; [12; 14]; [0; 15]; [11; 16]; [15; 17]; [17; 18]])
28
+
29
+ let test10 _ = assert_equal 9227506124 (maximumValueSum [758447137; 880113334; 787117314; 856409518; 206165459; 211673441; 263751924; 50113537; 365786360; 973281897; 802884572; 115956002; 959594603; 369557175; 466404199] 527701175 [[0; 1]; [1; 2]; [0; 3]; [3; 4]; [4; 5]; [3; 6]; [0; 7]; [4; 8]; [0; 9]; [0; 10]; [3; 11]; [5; 12]; [5; 13]; [9; 14]])
30
+
31
+
32
+ (* Grouping test cases *)
33
+ let suite = "Test Suite for maximumValueSum" >::: [
34
+
35
+ "test1" >:: test1;
36
+ "test2" >:: test2;
37
+ "test3" >:: test3;
38
+ "test4" >:: test4;
39
+ "test5" >:: test5;
40
+ "test6" >:: test6;
41
+ "test7" >:: test7;
42
+ "test8" >:: test8;
43
+ "test9" >:: test9;
44
+ "test10" >:: test10;
45
+ ]
46
+
47
+
48
+ (* Running the tests *)
49
+ let () = run_test_tt_main suite
50
+ end
find_the_maximum_sum_of_node_values/scala_tests/MySuite.scala ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ class MySuite extends munit.FunSuite {
3
+
4
+ test("test1") {
5
+ assertEquals(Main.maximumValueSum(List(1,2,1),3,List(List(0,1),List(0,2))), 6)
6
+ }
7
+
8
+ test("test2") {
9
+ assertEquals(Main.maximumValueSum(List(2,3),7,List(List(0,1))), 9)
10
+ }
11
+
12
+ test("test3") {
13
+ assertEquals(Main.maximumValueSum(List(7,7,7,7,7,7),3,List(List(0,1),List(0,2),List(0,3),List(0,4),List(0,5))), 42)
14
+ }
15
+
16
+ test("test4") {
17
+ assertEquals(Main.maximumValueSum(List(977538041, 914985843, 221838576, 501483518, 488047899, 707773864, 824502743, 115109856, 140156554, 10586824, 50988438, 577753314, 285640935, 817005225, 299414865, 884300312, 659005571, 683658123),220908190,List(List(0, 1), List(1, 2), List(2, 3), List(1, 4), List(4, 5), List(5, 6), List(3, 7), List(1, 8), List(8, 9), List(1, 10), List(10, 11), List(7, 12), List(8, 13), List(7, 14), List(11, 15), List(11, 16), List(10, 17))), BigInt("10809396445"))
18
+ }
19
+
20
+ test("test5") {
21
+ assertEquals(Main.maximumValueSum(List(949981876, 11477663, 618727282, 869248515, 954828286, 963523325, 746318200, 14800663, 364276796, 12281068, 398856652, 421492724, 555042350, 87423989, 10573301, 636578468, 292942321, 225186788),763265655,List(List(0, 1), List(0, 2), List(2, 3), List(2, 4), List(2, 5), List(2, 6), List(2, 7), List(3, 8), List(4, 9), List(2, 10), List(5, 11), List(9, 12), List(9, 13), List(5, 14), List(2, 15), List(1, 16), List(14, 17))), BigInt("14404175351"))
22
+ }
23
+
24
+ test("test6") {
25
+ assertEquals(Main.maximumValueSum(List(745311166, 850593829, 117376415, 112862397, 220549307, 911445538, 834876316, 849475440, 81818436, 406272938, 128674880, 833156998, 214081401, 606693707, 796952554, 274223460, 426632282, 314538858, 518198322, 575086589),968161642,List(List(0, 1), List(0, 2), List(2, 3), List(2, 4), List(2, 5), List(4, 6), List(4, 7), List(5, 8), List(1, 9), List(8, 10), List(2, 11), List(6, 12), List(10, 13), List(7, 14), List(4, 15), List(6, 16), List(7, 17), List(0, 18), List(0, 19))), BigInt("16066485697"))
26
+ }
27
+
28
+ test("test7") {
29
+ assertEquals(Main.maximumValueSum(List(44291611, 386215946, 375861387, 504839330, 84457102, 951788380, 827948560, 246022760),310790086,List(List(0, 1), List(1, 2), List(1, 3), List(3, 4), List(0, 5), List(4, 6), List(4, 7))), BigInt("3959341884"))
30
+ }
31
+
32
+ test("test8") {
33
+ assertEquals(Main.maximumValueSum(List(391658618, 10284122, 964167617, 293237510, 906154707, 888486155, 390244058, 246905744, 453161757, 289165279, 993194070, 458759549, 870761519),91858911,List(List(0, 1), List(0, 2), List(1, 3), List(0, 4), List(0, 5), List(0, 6), List(0, 7), List(6, 8), List(5, 9), List(9, 10), List(6, 11), List(3, 12))), BigInt("7583473179"))
34
+ }
35
+
36
+ test("test9") {
37
+ assertEquals(Main.maximumValueSum(List(53742462, 631248016, 157640466, 540450446, 197211472, 908831573, 636352024, 681393970, 968786857, 802549093, 344688510, 537896129, 227515237, 662975492, 951612635, 253708898, 187242418, 354643418, 814465367),388231932,List(List(0, 1), List(1, 2), List(0, 3), List(2, 4), List(1, 5), List(4, 6), List(3, 7), List(2, 8), List(4, 9), List(1, 10), List(6, 11), List(7, 12), List(9, 13), List(12, 14), List(0, 15), List(11, 16), List(15, 17), List(17, 18))), BigInt("13239291355"))
38
+ }
39
+
40
+ test("test10") {
41
+ assertEquals(Main.maximumValueSum(List(758447137, 880113334, 787117314, 856409518, 206165459, 211673441, 263751924, 50113537, 365786360, 973281897, 802884572, 115956002, 959594603, 369557175, 466404199),527701175,List(List(0, 1), List(1, 2), List(0, 3), List(3, 4), List(4, 5), List(3, 6), List(0, 7), List(4, 8), List(0, 9), List(0, 10), List(3, 11), List(5, 12), List(5, 13), List(9, 14))), BigInt("9227506124"))
42
+ }
43
+
44
+ }
find_the_median_of_the_uniqueness_array/haskell_tests/Main.hs ADDED
The diff for this file is too large to render. See raw diff
 
find_the_median_of_the_uniqueness_array/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(1, medianOfUniquenessArray(Arrays.asList(1,2,3)));
14
+ }
15
+ @Test
16
+ public void test2() {
17
+ assertEquals(2, medianOfUniquenessArray(Arrays.asList(3,4,3,4,5)));
18
+ }
19
+ @Test
20
+ public void test3() {
21
+ assertEquals(2, medianOfUniquenessArray(Arrays.asList(4,3,5,4)));
22
+ }
23
+
24
+ }
find_the_median_of_the_uniqueness_array/meta.json ADDED
The diff for this file is too large to render. See raw diff
 
find_the_median_of_the_uniqueness_array/ocaml_tests/main.ml ADDED
The diff for this file is too large to render. See raw diff
 
find_the_median_of_the_uniqueness_array/scala_tests/MySuite.scala ADDED
The diff for this file is too large to render. See raw diff
 
find_the_minimum_amount_of_time_to_brew_potions/haskell_tests/Main.hs ADDED
The diff for this file is too large to render. See raw diff
 
find_the_minimum_amount_of_time_to_brew_potions/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(110, minTime(new ArrayList<>(Arrays.asList(1,5,2,4)), new ArrayList<>(Arrays.asList(5,1,4,2))));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals(5, minTime(new ArrayList<>(Arrays.asList(1,1,1)), new ArrayList<>(Arrays.asList(1,1,1))));
19
+ }
20
+ @Test
21
+ public void test3() {
22
+ assertEquals(21, minTime(new ArrayList<>(Arrays.asList(1,2,3,4)), new ArrayList<>(Arrays.asList(1,2))));
23
+ }
24
+
25
+ }
find_the_minimum_amount_of_time_to_brew_potions/meta.json ADDED
The diff for this file is too large to render. See raw diff
 
find_the_minimum_amount_of_time_to_brew_potions/ocaml_tests/main.ml ADDED
The diff for this file is too large to render. See raw diff
 
find_the_minimum_amount_of_time_to_brew_potions/scala_tests/MySuite.scala ADDED
The diff for this file is too large to render. See raw diff
 
find_the_minimum_area_to_cover_all_ones_i/haskell_tests/Main.hs ADDED
The diff for this file is too large to render. See raw diff
 
find_the_minimum_area_to_cover_all_ones_i/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, minimumArea(Arrays.asList(Arrays.asList(0,1,0),Arrays.asList(1,0,1))));
14
+ }
15
+ @Test
16
+ public void test2() {
17
+ assertEquals(1, minimumArea(Arrays.asList(Arrays.asList(1,0),Arrays.asList(0,0))));
18
+ }
19
+
20
+ }
find_the_minimum_area_to_cover_all_ones_i/meta.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d331ccdec3e7facb01bce21b17862c4bb5fceb3d71bfb1c7b1f56482cdbc4fa8
3
+ size 35032695
find_the_minimum_area_to_cover_all_ones_i/ocaml_tests/main.ml ADDED
The diff for this file is too large to render. See raw diff
 
find_the_minimum_area_to_cover_all_ones_i/scala_tests/MySuite.scala ADDED
The diff for this file is too large to render. See raw diff
 
find_the_minimum_area_to_cover_all_ones_ii/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(5, minimumSum(Arrays.asList(Arrays.asList(1,0,1),Arrays.asList(1,1,1))));
14
+ }
15
+ @Test
16
+ public void test2() {
17
+ assertEquals(5, minimumSum(Arrays.asList(Arrays.asList(1,0,1,0),Arrays.asList(0,1,0,1))));
18
+ }
19
+
20
+ }
find_the_minimum_cost_array_permutation/haskell_tests/Main.hs ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ module Main where
3
+ import Test.HUnit
4
+
5
+ --Program start
6
+ findPermutation :: [Int] -> [Int]
7
+ findPermutation nums = undefined
8
+
9
+ --Program end
10
+
11
+ -- Test cases
12
+
13
+ test1 :: Test
14
+ test1 = TestCase (assertEqual "for (findPermutation [1,0,2])," [0,1,2] (findPermutation [1,0,2]))
15
+
16
+ test2 :: Test
17
+ test2 = TestCase (assertEqual "for (findPermutation [0,2,1])," [0,2,1] (findPermutation [0,2,1]))
18
+
19
+ test3 :: Test
20
+ test3 = TestCase (assertEqual "for (findPermutation [3, 1, 2, 0])," [0,1,2,3] (findPermutation [3, 1, 2, 0]))
21
+
22
+ test4 :: Test
23
+ test4 = TestCase (assertEqual "for (findPermutation [1, 5, 6, 0, 2, 4, 3])," [0,3,6,2,4,5,1] (findPermutation [1, 5, 6, 0, 2, 4, 3]))
24
+
25
+ test5 :: Test
26
+ test5 = TestCase (assertEqual "for (findPermutation [2, 4, 6, 1, 7, 3, 0, 8, 5])," [0,3,5,8,7,4,1,6,2] (findPermutation [2, 4, 6, 1, 7, 3, 0, 8, 5]))
27
+
28
+ test6 :: Test
29
+ test6 = TestCase (assertEqual "for (findPermutation [0, 7, 1, 8, 5, 10, 9, 6, 4, 3, 2])," [0,2,10,5,4,8,3,9,6,7,1] (findPermutation [0, 7, 1, 8, 5, 10, 9, 6, 4, 3, 2]))
30
+
31
+ test7 :: Test
32
+ test7 = TestCase (assertEqual "for (findPermutation [2, 0, 1])," [0,1,2] (findPermutation [2, 0, 1]))
33
+
34
+ test8 :: Test
35
+ test8 = TestCase (assertEqual "for (findPermutation [4, 3, 1, 6, 5, 0, 2])," [0,2,6,3,1,5,4] (findPermutation [4, 3, 1, 6, 5, 0, 2]))
36
+
37
+ test9 :: Test
38
+ test9 = TestCase (assertEqual "for (findPermutation [0, 5, 6, 4, 7, 3, 1, 9, 2, 8])," [0,6,2,8,9,7,4,3,5,1] (findPermutation [0, 5, 6, 4, 7, 3, 1, 9, 2, 8]))
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
find_the_minimum_cost_array_permutation/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(0,1,2), findPermutation(Arrays.asList(1,0,2)));
14
+ }
15
+ @Test
16
+ public void test2() {
17
+ assertEquals(Arrays.asList(0,2,1), findPermutation(Arrays.asList(0,2,1)));
18
+ }
19
+
20
+ }
find_the_minimum_cost_array_permutation/meta.json ADDED
@@ -0,0 +1,227 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "id": 3431,
3
+ "name": "find_the_minimum_cost_array_permutation",
4
+ "difficulty": "Hard",
5
+ "link": "https://leetcode.com/problems/find-the-minimum-cost-array-permutation/",
6
+ "date": "2024-05-05 00:00:00",
7
+ "task_description": "You are given an array `nums` which is a permutation of `[0, 1, 2, ..., n - 1]`. The **score** of any permutation of `[0, 1, 2, ..., n - 1]` named `perm` is defined as: `score(perm) = |perm[0] - nums[perm[1]]| + |perm[1] - nums[perm[2]]| + ... + |perm[n - 1] - nums[perm[0]]|` Return the permutation `perm` which has the **minimum** possible score. If _multiple_ permutations exist with this score, return the one that is lexicographically smallest among them. **Example 1:** **Input:** nums = [1,0,2] **Output:** [0,1,2] **Explanation:** **** The lexicographically smallest permutation with minimum cost is `[0,1,2]`. The cost of this permutation is `|0 - 0| + |1 - 2| + |2 - 1| = 2`. **Example 2:** **Input:** nums = [0,2,1] **Output:** [0,2,1] **Explanation:** **** The lexicographically smallest permutation with minimum cost is `[0,2,1]`. The cost of this permutation is `|0 - 1| + |2 - 2| + |1 - 0| = 2`. **Constraints:** `2 <= n == nums.length <= 14` `nums` is a permutation of `[0, 1, 2, ..., n - 1]`.",
8
+ "public_test_cases": [
9
+ {
10
+ "label": "Example 1",
11
+ "input": "nums = [1,0,2]",
12
+ "output": "[0,1,2] "
13
+ },
14
+ {
15
+ "label": "Example 2",
16
+ "input": "nums = [0,2,1]",
17
+ "output": "[0,2,1] "
18
+ }
19
+ ],
20
+ "private_test_cases": [
21
+ {
22
+ "input": [
23
+ 3,
24
+ 1,
25
+ 2,
26
+ 0
27
+ ],
28
+ "output": [
29
+ 0,
30
+ 1,
31
+ 2,
32
+ 3
33
+ ]
34
+ },
35
+ {
36
+ "input": [
37
+ 1,
38
+ 5,
39
+ 6,
40
+ 0,
41
+ 2,
42
+ 4,
43
+ 3
44
+ ],
45
+ "output": [
46
+ 0,
47
+ 3,
48
+ 6,
49
+ 2,
50
+ 4,
51
+ 5,
52
+ 1
53
+ ]
54
+ },
55
+ {
56
+ "input": [
57
+ 2,
58
+ 4,
59
+ 6,
60
+ 1,
61
+ 7,
62
+ 3,
63
+ 0,
64
+ 8,
65
+ 5
66
+ ],
67
+ "output": [
68
+ 0,
69
+ 3,
70
+ 5,
71
+ 8,
72
+ 7,
73
+ 4,
74
+ 1,
75
+ 6,
76
+ 2
77
+ ]
78
+ },
79
+ {
80
+ "input": [
81
+ 0,
82
+ 7,
83
+ 1,
84
+ 8,
85
+ 5,
86
+ 10,
87
+ 9,
88
+ 6,
89
+ 4,
90
+ 3,
91
+ 2
92
+ ],
93
+ "output": [
94
+ 0,
95
+ 2,
96
+ 10,
97
+ 5,
98
+ 4,
99
+ 8,
100
+ 3,
101
+ 9,
102
+ 6,
103
+ 7,
104
+ 1
105
+ ]
106
+ },
107
+ {
108
+ "input": [
109
+ 2,
110
+ 0,
111
+ 1
112
+ ],
113
+ "output": [
114
+ 0,
115
+ 1,
116
+ 2
117
+ ]
118
+ },
119
+ {
120
+ "input": [
121
+ 4,
122
+ 3,
123
+ 1,
124
+ 6,
125
+ 5,
126
+ 0,
127
+ 2
128
+ ],
129
+ "output": [
130
+ 0,
131
+ 2,
132
+ 6,
133
+ 3,
134
+ 1,
135
+ 5,
136
+ 4
137
+ ]
138
+ },
139
+ {
140
+ "input": [
141
+ 0,
142
+ 5,
143
+ 6,
144
+ 4,
145
+ 7,
146
+ 3,
147
+ 1,
148
+ 9,
149
+ 2,
150
+ 8
151
+ ],
152
+ "output": [
153
+ 0,
154
+ 6,
155
+ 2,
156
+ 8,
157
+ 9,
158
+ 7,
159
+ 4,
160
+ 3,
161
+ 5,
162
+ 1
163
+ ]
164
+ },
165
+ {
166
+ "input": [
167
+ 13,
168
+ 0,
169
+ 9,
170
+ 1,
171
+ 3,
172
+ 4,
173
+ 2,
174
+ 12,
175
+ 6,
176
+ 10,
177
+ 11,
178
+ 8,
179
+ 5,
180
+ 7
181
+ ],
182
+ "output": [
183
+ 0,
184
+ 1,
185
+ 3,
186
+ 4,
187
+ 5,
188
+ 8,
189
+ 11,
190
+ 10,
191
+ 9,
192
+ 2,
193
+ 6,
194
+ 12,
195
+ 7,
196
+ 13
197
+ ]
198
+ },
199
+ {
200
+ "input": [
201
+ 0,
202
+ 1
203
+ ],
204
+ "output": [
205
+ 0,
206
+ 1
207
+ ]
208
+ },
209
+ {
210
+ "input": [
211
+ 1,
212
+ 2,
213
+ 0
214
+ ],
215
+ "output": [
216
+ 0,
217
+ 2,
218
+ 1
219
+ ]
220
+ }
221
+ ],
222
+ "haskell_template": "findPermutation :: [Int] -> [Int]\nfindPermutation nums ",
223
+ "ocaml_template": "let findPermutation (nums: int list) : int list = ",
224
+ "scala_template": "def findPermutation(nums: List[Int]): List[Int] = { \n \n}",
225
+ "java_template": "class Solution {\n public int[] findPermutation(int[] nums) {\n \n }\n}",
226
+ "python_template": "class Solution(object):\n def findPermutation(self, nums):\n \"\"\"\n :type nums: List[int]\n :rtype: List[int]\n \"\"\"\n "
227
+ }
find_the_minimum_cost_array_permutation/ocaml_tests/main.ml ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ module Main = struct
3
+ open OUnit2
4
+
5
+ (* Program start *)
6
+ let findPermutation (nums: int list) : int list = failwith "Not implemented"
7
+
8
+ (* Program end *)
9
+
10
+ (* Test cases *)
11
+
12
+ let test1 _ = assert_equal [0;1;2] (findPermutation [1;0;2])
13
+
14
+ let test2 _ = assert_equal [0;2;1] (findPermutation [0;2;1])
15
+
16
+ let test3 _ = assert_equal [0;2;1] (findPermutation [3; 1; 2; 0])
17
+
18
+ let test4 _ = assert_equal [0;2;1] (findPermutation [1; 5; 6; 0; 2; 4; 3])
19
+
20
+ let test5 _ = assert_equal [0;2;1] (findPermutation [2; 4; 6; 1; 7; 3; 0; 8; 5])
21
+
22
+ let test6 _ = assert_equal [0;2;1] (findPermutation [0; 7; 1; 8; 5; 10; 9; 6; 4; 3; 2])
23
+
24
+ let test7 _ = assert_equal [0;2;1] (findPermutation [2; 0; 1])
25
+
26
+ let test8 _ = assert_equal [0;2;1] (findPermutation [4; 3; 1; 6; 5; 0; 2])
27
+
28
+ let test9 _ = assert_equal [0;2;1] (findPermutation [0; 5; 6; 4; 7; 3; 1; 9; 2; 8])
29
+
30
+ let test10 _ = assert_equal [0;2;1] (findPermutation [13; 0; 9; 1; 3; 4; 2; 12; 6; 10; 11; 8; 5; 7])
31
+
32
+
33
+ (* Grouping test cases *)
34
+ let suite = "Test Suite for findPermutation" >::: [
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
find_the_minimum_cost_array_permutation/scala_tests/MySuite.scala ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ class MySuite extends munit.FunSuite {
3
+
4
+ test("test1") {
5
+ assertEquals(Main.findPermutation(List(1,0,2)), List(0,1,2))
6
+ }
7
+
8
+ test("test2") {
9
+ assertEquals(Main.findPermutation(List(0,2,1)), List(0,2,1))
10
+ }
11
+
12
+ test("test3") {
13
+ assertEquals(Main.findPermutation(3,1,2,0), List(0,1,2,3))
14
+ }
15
+
16
+ test("test4") {
17
+ assertEquals(Main.findPermutation(1,5,6,0,2,4,3), List(0,3,6,2,4,5,1))
18
+ }
19
+
20
+ test("test5") {
21
+ assertEquals(Main.findPermutation(2,4,6,1,7,3,0,8,5), List(0,3,5,8,7,4,1,6,2))
22
+ }
23
+
24
+ test("test6") {
25
+ assertEquals(Main.findPermutation(0,7,1,8,5,10,9,6,4,3,2), List(0,2,10,5,4,8,3,9,6,7,1))
26
+ }
27
+
28
+ test("test7") {
29
+ assertEquals(Main.findPermutation(2,0,1), List(0,1,2))
30
+ }
31
+
32
+ test("test8") {
33
+ assertEquals(Main.findPermutation(4,3,1,6,5,0,2), List(0,2,6,3,1,5,4))
34
+ }
35
+
36
+ test("test9") {
37
+ assertEquals(Main.findPermutation(0,5,6,4,7,3,1,9,2,8), List(0,6,2,8,9,7,4,3,5,1))
38
+ }
39
+
40
+ test("test10") {
41
+ assertEquals(Main.findPermutation(13,0,9,1,3,4,2,12,6,10,11,8,5,7), List(0,1,3,4,5,8,11,10,9,2,6,12,7,13))
42
+ }
43
+
44
+ }
find_the_minimum_possible_sum_of_a_beautiful_array/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 (minimumPossibleSum 2 3)," 4 (minimumPossibleSum 2 3))
13
+
14
+ test2 :: Test
15
+ test2 = TestCase (assertEqual "for (minimumPossibleSum 3 3)," 8 (minimumPossibleSum 3 3))
16
+
17
+ test3 :: Test
18
+ test3 = TestCase (assertEqual "for (minimumPossibleSum 1 1)," 1 (minimumPossibleSum 1 1))
19
+
20
+ test4 :: Test
21
+ test4 = TestCase (assertEqual "for (minimumPossibleSum 2 78)," 3 (minimumPossibleSum 2 78))
22
+
23
+ test5 :: Test
24
+ test5 = TestCase (assertEqual "for (minimumPossibleSum 34 17)," 803 (minimumPossibleSum 34 17))
25
+
26
+ test6 :: Test
27
+ test6 = TestCase (assertEqual "for (minimumPossibleSum 64 80)," 3016 (minimumPossibleSum 64 80))
28
+
29
+ test7 :: Test
30
+ test7 = TestCase (assertEqual "for (minimumPossibleSum 61 38)," 2647 (minimumPossibleSum 61 38))
31
+
32
+ test8 :: Test
33
+ test8 = TestCase (assertEqual "for (minimumPossibleSum 71 45)," 3634 (minimumPossibleSum 71 45))
34
+
35
+ test9 :: Test
36
+ test9 = TestCase (assertEqual "for (minimumPossibleSum 49 49)," 1825 (minimumPossibleSum 49 49))
37
+
38
+
39
+ -- Grouping test cases
40
+ tests :: Test
41
+ tests = TestList [TestLabel "Test1" test1, TestLabel "Test2" test2, TestLabel "Test3" test3, TestLabel "Test4" test4, TestLabel "Test5" test5, TestLabel "Test6" test6, TestLabel "Test7" test7, TestLabel "Test8" test8, TestLabel "Test9" test9]
42
+
43
+ -- Running the tests
44
+ main :: IO Counts
45
+ main = runTestTT tests
find_the_minimum_possible_sum_of_a_beautiful_array/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, minimumPossibleSum(2, 3));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals(8, minimumPossibleSum(3, 3));
19
+ }
20
+ @Test
21
+ public void test3() {
22
+ assertEquals(1, minimumPossibleSum(1, 1));
23
+ }
24
+
25
+ }
find_the_minimum_possible_sum_of_a_beautiful_array/meta.json ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "id": 3026,
3
+ "name": "find_the_minimum_possible_sum_of_a_beautiful_array",
4
+ "difficulty": "Medium",
5
+ "link": "https://leetcode.com/problems/find-the-minimum-possible-sum-of-a-beautiful-array/",
6
+ "date": "2023-08-20 00:00:00",
7
+ "task_description": "You are given positive integers `n` and `target`. An array `nums` is **beautiful** if it meets the following conditions: `nums.length == n`. `nums` consists of pairwise **distinct** **positive** integers. There doesn't exist two **distinct** indices, `i` and `j`, in the range `[0, n - 1]`, such that `nums[i] + nums[j] == target`. Return _the **minimum** possible sum that a beautiful array could have modulo _`109 + 7`. **Example 1:** ``` **Input:** n = 2, target = 3 **Output:** 4 **Explanation:** We can see that nums = [1,3] is beautiful. - The array nums has length n = 2. - The array nums consists of pairwise distinct positive integers. - There doesn't exist two distinct indices, i and j, with nums[i] + nums[j] == 3. It can be proven that 4 is the minimum possible sum that a beautiful array could have. ``` **Example 2:** ``` **Input:** n = 3, target = 3 **Output:** 8 **Explanation:** We can see that nums = [1,3,4] is beautiful. - The array nums has length n = 3. - The array nums consists of pairwise distinct positive integers. - There doesn't exist two distinct indices, i and j, with nums[i] + nums[j] == 3. It can be proven that 8 is the minimum possible sum that a beautiful array could have. ``` **Example 3:** ``` **Input:** n = 1, target = 1 **Output:** 1 **Explanation:** We can see, that nums = [1] is beautiful. ``` **Constraints:** `1 <= n <= 109` `1 <= target <= 109`",
8
+ "public_test_cases": [
9
+ {
10
+ "label": "Example 1",
11
+ "input": "n = 2, target = 3",
12
+ "output": "4 "
13
+ },
14
+ {
15
+ "label": "Example 2",
16
+ "input": "n = 3, target = 3",
17
+ "output": "8 "
18
+ },
19
+ {
20
+ "label": "Example 3",
21
+ "input": "n = 1, target = 1",
22
+ "output": "1 "
23
+ }
24
+ ],
25
+ "private_test_cases": [
26
+ {
27
+ "input": [
28
+ 2,
29
+ 78
30
+ ],
31
+ "output": 3
32
+ },
33
+ {
34
+ "input": [
35
+ 34,
36
+ 17
37
+ ],
38
+ "output": 803
39
+ },
40
+ {
41
+ "input": [
42
+ 64,
43
+ 80
44
+ ],
45
+ "output": 3016
46
+ },
47
+ {
48
+ "input": [
49
+ 61,
50
+ 38
51
+ ],
52
+ "output": 2647
53
+ },
54
+ {
55
+ "input": [
56
+ 71,
57
+ 45
58
+ ],
59
+ "output": 3634
60
+ },
61
+ {
62
+ "input": [
63
+ 49,
64
+ 49
65
+ ],
66
+ "output": 1825
67
+ },
68
+ {
69
+ "input": [
70
+ 16,
71
+ 8
72
+ ],
73
+ "output": 172
74
+ },
75
+ {
76
+ "input": [
77
+ 2,
78
+ 15
79
+ ],
80
+ "output": 3
81
+ },
82
+ {
83
+ "input": [
84
+ 20,
85
+ 28
86
+ ],
87
+ "output": 288
88
+ },
89
+ {
90
+ "input": [
91
+ 54,
92
+ 79
93
+ ],
94
+ "output": 2070
95
+ }
96
+ ],
97
+ "haskell_template": "minimumPossibleSum :: Int -> Int -> Int\nminimumPossibleSum n target ",
98
+ "ocaml_template": "let minimumPossibleSum (n: int) (target: int) : int = ",
99
+ "scala_template": "def minimumPossibleSum(n: Int,target: Int): Int = { \n \n}",
100
+ "java_template": "class Solution {\n public int minimumPossibleSum(int n, int target) {\n \n }\n}",
101
+ "python_template": "class Solution(object):\n def minimumPossibleSum(self, n, target):\n \"\"\"\n :type n: int\n :type target: int\n :rtype: int\n \"\"\"\n "
102
+ }
find_the_minimum_possible_sum_of_a_beautiful_array/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 (minimumPossibleSum 2 3)
12
+
13
+ let test2 _ = assert_equal 8 (minimumPossibleSum 3 3)
14
+
15
+ let test3 _ = assert_equal 1 (minimumPossibleSum 1 1)
16
+
17
+ let test4 _ = assert_equal 3 (minimumPossibleSum 2 78)
18
+
19
+ let test5 _ = assert_equal 803 (minimumPossibleSum 34 17)
20
+
21
+ let test6 _ = assert_equal 3016 (minimumPossibleSum 64 80)
22
+
23
+ let test7 _ = assert_equal 2647 (minimumPossibleSum 61 38)
24
+
25
+ let test8 _ = assert_equal 3634 (minimumPossibleSum 71 45)
26
+
27
+ let test9 _ = assert_equal 1825 (minimumPossibleSum 49 49)
28
+
29
+ let test10 _ = assert_equal 172 (minimumPossibleSum 16 8)
30
+
31
+
32
+ (* Grouping test cases *)
33
+ let suite = "Test Suite for minimumPossibleSum" >::: [
34
+
35
+ "test1" >:: test1;
36
+ "test2" >:: test2;
37
+ "test3" >:: test3;
38
+ "test4" >:: test4;
39
+ "test5" >:: test5;
40
+ "test6" >:: test6;
41
+ "test7" >:: test7;
42
+ "test8" >:: test8;
43
+ "test9" >:: test9;
44
+ "test10" >:: test10;
45
+ ]
46
+
47
+
48
+ (* Running the tests *)
49
+ let () = run_test_tt_main suite
50
+ end
find_the_minimum_possible_sum_of_a_beautiful_array/scala_tests/MySuite.scala ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ class MySuite extends munit.FunSuite {
3
+
4
+ test("test1") {
5
+ assertEquals(Main.minimumPossibleSum(2,3), 4)
6
+ }
7
+
8
+ test("test2") {
9
+ assertEquals(Main.minimumPossibleSum(3,3), 8)
10
+ }
11
+
12
+ test("test3") {
13
+ assertEquals(Main.minimumPossibleSum(1,1), 1)
14
+ }
15
+
16
+ test("test4") {
17
+ assertEquals(Main.minimumPossibleSum(2,78), 3)
18
+ }
19
+
20
+ test("test5") {
21
+ assertEquals(Main.minimumPossibleSum(34,17), 803)
22
+ }
23
+
24
+ test("test6") {
25
+ assertEquals(Main.minimumPossibleSum(64,80), 3016)
26
+ }
27
+
28
+ test("test7") {
29
+ assertEquals(Main.minimumPossibleSum(61,38), 2647)
30
+ }
31
+
32
+ test("test8") {
33
+ assertEquals(Main.minimumPossibleSum(71,45), 3634)
34
+ }
35
+
36
+ test("test9") {
37
+ assertEquals(Main.minimumPossibleSum(49,49), 1825)
38
+ }
39
+
40
+ test("test10") {
41
+ assertEquals(Main.minimumPossibleSum(16,8), 172)
42
+ }
43
+
44
+ }
find_the_n_th_value_after_k_seconds/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 (valueAfterKSeconds 4 5)," 56 (valueAfterKSeconds 4 5))
13
+
14
+ test2 :: Test
15
+ test2 = TestCase (assertEqual "for (valueAfterKSeconds 5 3)," 35 (valueAfterKSeconds 5 3))
16
+
17
+ test3 :: Test
18
+ test3 = TestCase (assertEqual "for (valueAfterKSeconds 50 892)," 655579845 (valueAfterKSeconds 50 892))
19
+
20
+ test4 :: Test
21
+ test4 = TestCase (assertEqual "for (valueAfterKSeconds 746 509)," 204168458 (valueAfterKSeconds 746 509))
22
+
23
+ test5 :: Test
24
+ test5 = TestCase (assertEqual "for (valueAfterKSeconds 533 278)," 770777802 (valueAfterKSeconds 533 278))
25
+
26
+ test6 :: Test
27
+ test6 = TestCase (assertEqual "for (valueAfterKSeconds 321 501)," 363917171 (valueAfterKSeconds 321 501))
28
+
29
+ test7 :: Test
30
+ test7 = TestCase (assertEqual "for (valueAfterKSeconds 159 917)," 339759060 (valueAfterKSeconds 159 917))
31
+
32
+ test8 :: Test
33
+ test8 = TestCase (assertEqual "for (valueAfterKSeconds 444 985)," 288605470 (valueAfterKSeconds 444 985))
34
+
35
+ test9 :: Test
36
+ test9 = TestCase (assertEqual "for (valueAfterKSeconds 811 528)," 732839074 (valueAfterKSeconds 811 528))
37
+
38
+
39
+ -- Grouping test cases
40
+ tests :: Test
41
+ tests = TestList [TestLabel "Test1" test1, TestLabel "Test2" test2, TestLabel "Test3" test3, TestLabel "Test4" test4, TestLabel "Test5" test5, TestLabel "Test6" test6, TestLabel "Test7" test7, TestLabel "Test8" test8, TestLabel "Test9" test9]
42
+
43
+ -- Running the tests
44
+ main :: IO Counts
45
+ main = runTestTT tests
find_the_n_th_value_after_k_seconds/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(56, valueAfterKSeconds(4, 5));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals(35, valueAfterKSeconds(5, 3));
19
+ }
20
+
21
+ }
find_the_n_th_value_after_k_seconds/meta.json ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "id": 3422,
3
+ "name": "find_the_n_th_value_after_k_seconds",
4
+ "difficulty": "Medium",
5
+ "link": "https://leetcode.com/problems/find-the-n-th-value-after-k-seconds/",
6
+ "date": "2024-06-02 00:00:00",
7
+ "task_description": "You are given two integers `n` and `k`. Initially, you start with an array `a` of `n` integers where `a[i] = 1` for all `0 <= i <= n - 1`. After each second, you simultaneously update each element to be the sum of all its preceding elements plus the element itself. For example, after one second, `a[0]` remains the same, `a[1]` becomes `a[0] + a[1]`, `a[2]` becomes `a[0] + a[1] + a[2]`, and so on. Return the **value** of `a[n - 1]` after `k` seconds. Since the answer may be very large, return it **modulo** `109 + 7`. **Example 1:** **Input:** n = 4, k = 5 **Output:** 56 **Explanation:** Second State After 0 [1,1,1,1] 1 [1,2,3,4] 2 [1,3,6,10] 3 [1,4,10,20] 4 [1,5,15,35] 5 [1,6,21,56] **Example 2:** **Input:** n = 5, k = 3 **Output:** 35 **Explanation:** Second State After 0 [1,1,1,1,1] 1 [1,2,3,4,5] 2 [1,3,6,10,15] 3 [1,4,10,20,35] **Constraints:** `1 <= n, k <= 1000`",
8
+ "public_test_cases": [
9
+ {
10
+ "label": "Example 1",
11
+ "input": "n = 4, k = 5",
12
+ "output": "56 "
13
+ },
14
+ {
15
+ "label": "Example 2",
16
+ "input": "n = 5, k = 3",
17
+ "output": "35 "
18
+ }
19
+ ],
20
+ "private_test_cases": [
21
+ {
22
+ "input": [
23
+ 50,
24
+ 892
25
+ ],
26
+ "output": 655579845
27
+ },
28
+ {
29
+ "input": [
30
+ 746,
31
+ 509
32
+ ],
33
+ "output": 204168458
34
+ },
35
+ {
36
+ "input": [
37
+ 533,
38
+ 278
39
+ ],
40
+ "output": 770777802
41
+ },
42
+ {
43
+ "input": [
44
+ 321,
45
+ 501
46
+ ],
47
+ "output": 363917171
48
+ },
49
+ {
50
+ "input": [
51
+ 159,
52
+ 917
53
+ ],
54
+ "output": 339759060
55
+ },
56
+ {
57
+ "input": [
58
+ 444,
59
+ 985
60
+ ],
61
+ "output": 288605470
62
+ },
63
+ {
64
+ "input": [
65
+ 811,
66
+ 528
67
+ ],
68
+ "output": 732839074
69
+ },
70
+ {
71
+ "input": [
72
+ 319,
73
+ 686
74
+ ],
75
+ "output": 173238841
76
+ },
77
+ {
78
+ "input": [
79
+ 70,
80
+ 495
81
+ ],
82
+ "output": 973020380
83
+ },
84
+ {
85
+ "input": [
86
+ 689,
87
+ 511
88
+ ],
89
+ "output": 987502427
90
+ }
91
+ ],
92
+ "haskell_template": "valueAfterKSeconds :: Int -> Int -> Int\nvalueAfterKSeconds n k ",
93
+ "ocaml_template": "let valueAfterKSeconds (n: int) (k: int) : int = ",
94
+ "scala_template": "def valueAfterKSeconds(n: Int,k: Int): Int = { \n \n}",
95
+ "java_template": "class Solution {\n public int valueAfterKSeconds(int n, int k) {\n \n }\n}",
96
+ "python_template": "class Solution(object):\n def valueAfterKSeconds(self, n, k):\n \"\"\"\n :type n: int\n :type k: int\n :rtype: int\n \"\"\"\n "
97
+ }