DatasetRepo commited on
Commit
5aedd6d
·
verified ·
1 Parent(s): 6b25fe3

05933c668d5658b5e175e4051064b54d03d6bf588398d4a7465916791a668795

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +1 -0
  2. minimum_white_tiles_after_covering_with_carpets/.DS_Store +0 -0
  3. minimum_white_tiles_after_covering_with_carpets/haskell_tests/Main.hs +24 -0
  4. minimum_white_tiles_after_covering_with_carpets/java_tests/Main.java +21 -0
  5. minimum_white_tiles_after_covering_with_carpets/meta.json +107 -0
  6. minimum_white_tiles_after_covering_with_carpets/ocaml_tests/main.ml +26 -0
  7. minimum_white_tiles_after_covering_with_carpets/scala_tests/MySuite.scala +12 -0
  8. modify_graph_edge_weights/haskell_tests/Main.hs +0 -0
  9. modify_graph_edge_weights/java_tests/Main.java +25 -0
  10. modify_graph_edge_weights/meta.json +0 -0
  11. modify_graph_edge_weights/ocaml_tests/main.ml +0 -0
  12. modify_graph_edge_weights/scala_tests/MySuite.scala +0 -0
  13. modify_the_matrix/haskell_tests/Main.hs +41 -0
  14. modify_the_matrix/java_tests/Main.java +20 -0
  15. modify_the_matrix/meta.json +0 -0
  16. modify_the_matrix/ocaml_tests/main.ml +42 -0
  17. modify_the_matrix/scala_tests/MySuite.scala +32 -0
  18. most_frequent_even_element/.DS_Store +0 -0
  19. most_frequent_even_element/haskell_tests/Main.hs +27 -0
  20. most_frequent_even_element/java_tests/Main.java +25 -0
  21. most_frequent_even_element/meta.json +0 -0
  22. most_frequent_even_element/ocaml_tests/main.ml +29 -0
  23. most_frequent_even_element/scala_tests/MySuite.scala +16 -0
  24. most_frequent_ids/haskell_tests/Main.hs +45 -0
  25. most_frequent_ids/java_tests/Main.java +21 -0
  26. most_frequent_ids/meta.json +1699 -0
  27. most_frequent_ids/ocaml_tests/main.ml +50 -0
  28. most_frequent_ids/scala_tests/MySuite.scala +44 -0
  29. most_frequent_number_following_key_in_an_array/.DS_Store +0 -0
  30. most_frequent_number_following_key_in_an_array/haskell_tests/Main.hs +24 -0
  31. most_frequent_number_following_key_in_an_array/java_tests/Main.java +21 -0
  32. most_frequent_number_following_key_in_an_array/meta.json +0 -0
  33. most_frequent_number_following_key_in_an_array/ocaml_tests/main.ml +26 -0
  34. most_frequent_number_following_key_in_an_array/scala_tests/MySuite.scala +12 -0
  35. most_frequent_prime/haskell_tests/Main.hs +44 -0
  36. most_frequent_prime/java_tests/Main.java +24 -0
  37. most_frequent_prime/meta.json +146 -0
  38. most_frequent_prime/ocaml_tests/main.ml +45 -0
  39. most_frequent_prime/scala_tests/MySuite.scala +36 -0
  40. most_popular_video_creator/.DS_Store +0 -0
  41. most_popular_video_creator/haskell_tests/Main.hs +24 -0
  42. most_popular_video_creator/java_tests/Main.java +21 -0
  43. most_popular_video_creator/meta.json +3 -0
  44. most_popular_video_creator/ocaml_tests/main.ml +26 -0
  45. most_popular_video_creator/scala_tests/MySuite.scala +12 -0
  46. most_profitable_path_in_a_tree/.DS_Store +0 -0
  47. most_profitable_path_in_a_tree/haskell_tests/Main.hs +24 -0
  48. most_profitable_path_in_a_tree/java_tests/Main.java +21 -0
  49. most_profitable_path_in_a_tree/meta.json +2792 -0
  50. most_profitable_path_in_a_tree/ocaml_tests/main.ml +26 -0
.gitattributes CHANGED
@@ -248,3 +248,4 @@ minimum_time_to_complete_trips/meta.json filter=lfs diff=lfs merge=lfs -text
248
  minimum_time_to_finish_the_race/meta.json filter=lfs diff=lfs merge=lfs -text
249
  minimum_time_to_repair_cars/meta.json filter=lfs diff=lfs merge=lfs -text
250
  minimum_total_cost_to_make_arrays_unequal/meta.json filter=lfs diff=lfs merge=lfs -text
 
 
248
  minimum_time_to_finish_the_race/meta.json filter=lfs diff=lfs merge=lfs -text
249
  minimum_time_to_repair_cars/meta.json filter=lfs diff=lfs merge=lfs -text
250
  minimum_total_cost_to_make_arrays_unequal/meta.json filter=lfs diff=lfs merge=lfs -text
251
+ most_popular_video_creator/meta.json filter=lfs diff=lfs merge=lfs -text
minimum_white_tiles_after_covering_with_carpets/.DS_Store ADDED
Binary file (6.15 kB). View file
 
minimum_white_tiles_after_covering_with_carpets/haskell_tests/Main.hs ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ module Main where
3
+ import Test.HUnit
4
+
5
+ --Program start
6
+
7
+ --Program end
8
+
9
+ -- Test cases
10
+
11
+ test1 :: Test
12
+ test1 = TestCase (assertEqual "for (minimumWhiteTiles \"10110101 \" 2 2)," 2 (minimumWhiteTiles "10110101" 2 2))
13
+
14
+ test2 :: Test
15
+ test2 = TestCase (assertEqual "for (minimumWhiteTiles \"11111 \" 2 3)," 0 (minimumWhiteTiles "11111" 2 3))
16
+
17
+
18
+ -- Grouping test cases
19
+ tests :: Test
20
+ tests = TestList [TestLabel "Test1" test1]
21
+
22
+ -- Running the tests
23
+ main :: IO Counts
24
+ main = runTestTT tests
minimum_white_tiles_after_covering_with_carpets/java_tests/Main.java ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import static org.junit.jupiter.api.Assertions.*;
3
+ import org.junit.jupiter.api.Test;
4
+ import java.util.List;
5
+ import java.util.Arrays;
6
+ import java.util.ArrayList;
7
+ public class Main {
8
+ //Program start
9
+
10
+ //Program end
11
+
12
+ @Test
13
+ public void test1() {
14
+ assertEquals(2, minimumWhiteTiles("10110101", 2, 2));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals(0, minimumWhiteTiles("11111", 2, 3));
19
+ }
20
+
21
+ }
minimum_white_tiles_after_covering_with_carpets/meta.json ADDED
@@ -0,0 +1,107 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "id": 2311,
3
+ "name": "minimum_white_tiles_after_covering_with_carpets",
4
+ "difficulty": "Hard",
5
+ "link": "https://leetcode.com/problems/minimum-white-tiles-after-covering-with-carpets/",
6
+ "date": "1646438400000",
7
+ "task_description": "You are given a **0-indexed binary** string `floor`, which represents the colors of tiles on a floor: `floor[i] = '0'` denotes that the `ith` tile of the floor is colored **black**. On the other hand, `floor[i] = '1'` denotes that the `ith` tile of the floor is colored **white**. You are also given `numCarpets` and `carpetLen`. You have `numCarpets` **black** carpets, each of length `carpetLen` tiles. Cover the tiles with the given carpets such that the number of **white** tiles still visible is **minimum**. Carpets may overlap one another. Return _the **minimum** number of white tiles still visible._ **Example 1:** ``` **Input:** floor = \"10110101\", numCarpets = 2, carpetLen = 2 **Output:** 2 **Explanation:** The figure above shows one way of covering the tiles with the carpets such that only 2 white tiles are visible. No other way of covering the tiles with the carpets can leave less than 2 white tiles visible. ``` **Example 2:** ``` **Input:** floor = \"11111\", numCarpets = 2, carpetLen = 3 **Output:** 0 **Explanation:** The figure above shows one way of covering the tiles with the carpets such that no white tiles are visible. Note that the carpets are able to overlap one another. ``` **Constraints:** `1 <= carpetLen <= floor.length <= 1000` `floor[i]` is either `'0'` or `'1'`. `1 <= numCarpets <= 1000`",
8
+ "public_test_cases": [
9
+ {
10
+ "label": "Example 1",
11
+ "input": "floor = \"10110101\", numCarpets = 2, carpetLen = 2",
12
+ "output": "2 "
13
+ },
14
+ {
15
+ "label": "Example 2",
16
+ "input": "floor = \"11111\", numCarpets = 2, carpetLen = 3",
17
+ "output": "0 "
18
+ }
19
+ ],
20
+ "private_test_cases": [
21
+ {
22
+ "input": [
23
+ "\"100101111111101000110001101001011001001010011110100110001101000011001000011001000001100001111111101011010111111000000011011001111101001110000101001011000001111011100010010110100101110001000111001110100110000011011000011011010111001110010001100001110111111010110011010001101000011111010001010100100100101111110111110100010010111010101000000111000000110000111110100000111100100111111110000101000110101111010010011011100110000011111000000010000010111111111100000100011000110011011011000001100101011111010001110000100111100111010101001101100101011011010001101011001111110011001101000110010100111111110000001010100000010110101001000100010101110010001110111100100011010000100100100111000011001110001000100100100111011100100011001100100100110000110001110111101100001110001111101001001100011100101101100001100110100110010110111110010011001111011110010100110011100010101111001011100010010010110101001101011000100111101100011010000\"",
24
+ 783,
25
+ 489
26
+ ],
27
+ "output": 0
28
+ },
29
+ {
30
+ "input": [
31
+ "\"01100100000000001110101111010110010010100001100101110110011110100110110110101100111000110100000111110000010100110010111001010100000100111010001101110011100000010101010100100010010011010111000011000010001100100101111100010111010111101011001011010100110101100100011011010101100100011111100010111010101110111000100110100101001110111111110101110011011011110010011000110111100111010010010101110010110000000111110\"",
32
+ 309,
33
+ 201
34
+ ],
35
+ "output": 0
36
+ },
37
+ {
38
+ "input": [
39
+ "\"011000001001001000010111110110100111000001110101100001010111010101000011011111010100011011011111101111001001000000000111111000100101011101100010011010100010010101011000100000011111010110011100011011011101011010001100111010000\"",
40
+ 361,
41
+ 167
42
+ ],
43
+ "output": 0
44
+ },
45
+ {
46
+ "input": [
47
+ "\"0110001011001001110110100011000101000001101111001101001100111010011101101100010111001001001111110010111100001000101011011110000001100101001111001001111011011011101100110010111010110111111000011110000110\"",
48
+ 915,
49
+ 18
50
+ ],
51
+ "output": 0
52
+ },
53
+ {
54
+ "input": [
55
+ "\"111110100000101001011011111101010110100011110101010001101010001001110101001101010011000010000110010111000100110111011011100101000010100001011011010111001010110100001011111000101011111111000001110110010101010010101101101111011000011110011111100111111111011101110101000010001100100110011010101000110000010010110001101111100000110000000001111001101010011110010111111001011000010001011011100100101100110000010010111011\"",
56
+ 890,
57
+ 69
58
+ ],
59
+ "output": 0
60
+ },
61
+ {
62
+ "input": [
63
+ "\"11100100001101100110111001001001000101001111000101000110110010111101111011101111100111100101100010010010101\"",
64
+ 964,
65
+ 71
66
+ ],
67
+ "output": 0
68
+ },
69
+ {
70
+ "input": [
71
+ "\"00110111110111001010110011001101011000100110110011010100010000000110111011111111001001110000001111010000110011111100110010101100010000011010100100101010001101111111110010010001000000001110001000011010011001100100010100010011010000111100001111110111011011011110111\"",
72
+ 182,
73
+ 122
74
+ ],
75
+ "output": 0
76
+ },
77
+ {
78
+ "input": [
79
+ "10011101010101110100110101010101110100010100011000011001000111010010011000101110010001101010100010001010110110101100011011111011000010000111101110010101000010010100101000111111111010101110010011100101101101110111111000001001111001100000011011100001010011011001111000011100010000100011010001100000100001000100111010001000001011001110001100001011001010101100111011111001011111111011111001001010111001011000001100101100001111011111010111111110101111110100111101111010101111111001001100111001111010110111111010000101000001111101001011011011010000110011010110000011100111101101010101001011100111100001110011100111010001000101011101011011011100000111011011101010000101010011010010001011100100111011000001001101011010101000000001101110000000010",
80
+ 572,
81
+ 574
82
+ ],
83
+ "output": 0
84
+ },
85
+ {
86
+ "input": [
87
+ "00011000100110001010110001000000001101100101100001",
88
+ 903,
89
+ 38
90
+ ],
91
+ "output": 0
92
+ },
93
+ {
94
+ "input": [
95
+ "10100000001100011001110100010111100100010101110000011011111100010110110111110100000010001010001001100111010000100000100000000011000111100001110010100011111100011101111110101101000000011100110110001100111011100100110010000000100011000011110000011100101110101110001111010011000110110000100100100011101110010001010111100011101101000100000100000010100011001010100111110010011111110111010000000010110011101110001010000000100111000000010011101110110001011001010100110111011101110011000000000010001100000011000110101011001110001111000011100101011101100001110010110110101011000100000000",
96
+ 417,
97
+ 517
98
+ ],
99
+ "output": 0
100
+ }
101
+ ],
102
+ "haskell_template": "minimumWhiteTiles :: String -> Int -> Int -> Int\nminimumWhiteTiles floor numCarpets carpetLen ",
103
+ "ocaml_template": "let minimumWhiteTiles (floor: string) (numCarpets: int) (carpetLen: int) : int = ",
104
+ "scala_template": "def minimumWhiteTiles(floor: String,numCarpets: Int,carpetLen: Int): Int = { \n \n}",
105
+ "java_template": "public static int minimumWhiteTiles(String floor, int numCarpets, int carpetLen) {\n\n}",
106
+ "python_template": "class Solution(object):\n def minimumWhiteTiles(self, floor, numCarpets, carpetLen):\n \"\"\"\n :type floor: str\n :type numCarpets: int\n :type carpetLen: int\n :rtype: int\n \"\"\"\n "
107
+ }
minimum_white_tiles_after_covering_with_carpets/ocaml_tests/main.ml ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ module Main = struct
3
+ open OUnit2
4
+
5
+ (* Program start *)
6
+
7
+ (* Program end *)
8
+
9
+ (* Test cases *)
10
+
11
+ let test1 _ = assert_equal 2 (minimumWhiteTiles "10110101" 2 2)
12
+
13
+ let test2 _ = assert_equal 0 (minimumWhiteTiles "11111" 2 3)
14
+
15
+
16
+ (* Grouping test cases *)
17
+ let suite = "Test Suite for minimumWhiteTiles" >::: [
18
+
19
+ "test1" >:: test1;
20
+ "test2" >:: test2;
21
+ ]
22
+
23
+
24
+ (* Running the tests *)
25
+ let () = run_test_tt_main suite
26
+ end
minimum_white_tiles_after_covering_with_carpets/scala_tests/MySuite.scala ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ class MySuite extends munit.FunSuite {
3
+
4
+ test("test1") {
5
+ assertEquals(Main.minimumWhiteTiles("10110101",2,2), 2)
6
+ }
7
+
8
+ test("test2") {
9
+ assertEquals(Main.minimumWhiteTiles("11111",2,3), 0)
10
+ }
11
+
12
+ }
modify_graph_edge_weights/haskell_tests/Main.hs ADDED
The diff for this file is too large to render. See raw diff
 
modify_graph_edge_weights/java_tests/Main.java ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import static org.junit.jupiter.api.Assertions.*;
3
+ import org.junit.jupiter.api.Test;
4
+ import java.util.List;
5
+ import java.util.Arrays;
6
+ import java.util.ArrayList;
7
+ public class Main {
8
+ //Program start
9
+
10
+ //Program end
11
+
12
+ @Test
13
+ public void test1() {
14
+ assertEquals(new ArrayList<>(Arrays.asList(new ArrayList<>(Arrays.asList(4,1,1)),new ArrayList<>(Arrays.asList(2,0,1)),new ArrayList<>(Arrays.asList(0,3,3)),new ArrayList<>(Arrays.asList(4,3,1)))), modifiedGraphEdges(5, new ArrayList<>(Arrays.asList(new ArrayList<>(Arrays.asList(4,1,-1)),new ArrayList<>(Arrays.asList(2,0,-1)),new ArrayList<>(Arrays.asList(0,3,-1)),new ArrayList<>(Arrays.asList(4,3,-1)))), 0, 1, 5));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals(new ArrayList<>(), modifiedGraphEdges(3, new ArrayList<>(Arrays.asList(new ArrayList<>(Arrays.asList(0,1,-1)),new ArrayList<>(Arrays.asList(0,2,5)))), 0, 2, 6));
19
+ }
20
+ @Test
21
+ public void test3() {
22
+ assertEquals(new ArrayList<>(Arrays.asList(new ArrayList<>(Arrays.asList(1,0,4)),new ArrayList<>(Arrays.asList(1,2,3)),new ArrayList<>(Arrays.asList(2,3,5)),new ArrayList<>(Arrays.asList(0,3,1)))), modifiedGraphEdges(4, new ArrayList<>(Arrays.asList(new ArrayList<>(Arrays.asList(1,0,4)),new ArrayList<>(Arrays.asList(1,2,3)),new ArrayList<>(Arrays.asList(2,3,5)),new ArrayList<>(Arrays.asList(0,3,-1)))), 0, 2, 6));
23
+ }
24
+
25
+ }
modify_graph_edge_weights/meta.json ADDED
The diff for this file is too large to render. See raw diff
 
modify_graph_edge_weights/ocaml_tests/main.ml ADDED
The diff for this file is too large to render. See raw diff
 
modify_graph_edge_weights/scala_tests/MySuite.scala ADDED
The diff for this file is too large to render. See raw diff
 
modify_the_matrix/haskell_tests/Main.hs ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ module Main where
3
+ import Test.HUnit
4
+
5
+ --Program start
6
+ modifiedMatrix :: [[Int]] -> [[Int]]
7
+ modifiedMatrix matrix = undefined
8
+
9
+ --Program end
10
+
11
+ -- Test cases
12
+
13
+ test1 :: Test
14
+ test1 = TestCase (assertEqual "for (modifiedMatrix [[1,2,-1],[4,-1,6],[7,8,9]])," [[1,2,9],[4,8,6],[7,8,9]] (modifiedMatrix [[1,2,-1],[4,-1,6],[7,8,9]]))
15
+
16
+ test2 :: Test
17
+ test2 = TestCase (assertEqual "for (modifiedMatrix [[3,-1],[5,2]])," [[3,2],[5,2]] (modifiedMatrix [[3,-1],[5,2]]))
18
+
19
+ test3 :: Test
20
+ test3 = TestCase (assertEqual "for (modifiedMatrix [[99, 89, 89, 70, 89, 100, 93, 97, 21, 89, 95, 70, 93, 93, 55, 23, 86, 77, 13, 100, 92, 99, 89, 34, 94, 94, 99, 98, 84, 10, 80, 35, 99, 99, 93, 95, 63, 78, 48, 60, 75, 94], [14, 89, 85, 100, 89, 1, 93, 64, 98, 89, 95, 100, 93, 100, 95, 29, 86, 31, 94, 100, 99, 13, 37, 93, 94, 94, 100, 98, 96, 83, 97, 65, 83, 99, 19, 95, 13, 99, 83, 53, 75, 55], [1, 89, 97, 100, 89, 100, 93, 30, 8, 45, 95, 100, 62, 100, 95, 90, 86, 90, 94, 91, 54, 99, 89, 93, 94, 94, 17, 77, 96, 1, 95, 95, 99, 43, 56, 95, 28, 73, 83, 92, 74, 26], [55, 66, 97, 8, 89, 34, 93, 56, 98, 89, 95, 100, 93, 100, 19, 90, 27, 45, 94, 100, 71, 20, 89, 93, 91, 94, 28, 98, 96, 83, 97, 85, 20, 13, 93, 95, 98, 38, 78, 92, 6, 94], [2, 82, 97, 100, 38, 100, 93, 32, 65, 89, 95, 76, 93, 44, 64, 35, 37, 21, 2, 100, 99, 31, 26, 57, 22, 94, 63, 36, 31, 83, 69, 27, 86, 58, 93, 64, 98, 99, 83, 92, 75, 94], [82, 89, 97, 0, 6, 16, 91, 97, 98, 89, 95, 100, 93, 28, 95, 30, 86, 90, 20, 22, 64, 57, 9, 80, 94, 26, 100, 86, 6, 83, 38, 74, 25, 33, 51, 63, 63, 63, 6, 92, 75, 94], [96, 56, 48, 56, 89, 16, 74, 97, 29, 63, 40, 36, 93, 100, 95, 34, 86, 55, 94, 61, 34, 47, 66, 93, 94, 94, 13, 98, 96, 83, 97, 95, 16, 99, 93, 16, 46, 99, 83, 92, 75, 58], [99, 89, 97, 97, 89, 100, 93, 97, 98, 89, 95, 100, 57, 100, 75, 90, 86, 52, 55, 100, 99, 85, 87, 29, 94, 94, 49, 98, 25, 83, 29, 14, 99, 42, 78, 54, 60, 46, 83, 70, 75, 94], [96, 89, 47, 55, 89, 100, 85, 97, 98, 89, 95, 100, 20, 65, 76, 90, 86, 90, 86, 100, 15, 99, 89, 2, 94, 94, 40, 60, 68, 83, 97, 5, 99, 99, 62, 95, 98, 99, 83, 6, 75, 60], [3, 89, 16, 100, 89, 84, 93, 97, 98, 89, 17, 100, 73, 100, 36, 90, 77, 8, 69, 100, 99, 69, 89, 93, 51, 79, 100, 98, 96, 83, 97, 82, 14, 28, 93, 11, 98, 51, 65, 92, 58, 94], [46, 89, 6, 100, 49, 64, 53, 97, 4, 88, 95, 100, 32, 100, 44, 90, 48, 19, 94, 100, 50, 53, 62, 22, 94, 13, 100, 32, 96, 83, 64, 95, 7, 86, 47, 72, 61, 99, 83, 92, 75, 84], [99, 89, 97, 100, 89, 75, 93, 97, 98, 51, 95, 100, 92, 94, 85, 89, 0, 90, 32, 70, 16, 7, 14, 55, 94, 38, 72, 78, 96, 83, 85, 5, 99, 42, 93, 8, 98, 99, 83, 8, 75, 2], [99, 26, 26, 87, 89, 100, 93, 97, 98, 89, 95, 51, 93, 100, 95, 31, 45, 65, 37, 100, 13, 58, 74, 93, 5, 94, 100, 4, 96, 6, 97, 21, 90, 51, 93, 88, 98, 99, 66, 92, 3, 94], [37, 45, 49, 100, 54, 100, 93, 59, 20, 89, 95, 6, 89, 100, 95, 90, 86, 90, 94, 14, 99, 99, 27, 93, 94, 94, 64, 67, 9, 83, 62, 65, 85, 20, 93, 95, 41, 11, 35, 72, 75, 94], [99, 89, 52, 100, 89, 100, 93, 97, 59, 89, 66, 100, 93, 100, 93, 90, 86, 42, 94, 32, 99, 34, 64, 24, 94, 22, 62, 65, 96, 22, 24, 95, 74, 99, 23, 95, 74, 99, 5, 55, 75, 75], [76, 76, 97, 29, 89, 1, 11, 72, 70, 65, 95, 90, 93, 100, 95, 90, 86, 90, 81, 7, 99, 99, 48, 42, 94, 18, 67, 98, 96, 83, 97, 95, 72, 54, 24, 95, 98, 99, 83, 92, 75, 15], [99, 89, 97, 100, 89, 100, 18, 64, 20, 16, 44, 46, 60, 90, 95, 3, 46, 83, 94, 64, 64, 80, 89, 32, 26, 94, 100, 64, 96, 48, 97, 27, 90, 99, 20, 95, 49, 99, 1, 92, 75, 36], [13, 89, 18, 100, 2, 57, 9, 1, 98, 89, 30, 100, 66, 100, 95, 90, 86, 5, 70, 100, 95, 8, 25, 93, 89, 94, 100, 73, 96, 83, 97, 4, 99, 99, 65, 9, 98, 10, 64, 92, 1, 25], [6, 89, 76, 100, 89, 100, 7, 40, 98, 89, 95, 56, 43, 63, 95, 90, 1, 0, 17, 76, 99, 83, 89, 93, 94, 94, 90, 98, 96, 9, 97, 95, 30, 99, 23, 95, 16, 99, 78, 23, 75, 94], [98, 18, 80, 100, 89, 100, 55, 97, 0, 89, 24, 43, 89, 18, 95, 90, 84, 90, 30, 41, 99, 64, 89, 78, 94, 70, 45, 59, 18, 83, 32, 95, 13, 99, 93, 95, 98, 99, 83, 78, 75, 64], [99, 71, 15, 100, 89, 79, 93, 73, 98, 89, 95, 20, 19, 96, 82, 61, 45, 31, 58, 63, 85, 34, 89, 74, 94, 94, 18, 98, 53, 63, 97, 95, 99, 99, 72, 28, 34, 23, 83, 14, 75, 94], [79, 89, 75, 100, 89, 3, 93, 97, 98, 89, 67, 100, 93, 0, 95, 90, 41, 76, 94, 100, 99, 94, 82, 93, 26, 43, 67, 53, 35, 83, 50, 64, 88, 50, 15, 95, 35, 27, 83, 55, 69, 94], [81, 89, 31, 91, 89, 100, 93, 97, 9, 89, 95, 100, 93, 100, 95, 90, 23, 90, 94, 100, 99, 74, 89, 93, 68, 49, 100, 23, 19, 83, 97, 95, 99, 24, 69, 95, 47, 99, 83, 92, 75, 81], [77, 89, 65, 100, 27, 45, 93, 40, 19, 89, 35, 100, 93, 100, 95, 90, 60, 90, 32, 52, 99, 99, 40, 93, 70, 28, 62, 98, 96, 40, 58, 95, 31, 99, 43, 95, 98, 5, 80, 92, 75, 94], [99, 89, 59, 54, 89, 7, 66, 54, 98, 89, 57, 100, 93, 100, 95, 15, 86, 90, 94, 100, 99, 41, 89, 90, 50, 55, 100, 94, 96, 67, 97, 61, 99, 32, 38, 95, 98, 56, 21, 92, 75, 13], [99, 21, 97, 100, 42, 100, 93, 97, 49, 3, 95, 100, 53, 93, 95, 77, 86, 3, 1, 100, 99, 99, 7, 93, 94, 94, 100, 53, 96, 83, 9, 95, 99, 58, 10, 95, 42, 99, 68, 67, 58, 94], [99, 25, 97, 100, 89, 2, 80, 97, 5, 45, 19, 66, 88, 100, 95, 65, 74, 90, 12, 62, 99, 99, 89, 93, 83, 94, 81, 15, 96, 83, 97, 8, 99, 99, 93, 53, 9, 99, 83, 92, 64, 83], [99, 57, 97, 100, 47, 100, 82, 97, 98, 89, 95, 58, 6, 81, 95, 90, 66, 90, 86, 16, 89, 39, 7, 93, 94, 5, 19, 7, 75, 83, 97, 95, 57, 99, 93, 38, 43, 96, 83, 52, 28, 94], [77, 59, 20, 100, 89, 100, 93, 97, 50, 89, 95, 4, 93, 41, 38, 76, 86, 30, 94, 100, 60, 84, 69, 93, 94, 94, 97, 74, 81, 83, 11, 95, 63, 44, 1, 95, 83, 99, 44, 57, 75, 94]])," [[99,89,89,70,89,100,93,97,21,89,95,70,93,93,55,23,86,77,13,100,92,99,89,34,94,94,99,98,84,10,80,35,99,99,93,95,63,78,48,60,75,94],[14,89,85,100,89,1,93,64,98,89,95,100,93,100,95,29,86,31,94,100,99,13,37,93,94,94,100,98,96,83,97,65,83,99,19,95,13,99,83,53,75,55],[1,89,97,100,89,100,93,30,8,45,95,100,62,100,95,90,86,90,94,91,54,99,89,93,94,94,17,77,96,1,95,95,99,43,56,95,28,73,83,92,74,26],[55,66,97,8,89,34,93,56,98,89,95,100,93,100,19,90,27,45,94,100,71,20,89,93,91,94,28,98,96,83,97,85,20,13,93,95,98,38,78,92,6,94],[2,82,97,100,38,100,93,32,65,89,95,76,93,44,64,35,37,21,2,100,99,31,26,57,22,94,63,36,31,83,69,27,86,58,93,64,98,99,83,92,75,94],[82,89,97,0,6,16,91,97,98,89,95,100,93,28,95,30,86,90,20,22,64,57,9,80,94,26,100,86,6,83,38,74,25,33,51,63,63,63,6,92,75,94],[96,56,48,56,89,16,74,97,29,63,40,36,93,100,95,34,86,55,94,61,34,47,66,93,94,94,13,98,96,83,97,95,16,99,93,16,46,99,83,92,75,58],[99,89,97,97,89,100,93,97,98,89,95,100,57,100,75,90,86,52,55,100,99,85,87,29,94,94,49,98,25,83,29,14,99,42,78,54,60,46,83,70,75,94],[96,89,47,55,89,100,85,97,98,89,95,100,20,65,76,90,86,90,86,100,15,99,89,2,94,94,40,60,68,83,97,5,99,99,62,95,98,99,83,6,75,60],[3,89,16,100,89,84,93,97,98,89,17,100,73,100,36,90,77,8,69,100,99,69,89,93,51,79,100,98,96,83,97,82,14,28,93,11,98,51,65,92,58,94],[46,89,6,100,49,64,53,97,4,88,95,100,32,100,44,90,48,19,94,100,50,53,62,22,94,13,100,32,96,83,64,95,7,86,47,72,61,99,83,92,75,84],[99,89,97,100,89,75,93,97,98,51,95,100,92,94,85,89,0,90,32,70,16,7,14,55,94,38,72,78,96,83,85,5,99,42,93,8,98,99,83,8,75,2],[99,26,26,87,89,100,93,97,98,89,95,51,93,100,95,31,45,65,37,100,13,58,74,93,5,94,100,4,96,6,97,21,90,51,93,88,98,99,66,92,3,94],[37,45,49,100,54,100,93,59,20,89,95,6,89,100,95,90,86,90,94,14,99,99,27,93,94,94,64,67,9,83,62,65,85,20,93,95,41,11,35,72,75,94],[99,89,52,100,89,100,93,97,59,89,66,100,93,100,93,90,86,42,94,32,99,34,64,24,94,22,62,65,96,22,24,95,74,99,23,95,74,99,5,55,75,75],[76,76,97,29,89,1,11,72,70,65,95,90,93,100,95,90,86,90,81,7,99,99,48,42,94,18,67,98,96,83,97,95,72,54,24,95,98,99,83,92,75,15],[99,89,97,100,89,100,18,64,20,16,44,46,60,90,95,3,46,83,94,64,64,80,89,32,26,94,100,64,96,48,97,27,90,99,20,95,49,99,1,92,75,36],[13,89,18,100,2,57,9,1,98,89,30,100,66,100,95,90,86,5,70,100,95,8,25,93,89,94,100,73,96,83,97,4,99,99,65,9,98,10,64,92,1,25],[6,89,76,100,89,100,7,40,98,89,95,56,43,63,95,90,1,0,17,76,99,83,89,93,94,94,90,98,96,9,97,95,30,99,23,95,16,99,78,23,75,94],[98,18,80,100,89,100,55,97,0,89,24,43,89,18,95,90,84,90,30,41,99,64,89,78,94,70,45,59,18,83,32,95,13,99,93,95,98,99,83,78,75,64],[99,71,15,100,89,79,93,73,98,89,95,20,19,96,82,61,45,31,58,63,85,34,89,74,94,94,18,98,53,63,97,95,99,99,72,28,34,23,83,14,75,94],[79,89,75,100,89,3,93,97,98,89,67,100,93,0,95,90,41,76,94,100,99,94,82,93,26,43,67,53,35,83,50,64,88,50,15,95,35,27,83,55,69,94],[81,89,31,91,89,100,93,97,9,89,95,100,93,100,95,90,23,90,94,100,99,74,89,93,68,49,100,23,19,83,97,95,99,24,69,95,47,99,83,92,75,81],[77,89,65,100,27,45,93,40,19,89,35,100,93,100,95,90,60,90,32,52,99,99,40,93,70,28,62,98,96,40,58,95,31,99,43,95,98,5,80,92,75,94],[99,89,59,54,89,7,66,54,98,89,57,100,93,100,95,15,86,90,94,100,99,41,89,90,50,55,100,94,96,67,97,61,99,32,38,95,98,56,21,92,75,13],[99,21,97,100,42,100,93,97,49,3,95,100,53,93,95,77,86,3,1,100,99,99,7,93,94,94,100,53,96,83,9,95,99,58,10,95,42,99,68,67,58,94],[99,25,97,100,89,2,80,97,5,45,19,66,88,100,95,65,74,90,12,62,99,99,89,93,83,94,81,15,96,83,97,8,99,99,93,53,9,99,83,92,64,83],[99,57,97,100,47,100,82,97,98,89,95,58,6,81,95,90,66,90,86,16,89,39,7,93,94,5,19,7,75,83,97,95,57,99,93,38,43,96,83,52,28,94],[77,59,20,100,89,100,93,97,50,89,95,4,93,41,38,76,86,30,94,100,60,84,69,93,94,94,97,74,81,83,11,95,63,44,1,95,83,99,44,57,75,94]] (modifiedMatrix [[99, 89, 89, 70, 89, 100, 93, 97, 21, 89, 95, 70, 93, 93, 55, 23, 86, 77, 13, 100, 92, 99, 89, 34, 94, 94, 99, 98, 84, 10, 80, 35, 99, 99, 93, 95, 63, 78, 48, 60, 75, 94], [14, 89, 85, 100, 89, 1, 93, 64, 98, 89, 95, 100, 93, 100, 95, 29, 86, 31, 94, 100, 99, 13, 37, 93, 94, 94, 100, 98, 96, 83, 97, 65, 83, 99, 19, 95, 13, 99, 83, 53, 75, 55], [1, 89, 97, 100, 89, 100, 93, 30, 8, 45, 95, 100, 62, 100, 95, 90, 86, 90, 94, 91, 54, 99, 89, 93, 94, 94, 17, 77, 96, 1, 95, 95, 99, 43, 56, 95, 28, 73, 83, 92, 74, 26], [55, 66, 97, 8, 89, 34, 93, 56, 98, 89, 95, 100, 93, 100, 19, 90, 27, 45, 94, 100, 71, 20, 89, 93, 91, 94, 28, 98, 96, 83, 97, 85, 20, 13, 93, 95, 98, 38, 78, 92, 6, 94], [2, 82, 97, 100, 38, 100, 93, 32, 65, 89, 95, 76, 93, 44, 64, 35, 37, 21, 2, 100, 99, 31, 26, 57, 22, 94, 63, 36, 31, 83, 69, 27, 86, 58, 93, 64, 98, 99, 83, 92, 75, 94], [82, 89, 97, 0, 6, 16, 91, 97, 98, 89, 95, 100, 93, 28, 95, 30, 86, 90, 20, 22, 64, 57, 9, 80, 94, 26, 100, 86, 6, 83, 38, 74, 25, 33, 51, 63, 63, 63, 6, 92, 75, 94], [96, 56, 48, 56, 89, 16, 74, 97, 29, 63, 40, 36, 93, 100, 95, 34, 86, 55, 94, 61, 34, 47, 66, 93, 94, 94, 13, 98, 96, 83, 97, 95, 16, 99, 93, 16, 46, 99, 83, 92, 75, 58], [99, 89, 97, 97, 89, 100, 93, 97, 98, 89, 95, 100, 57, 100, 75, 90, 86, 52, 55, 100, 99, 85, 87, 29, 94, 94, 49, 98, 25, 83, 29, 14, 99, 42, 78, 54, 60, 46, 83, 70, 75, 94], [96, 89, 47, 55, 89, 100, 85, 97, 98, 89, 95, 100, 20, 65, 76, 90, 86, 90, 86, 100, 15, 99, 89, 2, 94, 94, 40, 60, 68, 83, 97, 5, 99, 99, 62, 95, 98, 99, 83, 6, 75, 60], [3, 89, 16, 100, 89, 84, 93, 97, 98, 89, 17, 100, 73, 100, 36, 90, 77, 8, 69, 100, 99, 69, 89, 93, 51, 79, 100, 98, 96, 83, 97, 82, 14, 28, 93, 11, 98, 51, 65, 92, 58, 94], [46, 89, 6, 100, 49, 64, 53, 97, 4, 88, 95, 100, 32, 100, 44, 90, 48, 19, 94, 100, 50, 53, 62, 22, 94, 13, 100, 32, 96, 83, 64, 95, 7, 86, 47, 72, 61, 99, 83, 92, 75, 84], [99, 89, 97, 100, 89, 75, 93, 97, 98, 51, 95, 100, 92, 94, 85, 89, 0, 90, 32, 70, 16, 7, 14, 55, 94, 38, 72, 78, 96, 83, 85, 5, 99, 42, 93, 8, 98, 99, 83, 8, 75, 2], [99, 26, 26, 87, 89, 100, 93, 97, 98, 89, 95, 51, 93, 100, 95, 31, 45, 65, 37, 100, 13, 58, 74, 93, 5, 94, 100, 4, 96, 6, 97, 21, 90, 51, 93, 88, 98, 99, 66, 92, 3, 94], [37, 45, 49, 100, 54, 100, 93, 59, 20, 89, 95, 6, 89, 100, 95, 90, 86, 90, 94, 14, 99, 99, 27, 93, 94, 94, 64, 67, 9, 83, 62, 65, 85, 20, 93, 95, 41, 11, 35, 72, 75, 94], [99, 89, 52, 100, 89, 100, 93, 97, 59, 89, 66, 100, 93, 100, 93, 90, 86, 42, 94, 32, 99, 34, 64, 24, 94, 22, 62, 65, 96, 22, 24, 95, 74, 99, 23, 95, 74, 99, 5, 55, 75, 75], [76, 76, 97, 29, 89, 1, 11, 72, 70, 65, 95, 90, 93, 100, 95, 90, 86, 90, 81, 7, 99, 99, 48, 42, 94, 18, 67, 98, 96, 83, 97, 95, 72, 54, 24, 95, 98, 99, 83, 92, 75, 15], [99, 89, 97, 100, 89, 100, 18, 64, 20, 16, 44, 46, 60, 90, 95, 3, 46, 83, 94, 64, 64, 80, 89, 32, 26, 94, 100, 64, 96, 48, 97, 27, 90, 99, 20, 95, 49, 99, 1, 92, 75, 36], [13, 89, 18, 100, 2, 57, 9, 1, 98, 89, 30, 100, 66, 100, 95, 90, 86, 5, 70, 100, 95, 8, 25, 93, 89, 94, 100, 73, 96, 83, 97, 4, 99, 99, 65, 9, 98, 10, 64, 92, 1, 25], [6, 89, 76, 100, 89, 100, 7, 40, 98, 89, 95, 56, 43, 63, 95, 90, 1, 0, 17, 76, 99, 83, 89, 93, 94, 94, 90, 98, 96, 9, 97, 95, 30, 99, 23, 95, 16, 99, 78, 23, 75, 94], [98, 18, 80, 100, 89, 100, 55, 97, 0, 89, 24, 43, 89, 18, 95, 90, 84, 90, 30, 41, 99, 64, 89, 78, 94, 70, 45, 59, 18, 83, 32, 95, 13, 99, 93, 95, 98, 99, 83, 78, 75, 64], [99, 71, 15, 100, 89, 79, 93, 73, 98, 89, 95, 20, 19, 96, 82, 61, 45, 31, 58, 63, 85, 34, 89, 74, 94, 94, 18, 98, 53, 63, 97, 95, 99, 99, 72, 28, 34, 23, 83, 14, 75, 94], [79, 89, 75, 100, 89, 3, 93, 97, 98, 89, 67, 100, 93, 0, 95, 90, 41, 76, 94, 100, 99, 94, 82, 93, 26, 43, 67, 53, 35, 83, 50, 64, 88, 50, 15, 95, 35, 27, 83, 55, 69, 94], [81, 89, 31, 91, 89, 100, 93, 97, 9, 89, 95, 100, 93, 100, 95, 90, 23, 90, 94, 100, 99, 74, 89, 93, 68, 49, 100, 23, 19, 83, 97, 95, 99, 24, 69, 95, 47, 99, 83, 92, 75, 81], [77, 89, 65, 100, 27, 45, 93, 40, 19, 89, 35, 100, 93, 100, 95, 90, 60, 90, 32, 52, 99, 99, 40, 93, 70, 28, 62, 98, 96, 40, 58, 95, 31, 99, 43, 95, 98, 5, 80, 92, 75, 94], [99, 89, 59, 54, 89, 7, 66, 54, 98, 89, 57, 100, 93, 100, 95, 15, 86, 90, 94, 100, 99, 41, 89, 90, 50, 55, 100, 94, 96, 67, 97, 61, 99, 32, 38, 95, 98, 56, 21, 92, 75, 13], [99, 21, 97, 100, 42, 100, 93, 97, 49, 3, 95, 100, 53, 93, 95, 77, 86, 3, 1, 100, 99, 99, 7, 93, 94, 94, 100, 53, 96, 83, 9, 95, 99, 58, 10, 95, 42, 99, 68, 67, 58, 94], [99, 25, 97, 100, 89, 2, 80, 97, 5, 45, 19, 66, 88, 100, 95, 65, 74, 90, 12, 62, 99, 99, 89, 93, 83, 94, 81, 15, 96, 83, 97, 8, 99, 99, 93, 53, 9, 99, 83, 92, 64, 83], [99, 57, 97, 100, 47, 100, 82, 97, 98, 89, 95, 58, 6, 81, 95, 90, 66, 90, 86, 16, 89, 39, 7, 93, 94, 5, 19, 7, 75, 83, 97, 95, 57, 99, 93, 38, 43, 96, 83, 52, 28, 94], [77, 59, 20, 100, 89, 100, 93, 97, 50, 89, 95, 4, 93, 41, 38, 76, 86, 30, 94, 100, 60, 84, 69, 93, 94, 94, 97, 74, 81, 83, 11, 95, 63, 44, 1, 95, 83, 99, 44, 57, 75, 94]]))
21
+
22
+ test4 :: Test
23
+ test4 = TestCase (assertEqual "for (modifiedMatrix [[55, 64, 2, 93, 51, 52, 98, 39, 50, 25, 90, 72, 16, 84, 10, 5, 45, 55, 91, 67, 93, 84, 95, 99, 94, 88, 28, 100, 99], [98, 86, 100, 93, 96, 96, 98, 70, 80, 97, 69, 15, 94, 39, 53, 62, 98, 63, 29, 70, 84, 84, 95, 99, 94, 88, 41, 55, 99], [1, 86, 39, 93, 92, 96, 98, 40, 80, 96, 90, 53, 63, 84, 87, 82, 98, 40, 91, 65, 93, 52, 95, 99, 37, 7, 81, 39, 31], [55, 49, 100, 93, 96, 88, 69, 99, 80, 97, 90, 99, 69, 84, 87, 82, 98, 63, 30, 92, 80, 84, 18, 70, 6, 88, 92, 100, 99], [98, 86, 71, 93, 96, 96, 37, 53, 80, 72, 38, 99, 94, 59, 87, 0, 98, 9, 87, 75, 41, 47, 95, 28, 94, 88, 42, 18, 27], [98, 86, 21, 68, 61, 96, 98, 95, 31, 97, 90, 99, 75, 84, 87, 66, 54, 63, 91, 77, 42, 65, 3, 44, 21, 27, 92, 23, 99], [98, 86, 100, 44, 92, 33, 98, 99, 9, 47, 12, 23, 77, 84, 87, 82, 27, 31, 91, 92, 93, 15, 58, 99, 9, 88, 92, 90, 61], [15, 86, 100, 10, 77, 96, 52, 99, 80, 88, 75, 80, 48, 9, 48, 35, 98, 63, 91, 81, 60, 84, 95, 99, 18, 88, 85, 24, 20], [98, 86, 100, 93, 32, 96, 98, 40, 80, 53, 5, 99, 85, 84, 69, 82, 48, 63, 91, 92, 67, 13, 88, 44, 27, 8, 12, 100, 99], [98, 26, 14, 12, 96, 96, 58, 6, 80, 52, 90, 99, 94, 84, 87, 82, 98, 63, 91, 79, 93, 84, 95, 53, 30, 63, 37, 92, 27], [98, 86, 100, 22, 96, 96, 98, 43, 53, 44, 78, 73, 94, 84, 87, 82, 98, 3, 91, 28, 79, 79, 95, 99, 94, 88, 77, 53, 79], [73, 86, 52, 93, 96, 96, 44, 65, 80, 97, 58, 51, 94, 84, 14, 82, 98, 13, 39, 92, 38, 38, 82, 41, 93, 86, 23, 100, 50], [98, 86, 100, 93, 96, 96, 60, 99, 80, 97, 90, 99, 94, 84, 41, 82, 98, 54, 84, 67, 93, 84, 95, 99, 66, 88, 92, 100, 12], [98, 83, 22, 50, 30, 47, 98, 35, 29, 97, 90, 33, 94, 78, 87, 82, 98, 31, 91, 92, 39, 84, 25, 99, 88, 59, 92, 5, 99], [61, 11, 100, 93, 96, 96, 98, 21, 80, 97, 85, 17, 15, 4, 13, 82, 94, 30, 91, 0, 93, 56, 74, 73, 94, 88, 53, 46, 85], [98, 86, 23, 83, 96, 96, 43, 99, 80, 29, 90, 99, 94, 7, 75, 75, 30, 63, 91, 92, 93, 64, 92, 91, 94, 45, 14, 97, 99], [98, 68, 44, 63, 96, 67, 91, 99, 80, 60, 68, 99, 65, 84, 87, 82, 16, 63, 91, 46, 36, 7, 78, 99, 94, 63, 25, 100, 99], [1, 86, 100, 43, 94, 86, 63, 87, 0, 97, 77, 99, 75, 84, 87, 82, 98, 59, 44, 50, 29, 66, 95, 99, 94, 88, 62, 100, 58], [98, 37, 100, 66, 96, 96, 14, 99, 40, 97, 90, 99, 21, 34, 17, 82, 98, 63, 67, 92, 0, 51, 95, 99, 94, 61, 44, 100, 99]])," [[55,64,2,93,51,52,98,39,50,25,90,72,16,84,10,5,45,55,91,67,93,84,95,99,94,88,28,100,99],[98,86,100,93,96,96,98,70,80,97,69,15,94,39,53,62,98,63,29,70,84,84,95,99,94,88,41,55,99],[1,86,39,93,92,96,98,40,80,96,90,53,63,84,87,82,98,40,91,65,93,52,95,99,37,7,81,39,31],[55,49,100,93,96,88,69,99,80,97,90,99,69,84,87,82,98,63,30,92,80,84,18,70,6,88,92,100,99],[98,86,71,93,96,96,37,53,80,72,38,99,94,59,87,0,98,9,87,75,41,47,95,28,94,88,42,18,27],[98,86,21,68,61,96,98,95,31,97,90,99,75,84,87,66,54,63,91,77,42,65,3,44,21,27,92,23,99],[98,86,100,44,92,33,98,99,9,47,12,23,77,84,87,82,27,31,91,92,93,15,58,99,9,88,92,90,61],[15,86,100,10,77,96,52,99,80,88,75,80,48,9,48,35,98,63,91,81,60,84,95,99,18,88,85,24,20],[98,86,100,93,32,96,98,40,80,53,5,99,85,84,69,82,48,63,91,92,67,13,88,44,27,8,12,100,99],[98,26,14,12,96,96,58,6,80,52,90,99,94,84,87,82,98,63,91,79,93,84,95,53,30,63,37,92,27],[98,86,100,22,96,96,98,43,53,44,78,73,94,84,87,82,98,3,91,28,79,79,95,99,94,88,77,53,79],[73,86,52,93,96,96,44,65,80,97,58,51,94,84,14,82,98,13,39,92,38,38,82,41,93,86,23,100,50],[98,86,100,93,96,96,60,99,80,97,90,99,94,84,41,82,98,54,84,67,93,84,95,99,66,88,92,100,12],[98,83,22,50,30,47,98,35,29,97,90,33,94,78,87,82,98,31,91,92,39,84,25,99,88,59,92,5,99],[61,11,100,93,96,96,98,21,80,97,85,17,15,4,13,82,94,30,91,0,93,56,74,73,94,88,53,46,85],[98,86,23,83,96,96,43,99,80,29,90,99,94,7,75,75,30,63,91,92,93,64,92,91,94,45,14,97,99],[98,68,44,63,96,67,91,99,80,60,68,99,65,84,87,82,16,63,91,46,36,7,78,99,94,63,25,100,99],[1,86,100,43,94,86,63,87,0,97,77,99,75,84,87,82,98,59,44,50,29,66,95,99,94,88,62,100,58],[98,37,100,66,96,96,14,99,40,97,90,99,21,34,17,82,98,63,67,92,0,51,95,99,94,61,44,100,99]] (modifiedMatrix [[55, 64, 2, 93, 51, 52, 98, 39, 50, 25, 90, 72, 16, 84, 10, 5, 45, 55, 91, 67, 93, 84, 95, 99, 94, 88, 28, 100, 99], [98, 86, 100, 93, 96, 96, 98, 70, 80, 97, 69, 15, 94, 39, 53, 62, 98, 63, 29, 70, 84, 84, 95, 99, 94, 88, 41, 55, 99], [1, 86, 39, 93, 92, 96, 98, 40, 80, 96, 90, 53, 63, 84, 87, 82, 98, 40, 91, 65, 93, 52, 95, 99, 37, 7, 81, 39, 31], [55, 49, 100, 93, 96, 88, 69, 99, 80, 97, 90, 99, 69, 84, 87, 82, 98, 63, 30, 92, 80, 84, 18, 70, 6, 88, 92, 100, 99], [98, 86, 71, 93, 96, 96, 37, 53, 80, 72, 38, 99, 94, 59, 87, 0, 98, 9, 87, 75, 41, 47, 95, 28, 94, 88, 42, 18, 27], [98, 86, 21, 68, 61, 96, 98, 95, 31, 97, 90, 99, 75, 84, 87, 66, 54, 63, 91, 77, 42, 65, 3, 44, 21, 27, 92, 23, 99], [98, 86, 100, 44, 92, 33, 98, 99, 9, 47, 12, 23, 77, 84, 87, 82, 27, 31, 91, 92, 93, 15, 58, 99, 9, 88, 92, 90, 61], [15, 86, 100, 10, 77, 96, 52, 99, 80, 88, 75, 80, 48, 9, 48, 35, 98, 63, 91, 81, 60, 84, 95, 99, 18, 88, 85, 24, 20], [98, 86, 100, 93, 32, 96, 98, 40, 80, 53, 5, 99, 85, 84, 69, 82, 48, 63, 91, 92, 67, 13, 88, 44, 27, 8, 12, 100, 99], [98, 26, 14, 12, 96, 96, 58, 6, 80, 52, 90, 99, 94, 84, 87, 82, 98, 63, 91, 79, 93, 84, 95, 53, 30, 63, 37, 92, 27], [98, 86, 100, 22, 96, 96, 98, 43, 53, 44, 78, 73, 94, 84, 87, 82, 98, 3, 91, 28, 79, 79, 95, 99, 94, 88, 77, 53, 79], [73, 86, 52, 93, 96, 96, 44, 65, 80, 97, 58, 51, 94, 84, 14, 82, 98, 13, 39, 92, 38, 38, 82, 41, 93, 86, 23, 100, 50], [98, 86, 100, 93, 96, 96, 60, 99, 80, 97, 90, 99, 94, 84, 41, 82, 98, 54, 84, 67, 93, 84, 95, 99, 66, 88, 92, 100, 12], [98, 83, 22, 50, 30, 47, 98, 35, 29, 97, 90, 33, 94, 78, 87, 82, 98, 31, 91, 92, 39, 84, 25, 99, 88, 59, 92, 5, 99], [61, 11, 100, 93, 96, 96, 98, 21, 80, 97, 85, 17, 15, 4, 13, 82, 94, 30, 91, 0, 93, 56, 74, 73, 94, 88, 53, 46, 85], [98, 86, 23, 83, 96, 96, 43, 99, 80, 29, 90, 99, 94, 7, 75, 75, 30, 63, 91, 92, 93, 64, 92, 91, 94, 45, 14, 97, 99], [98, 68, 44, 63, 96, 67, 91, 99, 80, 60, 68, 99, 65, 84, 87, 82, 16, 63, 91, 46, 36, 7, 78, 99, 94, 63, 25, 100, 99], [1, 86, 100, 43, 94, 86, 63, 87, 0, 97, 77, 99, 75, 84, 87, 82, 98, 59, 44, 50, 29, 66, 95, 99, 94, 88, 62, 100, 58], [98, 37, 100, 66, 96, 96, 14, 99, 40, 97, 90, 99, 21, 34, 17, 82, 98, 63, 67, 92, 0, 51, 95, 99, 94, 61, 44, 100, 99]]))
24
+
25
+ test5 :: Test
26
+ test5 = TestCase (assertEqual "for (modifiedMatrix [[94, 97, 99, 15, 56, 10, 97, 58, 90, 73, 100, 89, 98, 9, 100, 72, 100, 91, 93, 41, 10, 89, 84, 88, 45, 100, 85, 40, 38, 78, 78, 64, 71, 33, 77, 45, 100, 100, 92, 13, 67, 97, 10, 53, 84], [94, 97, 99, 86, 13, 70, 97, 32, 90, 14, 51, 13, 8, 81, 11, 88, 100, 7, 93, 100, 26, 48, 84, 88, 62, 75, 29, 95, 92, 100, 78, 27, 71, 80, 77, 56, 81, 65, 92, 100, 27, 97, 86, 81, 84], [94, 40, 99, 89, 90, 90, 26, 79, 90, 33, 14, 89, 98, 81, 14, 88, 100, 91, 5, 56, 48, 89, 84, 88, 96, 100, 85, 42, 29, 87, 78, 85, 65, 62, 39, 56, 56, 37, 92, 9, 53, 31, 86, 67, 50], [94, 95, 29, 89, 90, 90, 62, 89, 67, 73, 71, 89, 98, 79, 7, 88, 100, 45, 72, 100, 65, 75, 84, 88, 96, 100, 85, 90, 20, 88, 73, 65, 69, 71, 77, 31, 100, 89, 92, 100, 67, 11, 48, 81, 5], [94, 70, 84, 5, 86, 73, 17, 89, 0, 23, 100, 77, 26, 81, 100, 88, 100, 32, 93, 92, 65, 89, 84, 75, 96, 84, 8, 24, 92, 100, 30, 11, 71, 15, 17, 56, 53, 54, 92, 100, 67, 68, 45, 56, 65], [22, 68, 99, 12, 17, 59, 97, 89, 25, 73, 100, 89, 34, 17, 81, 88, 100, 91, 76, 62, 64, 50, 84, 45, 80, 74, 47, 58, 24, 100, 78, 40, 1, 80, 77, 56, 100, 100, 92, 100, 51, 97, 32, 23, 24], [94, 45, 97, 89, 10, 90, 97, 89, 20, 55, 3, 65, 98, 81, 100, 7, 72, 42, 21, 68, 57, 8, 46, 84, 34, 36, 1, 95, 8, 78, 73, 6, 71, 68, 77, 26, 30, 98, 39, 63, 24, 97, 14, 81, 84], [83, 97, 13, 89, 90, 62, 97, 6, 90, 73, 100, 31, 98, 81, 100, 63, 45, 53, 30, 3, 65, 48, 59, 17, 96, 100, 81, 58, 92, 40, 78, 51, 71, 42, 77, 39, 100, 53, 29, 100, 16, 97, 86, 72, 24], [94, 32, 99, 89, 72, 90, 44, 89, 90, 73, 17, 89, 98, 81, 28, 88, 100, 91, 89, 18, 65, 54, 84, 88, 84, 100, 42, 34, 92, 73, 8, 62, 43, 8, 52, 56, 100, 72, 92, 100, 32, 97, 86, 81, 84], [64, 97, 77, 82, 75, 87, 97, 53, 90, 73, 100, 89, 26, 81, 9, 66, 17, 26, 33, 10, 65, 89, 6, 32, 56, 100, 46, 95, 92, 100, 78, 82, 71, 80, 77, 56, 100, 21, 92, 49, 0, 97, 86, 81, 84], [94, 97, 3, 24, 72, 39, 97, 89, 89, 73, 100, 89, 98, 70, 4, 88, 49, 91, 54, 14, 65, 50, 73, 86, 96, 88, 85, 95, 79, 20, 25, 85, 71, 80, 64, 56, 37, 34, 39, 100, 54, 57, 32, 81, 84], [94, 8, 42, 13, 78, 19, 59, 89, 5, 73, 100, 89, 98, 78, 100, 88, 12, 91, 45, 100, 65, 89, 84, 88, 28, 100, 4, 9, 92, 100, 78, 85, 39, 52, 77, 56, 100, 78, 22, 100, 67, 80, 86, 56, 84]])," [[94,97,99,15,56,10,97,58,90,73,100,89,98,9,100,72,100,91,93,41,10,89,84,88,45,100,85,40,38,78,78,64,71,33,77,45,100,100,92,13,67,97,10,53,84],[94,97,99,86,13,70,97,32,90,14,51,13,8,81,11,88,100,7,93,100,26,48,84,88,62,75,29,95,92,100,78,27,71,80,77,56,81,65,92,100,27,97,86,81,84],[94,40,99,89,90,90,26,79,90,33,14,89,98,81,14,88,100,91,5,56,48,89,84,88,96,100,85,42,29,87,78,85,65,62,39,56,56,37,92,9,53,31,86,67,50],[94,95,29,89,90,90,62,89,67,73,71,89,98,79,7,88,100,45,72,100,65,75,84,88,96,100,85,90,20,88,73,65,69,71,77,31,100,89,92,100,67,11,48,81,5],[94,70,84,5,86,73,17,89,0,23,100,77,26,81,100,88,100,32,93,92,65,89,84,75,96,84,8,24,92,100,30,11,71,15,17,56,53,54,92,100,67,68,45,56,65],[22,68,99,12,17,59,97,89,25,73,100,89,34,17,81,88,100,91,76,62,64,50,84,45,80,74,47,58,24,100,78,40,1,80,77,56,100,100,92,100,51,97,32,23,24],[94,45,97,89,10,90,97,89,20,55,3,65,98,81,100,7,72,42,21,68,57,8,46,84,34,36,1,95,8,78,73,6,71,68,77,26,30,98,39,63,24,97,14,81,84],[83,97,13,89,90,62,97,6,90,73,100,31,98,81,100,63,45,53,30,3,65,48,59,17,96,100,81,58,92,40,78,51,71,42,77,39,100,53,29,100,16,97,86,72,24],[94,32,99,89,72,90,44,89,90,73,17,89,98,81,28,88,100,91,89,18,65,54,84,88,84,100,42,34,92,73,8,62,43,8,52,56,100,72,92,100,32,97,86,81,84],[64,97,77,82,75,87,97,53,90,73,100,89,26,81,9,66,17,26,33,10,65,89,6,32,56,100,46,95,92,100,78,82,71,80,77,56,100,21,92,49,0,97,86,81,84],[94,97,3,24,72,39,97,89,89,73,100,89,98,70,4,88,49,91,54,14,65,50,73,86,96,88,85,95,79,20,25,85,71,80,64,56,37,34,39,100,54,57,32,81,84],[94,8,42,13,78,19,59,89,5,73,100,89,98,78,100,88,12,91,45,100,65,89,84,88,28,100,4,9,92,100,78,85,39,52,77,56,100,78,22,100,67,80,86,56,84]] (modifiedMatrix [[94, 97, 99, 15, 56, 10, 97, 58, 90, 73, 100, 89, 98, 9, 100, 72, 100, 91, 93, 41, 10, 89, 84, 88, 45, 100, 85, 40, 38, 78, 78, 64, 71, 33, 77, 45, 100, 100, 92, 13, 67, 97, 10, 53, 84], [94, 97, 99, 86, 13, 70, 97, 32, 90, 14, 51, 13, 8, 81, 11, 88, 100, 7, 93, 100, 26, 48, 84, 88, 62, 75, 29, 95, 92, 100, 78, 27, 71, 80, 77, 56, 81, 65, 92, 100, 27, 97, 86, 81, 84], [94, 40, 99, 89, 90, 90, 26, 79, 90, 33, 14, 89, 98, 81, 14, 88, 100, 91, 5, 56, 48, 89, 84, 88, 96, 100, 85, 42, 29, 87, 78, 85, 65, 62, 39, 56, 56, 37, 92, 9, 53, 31, 86, 67, 50], [94, 95, 29, 89, 90, 90, 62, 89, 67, 73, 71, 89, 98, 79, 7, 88, 100, 45, 72, 100, 65, 75, 84, 88, 96, 100, 85, 90, 20, 88, 73, 65, 69, 71, 77, 31, 100, 89, 92, 100, 67, 11, 48, 81, 5], [94, 70, 84, 5, 86, 73, 17, 89, 0, 23, 100, 77, 26, 81, 100, 88, 100, 32, 93, 92, 65, 89, 84, 75, 96, 84, 8, 24, 92, 100, 30, 11, 71, 15, 17, 56, 53, 54, 92, 100, 67, 68, 45, 56, 65], [22, 68, 99, 12, 17, 59, 97, 89, 25, 73, 100, 89, 34, 17, 81, 88, 100, 91, 76, 62, 64, 50, 84, 45, 80, 74, 47, 58, 24, 100, 78, 40, 1, 80, 77, 56, 100, 100, 92, 100, 51, 97, 32, 23, 24], [94, 45, 97, 89, 10, 90, 97, 89, 20, 55, 3, 65, 98, 81, 100, 7, 72, 42, 21, 68, 57, 8, 46, 84, 34, 36, 1, 95, 8, 78, 73, 6, 71, 68, 77, 26, 30, 98, 39, 63, 24, 97, 14, 81, 84], [83, 97, 13, 89, 90, 62, 97, 6, 90, 73, 100, 31, 98, 81, 100, 63, 45, 53, 30, 3, 65, 48, 59, 17, 96, 100, 81, 58, 92, 40, 78, 51, 71, 42, 77, 39, 100, 53, 29, 100, 16, 97, 86, 72, 24], [94, 32, 99, 89, 72, 90, 44, 89, 90, 73, 17, 89, 98, 81, 28, 88, 100, 91, 89, 18, 65, 54, 84, 88, 84, 100, 42, 34, 92, 73, 8, 62, 43, 8, 52, 56, 100, 72, 92, 100, 32, 97, 86, 81, 84], [64, 97, 77, 82, 75, 87, 97, 53, 90, 73, 100, 89, 26, 81, 9, 66, 17, 26, 33, 10, 65, 89, 6, 32, 56, 100, 46, 95, 92, 100, 78, 82, 71, 80, 77, 56, 100, 21, 92, 49, 0, 97, 86, 81, 84], [94, 97, 3, 24, 72, 39, 97, 89, 89, 73, 100, 89, 98, 70, 4, 88, 49, 91, 54, 14, 65, 50, 73, 86, 96, 88, 85, 95, 79, 20, 25, 85, 71, 80, 64, 56, 37, 34, 39, 100, 54, 57, 32, 81, 84], [94, 8, 42, 13, 78, 19, 59, 89, 5, 73, 100, 89, 98, 78, 100, 88, 12, 91, 45, 100, 65, 89, 84, 88, 28, 100, 4, 9, 92, 100, 78, 85, 39, 52, 77, 56, 100, 78, 22, 100, 67, 80, 86, 56, 84]]))
27
+
28
+ test6 :: Test
29
+ test6 = TestCase (assertEqual "for (modifiedMatrix [[95, 96, 19, 88, 100, 92, 98, 85, 18, 98, 71, 56, 88, 80, 100, 87, 31, 92, 75, 91, 65, 42, 84, 52, 81, 17, 22, 77, 73, 41], [73, 96, 99, 51, 85, 63, 67, 85, 53, 98, 71, 46, 100, 80, 35, 87, 93, 92, 24, 26, 52, 87, 36, 91, 100, 90, 97, 88, 85, 96], [68, 27, 62, 88, 25, 86, 98, 49, 45, 0, 35, 90, 100, 80, 100, 87, 58, 8, 54, 91, 98, 45, 18, 91, 100, 75, 66, 88, 7, 96], [95, 94, 99, 88, 100, 22, 98, 32, 100, 80, 50, 59, 100, 78, 100, 87, 83, 69, 100, 74, 98, 100, 38, 14, 41, 90, 97, 88, 85, 96], [95, 96, 80, 88, 100, 68, 98, 85, 100, 30, 26, 90, 100, 23, 100, 87, 93, 49, 18, 91, 98, 11, 84, 91, 60, 74, 97, 12, 77, 96], [95, 71, 79, 88, 58, 92, 98, 85, 100, 20, 64, 90, 100, 5, 58, 87, 93, 1, 100, 91, 98, 50, 84, 38, 58, 90, 97, 84, 85, 84], [95, 73, 99, 88, 36, 92, 98, 85, 51, 42, 31, 69, 68, 80, 100, 67, 93, 88, 100, 91, 13, 63, 46, 5, 100, 90, 97, 88, 37, 50], [23, 96, 99, 64, 100, 89, 98, 85, 100, 71, 19, 90, 100, 0, 73, 87, 93, 92, 37, 91, 98, 100, 84, 91, 57, 90, 30, 31, 65, 96], [52, 96, 87, 88, 14, 56, 76, 85, 100, 98, 71, 35, 100, 80, 100, 40, 89, 92, 100, 91, 98, 79, 84, 91, 14, 90, 5, 49, 85, 96], [16, 52, 99, 64, 100, 24, 53, 85, 87, 98, 71, 56, 11, 80, 81, 15, 93, 92, 100, 3, 12, 100, 84, 91, 78, 30, 31, 88, 45, 83], [34, 96, 77, 88, 98, 39, 98, 20, 100, 76, 71, 77, 100, 80, 100, 87, 30, 20, 55, 91, 63, 100, 84, 11, 22, 9, 97, 88, 85, 9], [1, 96, 99, 78, 100, 42, 98, 85, 77, 98, 3, 90, 100, 80, 71, 29, 61, 92, 15, 51, 98, 90, 17, 91, 100, 90, 97, 88, 85, 96], [95, 96, 99, 80, 6, 26, 98, 85, 22, 98, 42, 36, 24, 38, 44, 48, 55, 92, 74, 28, 98, 41, 6, 91, 100, 28, 24, 86, 85, 96], [95, 44, 99, 23, 100, 42, 90, 85, 100, 98, 61, 69, 100, 80, 85, 87, 93, 69, 43, 10, 98, 100, 63, 7, 62, 21, 97, 82, 20, 96], [20, 96, 72, 88, 100, 45, 45, 74, 58, 65, 25, 90, 77, 43, 82, 47, 65, 11, 100, 58, 98, 100, 37, 48, 87, 66, 97, 59, 59, 5], [95, 96, 99, 88, 100, 84, 27, 41, 20, 98, 71, 90, 82, 34, 44, 86, 86, 92, 100, 54, 98, 100, 84, 91, 69, 45, 23, 88, 34, 31], [95, 91, 99, 15, 100, 92, 98, 41, 100, 93, 65, 90, 14, 39, 69, 87, 93, 13, 77, 68, 77, 100, 66, 91, 94, 90, 27, 74, 85, 96], [95, 58, 99, 53, 3, 52, 21, 85, 100, 98, 71, 90, 100, 10, 100, 39, 21, 35, 94, 91, 98, 100, 55, 45, 100, 46, 97, 88, 85, 82], [75, 96, 95, 40, 8, 92, 69, 85, 100, 98, 36, 90, 100, 80, 100, 87, 63, 92, 100, 91, 98, 91, 84, 91, 100, 30, 97, 88, 85, 96], [95, 96, 71, 88, 88, 8, 98, 21, 18, 98, 71, 12, 76, 80, 19, 28, 93, 92, 48, 91, 90, 100, 75, 27, 100, 90, 97, 42, 9, 28], [95, 96, 17, 88, 100, 92, 98, 62, 100, 98, 8, 47, 63, 61, 100, 81, 93, 92, 67, 59, 98, 100, 84, 11, 65, 90, 97, 11, 85, 77]])," [[95,96,19,88,100,92,98,85,18,98,71,56,88,80,100,87,31,92,75,91,65,42,84,52,81,17,22,77,73,41],[73,96,99,51,85,63,67,85,53,98,71,46,100,80,35,87,93,92,24,26,52,87,36,91,100,90,97,88,85,96],[68,27,62,88,25,86,98,49,45,0,35,90,100,80,100,87,58,8,54,91,98,45,18,91,100,75,66,88,7,96],[95,94,99,88,100,22,98,32,100,80,50,59,100,78,100,87,83,69,100,74,98,100,38,14,41,90,97,88,85,96],[95,96,80,88,100,68,98,85,100,30,26,90,100,23,100,87,93,49,18,91,98,11,84,91,60,74,97,12,77,96],[95,71,79,88,58,92,98,85,100,20,64,90,100,5,58,87,93,1,100,91,98,50,84,38,58,90,97,84,85,84],[95,73,99,88,36,92,98,85,51,42,31,69,68,80,100,67,93,88,100,91,13,63,46,5,100,90,97,88,37,50],[23,96,99,64,100,89,98,85,100,71,19,90,100,0,73,87,93,92,37,91,98,100,84,91,57,90,30,31,65,96],[52,96,87,88,14,56,76,85,100,98,71,35,100,80,100,40,89,92,100,91,98,79,84,91,14,90,5,49,85,96],[16,52,99,64,100,24,53,85,87,98,71,56,11,80,81,15,93,92,100,3,12,100,84,91,78,30,31,88,45,83],[34,96,77,88,98,39,98,20,100,76,71,77,100,80,100,87,30,20,55,91,63,100,84,11,22,9,97,88,85,9],[1,96,99,78,100,42,98,85,77,98,3,90,100,80,71,29,61,92,15,51,98,90,17,91,100,90,97,88,85,96],[95,96,99,80,6,26,98,85,22,98,42,36,24,38,44,48,55,92,74,28,98,41,6,91,100,28,24,86,85,96],[95,44,99,23,100,42,90,85,100,98,61,69,100,80,85,87,93,69,43,10,98,100,63,7,62,21,97,82,20,96],[20,96,72,88,100,45,45,74,58,65,25,90,77,43,82,47,65,11,100,58,98,100,37,48,87,66,97,59,59,5],[95,96,99,88,100,84,27,41,20,98,71,90,82,34,44,86,86,92,100,54,98,100,84,91,69,45,23,88,34,31],[95,91,99,15,100,92,98,41,100,93,65,90,14,39,69,87,93,13,77,68,77,100,66,91,94,90,27,74,85,96],[95,58,99,53,3,52,21,85,100,98,71,90,100,10,100,39,21,35,94,91,98,100,55,45,100,46,97,88,85,82],[75,96,95,40,8,92,69,85,100,98,36,90,100,80,100,87,63,92,100,91,98,91,84,91,100,30,97,88,85,96],[95,96,71,88,88,8,98,21,18,98,71,12,76,80,19,28,93,92,48,91,90,100,75,27,100,90,97,42,9,28],[95,96,17,88,100,92,98,62,100,98,8,47,63,61,100,81,93,92,67,59,98,100,84,11,65,90,97,11,85,77]] (modifiedMatrix [[95, 96, 19, 88, 100, 92, 98, 85, 18, 98, 71, 56, 88, 80, 100, 87, 31, 92, 75, 91, 65, 42, 84, 52, 81, 17, 22, 77, 73, 41], [73, 96, 99, 51, 85, 63, 67, 85, 53, 98, 71, 46, 100, 80, 35, 87, 93, 92, 24, 26, 52, 87, 36, 91, 100, 90, 97, 88, 85, 96], [68, 27, 62, 88, 25, 86, 98, 49, 45, 0, 35, 90, 100, 80, 100, 87, 58, 8, 54, 91, 98, 45, 18, 91, 100, 75, 66, 88, 7, 96], [95, 94, 99, 88, 100, 22, 98, 32, 100, 80, 50, 59, 100, 78, 100, 87, 83, 69, 100, 74, 98, 100, 38, 14, 41, 90, 97, 88, 85, 96], [95, 96, 80, 88, 100, 68, 98, 85, 100, 30, 26, 90, 100, 23, 100, 87, 93, 49, 18, 91, 98, 11, 84, 91, 60, 74, 97, 12, 77, 96], [95, 71, 79, 88, 58, 92, 98, 85, 100, 20, 64, 90, 100, 5, 58, 87, 93, 1, 100, 91, 98, 50, 84, 38, 58, 90, 97, 84, 85, 84], [95, 73, 99, 88, 36, 92, 98, 85, 51, 42, 31, 69, 68, 80, 100, 67, 93, 88, 100, 91, 13, 63, 46, 5, 100, 90, 97, 88, 37, 50], [23, 96, 99, 64, 100, 89, 98, 85, 100, 71, 19, 90, 100, 0, 73, 87, 93, 92, 37, 91, 98, 100, 84, 91, 57, 90, 30, 31, 65, 96], [52, 96, 87, 88, 14, 56, 76, 85, 100, 98, 71, 35, 100, 80, 100, 40, 89, 92, 100, 91, 98, 79, 84, 91, 14, 90, 5, 49, 85, 96], [16, 52, 99, 64, 100, 24, 53, 85, 87, 98, 71, 56, 11, 80, 81, 15, 93, 92, 100, 3, 12, 100, 84, 91, 78, 30, 31, 88, 45, 83], [34, 96, 77, 88, 98, 39, 98, 20, 100, 76, 71, 77, 100, 80, 100, 87, 30, 20, 55, 91, 63, 100, 84, 11, 22, 9, 97, 88, 85, 9], [1, 96, 99, 78, 100, 42, 98, 85, 77, 98, 3, 90, 100, 80, 71, 29, 61, 92, 15, 51, 98, 90, 17, 91, 100, 90, 97, 88, 85, 96], [95, 96, 99, 80, 6, 26, 98, 85, 22, 98, 42, 36, 24, 38, 44, 48, 55, 92, 74, 28, 98, 41, 6, 91, 100, 28, 24, 86, 85, 96], [95, 44, 99, 23, 100, 42, 90, 85, 100, 98, 61, 69, 100, 80, 85, 87, 93, 69, 43, 10, 98, 100, 63, 7, 62, 21, 97, 82, 20, 96], [20, 96, 72, 88, 100, 45, 45, 74, 58, 65, 25, 90, 77, 43, 82, 47, 65, 11, 100, 58, 98, 100, 37, 48, 87, 66, 97, 59, 59, 5], [95, 96, 99, 88, 100, 84, 27, 41, 20, 98, 71, 90, 82, 34, 44, 86, 86, 92, 100, 54, 98, 100, 84, 91, 69, 45, 23, 88, 34, 31], [95, 91, 99, 15, 100, 92, 98, 41, 100, 93, 65, 90, 14, 39, 69, 87, 93, 13, 77, 68, 77, 100, 66, 91, 94, 90, 27, 74, 85, 96], [95, 58, 99, 53, 3, 52, 21, 85, 100, 98, 71, 90, 100, 10, 100, 39, 21, 35, 94, 91, 98, 100, 55, 45, 100, 46, 97, 88, 85, 82], [75, 96, 95, 40, 8, 92, 69, 85, 100, 98, 36, 90, 100, 80, 100, 87, 63, 92, 100, 91, 98, 91, 84, 91, 100, 30, 97, 88, 85, 96], [95, 96, 71, 88, 88, 8, 98, 21, 18, 98, 71, 12, 76, 80, 19, 28, 93, 92, 48, 91, 90, 100, 75, 27, 100, 90, 97, 42, 9, 28], [95, 96, 17, 88, 100, 92, 98, 62, 100, 98, 8, 47, 63, 61, 100, 81, 93, 92, 67, 59, 98, 100, 84, 11, 65, 90, 97, 11, 85, 77]]))
30
+
31
+ test7 :: Test
32
+ test7 = TestCase (assertEqual "for (modifiedMatrix [[60, 95, 0], [51, 67, 93], [99, 55, 93], [99, 97, 93], [99, 97, 93], [99, 4, 93], [99, 38, 78], [99, 97, 93], [99, 28, 93], [29, 97, 40], [99, 47, 55], [62, 59, 93], [67, 3, 8], [70, 44, 93], [99, 32, 93], [84, 97, 93], [99, 97, 40], [59, 54, 7], [11, 0, 93], [99, 48, 93], [17, 17, 93], [99, 97, 93], [99, 68, 39], [74, 97, 93], [99, 97, 23], [59, 21, 93], [99, 66, 93], [99, 97, 93], [71, 56, 20], [2, 17, 21], [99, 26, 93], [40, 26, 16], [80, 31, 56], [75, 97, 29], [32, 19, 93], [99, 97, 93], [99, 97, 14], [84, 97, 15], [28, 97, 93], [99, 97, 86]])," [[60,95,0],[51,67,93],[99,55,93],[99,97,93],[99,97,93],[99,4,93],[99,38,78],[99,97,93],[99,28,93],[29,97,40],[99,47,55],[62,59,93],[67,3,8],[70,44,93],[99,32,93],[84,97,93],[99,97,40],[59,54,7],[11,0,93],[99,48,93],[17,17,93],[99,97,93],[99,68,39],[74,97,93],[99,97,23],[59,21,93],[99,66,93],[99,97,93],[71,56,20],[2,17,21],[99,26,93],[40,26,16],[80,31,56],[75,97,29],[32,19,93],[99,97,93],[99,97,14],[84,97,15],[28,97,93],[99,97,86]] (modifiedMatrix [[60, 95, 0], [51, 67, 93], [99, 55, 93], [99, 97, 93], [99, 97, 93], [99, 4, 93], [99, 38, 78], [99, 97, 93], [99, 28, 93], [29, 97, 40], [99, 47, 55], [62, 59, 93], [67, 3, 8], [70, 44, 93], [99, 32, 93], [84, 97, 93], [99, 97, 40], [59, 54, 7], [11, 0, 93], [99, 48, 93], [17, 17, 93], [99, 97, 93], [99, 68, 39], [74, 97, 93], [99, 97, 23], [59, 21, 93], [99, 66, 93], [99, 97, 93], [71, 56, 20], [2, 17, 21], [99, 26, 93], [40, 26, 16], [80, 31, 56], [75, 97, 29], [32, 19, 93], [99, 97, 93], [99, 97, 14], [84, 97, 15], [28, 97, 93], [99, 97, 86]]))
33
+
34
+
35
+ -- Grouping test cases
36
+ tests :: Test
37
+ tests = TestList [TestLabel "Test1" test1, TestLabel "Test2" test2, TestLabel "Test3" test3, TestLabel "Test4" test4, TestLabel "Test5" test5, TestLabel "Test6" test6]
38
+
39
+ -- Running the tests
40
+ main :: IO Counts
41
+ main = runTestTT tests
modify_the_matrix/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(Arrays.asList(1,2,9),Arrays.asList(4,8,6),Arrays.asList(7,8,9)), modifiedMatrix(Arrays.asList(Arrays.asList(1,2,-1),Arrays.asList(4,-1,6),Arrays.asList(7,8,9))));
14
+ }
15
+ @Test
16
+ public void test2() {
17
+ assertEquals(Arrays.asList(Arrays.asList(3,2),Arrays.asList(5,2)), modifiedMatrix(Arrays.asList(Arrays.asList(3,-1),Arrays.asList(5,2))));
18
+ }
19
+
20
+ }
modify_the_matrix/meta.json ADDED
The diff for this file is too large to render. See raw diff
 
modify_the_matrix/ocaml_tests/main.ml ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ module Main = struct
3
+ open OUnit2
4
+
5
+ (* Program start *)
6
+ let modifiedMatrix (matrix: int list list) : int list list = failwith "Not implemented"
7
+
8
+ (* Program end *)
9
+
10
+ (* Test cases *)
11
+
12
+ let test1 _ = assert_equal [[1;2;9];[4;8;6];[7;8;9]] (modifiedMatrix [[1;2;-1];[4;-1;6];[7;8;9]])
13
+
14
+ let test2 _ = assert_equal [[3;2];[5;2]] (modifiedMatrix [[3;-1];[5;2]])
15
+
16
+ let test3 _ = assert_equal [[3;2];[5;2]] (modifiedMatrix [[99; 89; 89; 70; 89; 100; 93; 97; 21; 89; 95; 70; 93; 93; 55; 23; 86; 77; 13; 100; 92; 99; 89; 34; 94; 94; 99; 98; 84; 10; 80; 35; 99; 99; 93; 95; 63; 78; 48; 60; 75; 94]; [14; 89; 85; 100; 89; 1; 93; 64; 98; 89; 95; 100; 93; 100; 95; 29; 86; 31; 94; 100; 99; 13; 37; 93; 94; 94; 100; 98; 96; 83; 97; 65; 83; 99; 19; 95; 13; 99; 83; 53; 75; 55]; [1; 89; 97; 100; 89; 100; 93; 30; 8; 45; 95; 100; 62; 100; 95; 90; 86; 90; 94; 91; 54; 99; 89; 93; 94; 94; 17; 77; 96; 1; 95; 95; 99; 43; 56; 95; 28; 73; 83; 92; 74; 26]; [55; 66; 97; 8; 89; 34; 93; 56; 98; 89; 95; 100; 93; 100; 19; 90; 27; 45; 94; 100; 71; 20; 89; 93; 91; 94; 28; 98; 96; 83; 97; 85; 20; 13; 93; 95; 98; 38; 78; 92; 6; 94]; [2; 82; 97; 100; 38; 100; 93; 32; 65; 89; 95; 76; 93; 44; 64; 35; 37; 21; 2; 100; 99; 31; 26; 57; 22; 94; 63; 36; 31; 83; 69; 27; 86; 58; 93; 64; 98; 99; 83; 92; 75; 94]; [82; 89; 97; 0; 6; 16; 91; 97; 98; 89; 95; 100; 93; 28; 95; 30; 86; 90; 20; 22; 64; 57; 9; 80; 94; 26; 100; 86; 6; 83; 38; 74; 25; 33; 51; 63; 63; 63; 6; 92; 75; 94]; [96; 56; 48; 56; 89; 16; 74; 97; 29; 63; 40; 36; 93; 100; 95; 34; 86; 55; 94; 61; 34; 47; 66; 93; 94; 94; 13; 98; 96; 83; 97; 95; 16; 99; 93; 16; 46; 99; 83; 92; 75; 58]; [99; 89; 97; 97; 89; 100; 93; 97; 98; 89; 95; 100; 57; 100; 75; 90; 86; 52; 55; 100; 99; 85; 87; 29; 94; 94; 49; 98; 25; 83; 29; 14; 99; 42; 78; 54; 60; 46; 83; 70; 75; 94]; [96; 89; 47; 55; 89; 100; 85; 97; 98; 89; 95; 100; 20; 65; 76; 90; 86; 90; 86; 100; 15; 99; 89; 2; 94; 94; 40; 60; 68; 83; 97; 5; 99; 99; 62; 95; 98; 99; 83; 6; 75; 60]; [3; 89; 16; 100; 89; 84; 93; 97; 98; 89; 17; 100; 73; 100; 36; 90; 77; 8; 69; 100; 99; 69; 89; 93; 51; 79; 100; 98; 96; 83; 97; 82; 14; 28; 93; 11; 98; 51; 65; 92; 58; 94]; [46; 89; 6; 100; 49; 64; 53; 97; 4; 88; 95; 100; 32; 100; 44; 90; 48; 19; 94; 100; 50; 53; 62; 22; 94; 13; 100; 32; 96; 83; 64; 95; 7; 86; 47; 72; 61; 99; 83; 92; 75; 84]; [99; 89; 97; 100; 89; 75; 93; 97; 98; 51; 95; 100; 92; 94; 85; 89; 0; 90; 32; 70; 16; 7; 14; 55; 94; 38; 72; 78; 96; 83; 85; 5; 99; 42; 93; 8; 98; 99; 83; 8; 75; 2]; [99; 26; 26; 87; 89; 100; 93; 97; 98; 89; 95; 51; 93; 100; 95; 31; 45; 65; 37; 100; 13; 58; 74; 93; 5; 94; 100; 4; 96; 6; 97; 21; 90; 51; 93; 88; 98; 99; 66; 92; 3; 94]; [37; 45; 49; 100; 54; 100; 93; 59; 20; 89; 95; 6; 89; 100; 95; 90; 86; 90; 94; 14; 99; 99; 27; 93; 94; 94; 64; 67; 9; 83; 62; 65; 85; 20; 93; 95; 41; 11; 35; 72; 75; 94]; [99; 89; 52; 100; 89; 100; 93; 97; 59; 89; 66; 100; 93; 100; 93; 90; 86; 42; 94; 32; 99; 34; 64; 24; 94; 22; 62; 65; 96; 22; 24; 95; 74; 99; 23; 95; 74; 99; 5; 55; 75; 75]; [76; 76; 97; 29; 89; 1; 11; 72; 70; 65; 95; 90; 93; 100; 95; 90; 86; 90; 81; 7; 99; 99; 48; 42; 94; 18; 67; 98; 96; 83; 97; 95; 72; 54; 24; 95; 98; 99; 83; 92; 75; 15]; [99; 89; 97; 100; 89; 100; 18; 64; 20; 16; 44; 46; 60; 90; 95; 3; 46; 83; 94; 64; 64; 80; 89; 32; 26; 94; 100; 64; 96; 48; 97; 27; 90; 99; 20; 95; 49; 99; 1; 92; 75; 36]; [13; 89; 18; 100; 2; 57; 9; 1; 98; 89; 30; 100; 66; 100; 95; 90; 86; 5; 70; 100; 95; 8; 25; 93; 89; 94; 100; 73; 96; 83; 97; 4; 99; 99; 65; 9; 98; 10; 64; 92; 1; 25]; [6; 89; 76; 100; 89; 100; 7; 40; 98; 89; 95; 56; 43; 63; 95; 90; 1; 0; 17; 76; 99; 83; 89; 93; 94; 94; 90; 98; 96; 9; 97; 95; 30; 99; 23; 95; 16; 99; 78; 23; 75; 94]; [98; 18; 80; 100; 89; 100; 55; 97; 0; 89; 24; 43; 89; 18; 95; 90; 84; 90; 30; 41; 99; 64; 89; 78; 94; 70; 45; 59; 18; 83; 32; 95; 13; 99; 93; 95; 98; 99; 83; 78; 75; 64]; [99; 71; 15; 100; 89; 79; 93; 73; 98; 89; 95; 20; 19; 96; 82; 61; 45; 31; 58; 63; 85; 34; 89; 74; 94; 94; 18; 98; 53; 63; 97; 95; 99; 99; 72; 28; 34; 23; 83; 14; 75; 94]; [79; 89; 75; 100; 89; 3; 93; 97; 98; 89; 67; 100; 93; 0; 95; 90; 41; 76; 94; 100; 99; 94; 82; 93; 26; 43; 67; 53; 35; 83; 50; 64; 88; 50; 15; 95; 35; 27; 83; 55; 69; 94]; [81; 89; 31; 91; 89; 100; 93; 97; 9; 89; 95; 100; 93; 100; 95; 90; 23; 90; 94; 100; 99; 74; 89; 93; 68; 49; 100; 23; 19; 83; 97; 95; 99; 24; 69; 95; 47; 99; 83; 92; 75; 81]; [77; 89; 65; 100; 27; 45; 93; 40; 19; 89; 35; 100; 93; 100; 95; 90; 60; 90; 32; 52; 99; 99; 40; 93; 70; 28; 62; 98; 96; 40; 58; 95; 31; 99; 43; 95; 98; 5; 80; 92; 75; 94]; [99; 89; 59; 54; 89; 7; 66; 54; 98; 89; 57; 100; 93; 100; 95; 15; 86; 90; 94; 100; 99; 41; 89; 90; 50; 55; 100; 94; 96; 67; 97; 61; 99; 32; 38; 95; 98; 56; 21; 92; 75; 13]; [99; 21; 97; 100; 42; 100; 93; 97; 49; 3; 95; 100; 53; 93; 95; 77; 86; 3; 1; 100; 99; 99; 7; 93; 94; 94; 100; 53; 96; 83; 9; 95; 99; 58; 10; 95; 42; 99; 68; 67; 58; 94]; [99; 25; 97; 100; 89; 2; 80; 97; 5; 45; 19; 66; 88; 100; 95; 65; 74; 90; 12; 62; 99; 99; 89; 93; 83; 94; 81; 15; 96; 83; 97; 8; 99; 99; 93; 53; 9; 99; 83; 92; 64; 83]; [99; 57; 97; 100; 47; 100; 82; 97; 98; 89; 95; 58; 6; 81; 95; 90; 66; 90; 86; 16; 89; 39; 7; 93; 94; 5; 19; 7; 75; 83; 97; 95; 57; 99; 93; 38; 43; 96; 83; 52; 28; 94]; [77; 59; 20; 100; 89; 100; 93; 97; 50; 89; 95; 4; 93; 41; 38; 76; 86; 30; 94; 100; 60; 84; 69; 93; 94; 94; 97; 74; 81; 83; 11; 95; 63; 44; 1; 95; 83; 99; 44; 57; 75; 94]])
17
+
18
+ let test4 _ = assert_equal [[3;2];[5;2]] (modifiedMatrix [[55; 64; 2; 93; 51; 52; 98; 39; 50; 25; 90; 72; 16; 84; 10; 5; 45; 55; 91; 67; 93; 84; 95; 99; 94; 88; 28; 100; 99]; [98; 86; 100; 93; 96; 96; 98; 70; 80; 97; 69; 15; 94; 39; 53; 62; 98; 63; 29; 70; 84; 84; 95; 99; 94; 88; 41; 55; 99]; [1; 86; 39; 93; 92; 96; 98; 40; 80; 96; 90; 53; 63; 84; 87; 82; 98; 40; 91; 65; 93; 52; 95; 99; 37; 7; 81; 39; 31]; [55; 49; 100; 93; 96; 88; 69; 99; 80; 97; 90; 99; 69; 84; 87; 82; 98; 63; 30; 92; 80; 84; 18; 70; 6; 88; 92; 100; 99]; [98; 86; 71; 93; 96; 96; 37; 53; 80; 72; 38; 99; 94; 59; 87; 0; 98; 9; 87; 75; 41; 47; 95; 28; 94; 88; 42; 18; 27]; [98; 86; 21; 68; 61; 96; 98; 95; 31; 97; 90; 99; 75; 84; 87; 66; 54; 63; 91; 77; 42; 65; 3; 44; 21; 27; 92; 23; 99]; [98; 86; 100; 44; 92; 33; 98; 99; 9; 47; 12; 23; 77; 84; 87; 82; 27; 31; 91; 92; 93; 15; 58; 99; 9; 88; 92; 90; 61]; [15; 86; 100; 10; 77; 96; 52; 99; 80; 88; 75; 80; 48; 9; 48; 35; 98; 63; 91; 81; 60; 84; 95; 99; 18; 88; 85; 24; 20]; [98; 86; 100; 93; 32; 96; 98; 40; 80; 53; 5; 99; 85; 84; 69; 82; 48; 63; 91; 92; 67; 13; 88; 44; 27; 8; 12; 100; 99]; [98; 26; 14; 12; 96; 96; 58; 6; 80; 52; 90; 99; 94; 84; 87; 82; 98; 63; 91; 79; 93; 84; 95; 53; 30; 63; 37; 92; 27]; [98; 86; 100; 22; 96; 96; 98; 43; 53; 44; 78; 73; 94; 84; 87; 82; 98; 3; 91; 28; 79; 79; 95; 99; 94; 88; 77; 53; 79]; [73; 86; 52; 93; 96; 96; 44; 65; 80; 97; 58; 51; 94; 84; 14; 82; 98; 13; 39; 92; 38; 38; 82; 41; 93; 86; 23; 100; 50]; [98; 86; 100; 93; 96; 96; 60; 99; 80; 97; 90; 99; 94; 84; 41; 82; 98; 54; 84; 67; 93; 84; 95; 99; 66; 88; 92; 100; 12]; [98; 83; 22; 50; 30; 47; 98; 35; 29; 97; 90; 33; 94; 78; 87; 82; 98; 31; 91; 92; 39; 84; 25; 99; 88; 59; 92; 5; 99]; [61; 11; 100; 93; 96; 96; 98; 21; 80; 97; 85; 17; 15; 4; 13; 82; 94; 30; 91; 0; 93; 56; 74; 73; 94; 88; 53; 46; 85]; [98; 86; 23; 83; 96; 96; 43; 99; 80; 29; 90; 99; 94; 7; 75; 75; 30; 63; 91; 92; 93; 64; 92; 91; 94; 45; 14; 97; 99]; [98; 68; 44; 63; 96; 67; 91; 99; 80; 60; 68; 99; 65; 84; 87; 82; 16; 63; 91; 46; 36; 7; 78; 99; 94; 63; 25; 100; 99]; [1; 86; 100; 43; 94; 86; 63; 87; 0; 97; 77; 99; 75; 84; 87; 82; 98; 59; 44; 50; 29; 66; 95; 99; 94; 88; 62; 100; 58]; [98; 37; 100; 66; 96; 96; 14; 99; 40; 97; 90; 99; 21; 34; 17; 82; 98; 63; 67; 92; 0; 51; 95; 99; 94; 61; 44; 100; 99]])
19
+
20
+ let test5 _ = assert_equal [[3;2];[5;2]] (modifiedMatrix [[94; 97; 99; 15; 56; 10; 97; 58; 90; 73; 100; 89; 98; 9; 100; 72; 100; 91; 93; 41; 10; 89; 84; 88; 45; 100; 85; 40; 38; 78; 78; 64; 71; 33; 77; 45; 100; 100; 92; 13; 67; 97; 10; 53; 84]; [94; 97; 99; 86; 13; 70; 97; 32; 90; 14; 51; 13; 8; 81; 11; 88; 100; 7; 93; 100; 26; 48; 84; 88; 62; 75; 29; 95; 92; 100; 78; 27; 71; 80; 77; 56; 81; 65; 92; 100; 27; 97; 86; 81; 84]; [94; 40; 99; 89; 90; 90; 26; 79; 90; 33; 14; 89; 98; 81; 14; 88; 100; 91; 5; 56; 48; 89; 84; 88; 96; 100; 85; 42; 29; 87; 78; 85; 65; 62; 39; 56; 56; 37; 92; 9; 53; 31; 86; 67; 50]; [94; 95; 29; 89; 90; 90; 62; 89; 67; 73; 71; 89; 98; 79; 7; 88; 100; 45; 72; 100; 65; 75; 84; 88; 96; 100; 85; 90; 20; 88; 73; 65; 69; 71; 77; 31; 100; 89; 92; 100; 67; 11; 48; 81; 5]; [94; 70; 84; 5; 86; 73; 17; 89; 0; 23; 100; 77; 26; 81; 100; 88; 100; 32; 93; 92; 65; 89; 84; 75; 96; 84; 8; 24; 92; 100; 30; 11; 71; 15; 17; 56; 53; 54; 92; 100; 67; 68; 45; 56; 65]; [22; 68; 99; 12; 17; 59; 97; 89; 25; 73; 100; 89; 34; 17; 81; 88; 100; 91; 76; 62; 64; 50; 84; 45; 80; 74; 47; 58; 24; 100; 78; 40; 1; 80; 77; 56; 100; 100; 92; 100; 51; 97; 32; 23; 24]; [94; 45; 97; 89; 10; 90; 97; 89; 20; 55; 3; 65; 98; 81; 100; 7; 72; 42; 21; 68; 57; 8; 46; 84; 34; 36; 1; 95; 8; 78; 73; 6; 71; 68; 77; 26; 30; 98; 39; 63; 24; 97; 14; 81; 84]; [83; 97; 13; 89; 90; 62; 97; 6; 90; 73; 100; 31; 98; 81; 100; 63; 45; 53; 30; 3; 65; 48; 59; 17; 96; 100; 81; 58; 92; 40; 78; 51; 71; 42; 77; 39; 100; 53; 29; 100; 16; 97; 86; 72; 24]; [94; 32; 99; 89; 72; 90; 44; 89; 90; 73; 17; 89; 98; 81; 28; 88; 100; 91; 89; 18; 65; 54; 84; 88; 84; 100; 42; 34; 92; 73; 8; 62; 43; 8; 52; 56; 100; 72; 92; 100; 32; 97; 86; 81; 84]; [64; 97; 77; 82; 75; 87; 97; 53; 90; 73; 100; 89; 26; 81; 9; 66; 17; 26; 33; 10; 65; 89; 6; 32; 56; 100; 46; 95; 92; 100; 78; 82; 71; 80; 77; 56; 100; 21; 92; 49; 0; 97; 86; 81; 84]; [94; 97; 3; 24; 72; 39; 97; 89; 89; 73; 100; 89; 98; 70; 4; 88; 49; 91; 54; 14; 65; 50; 73; 86; 96; 88; 85; 95; 79; 20; 25; 85; 71; 80; 64; 56; 37; 34; 39; 100; 54; 57; 32; 81; 84]; [94; 8; 42; 13; 78; 19; 59; 89; 5; 73; 100; 89; 98; 78; 100; 88; 12; 91; 45; 100; 65; 89; 84; 88; 28; 100; 4; 9; 92; 100; 78; 85; 39; 52; 77; 56; 100; 78; 22; 100; 67; 80; 86; 56; 84]])
21
+
22
+ let test6 _ = assert_equal [[3;2];[5;2]] (modifiedMatrix [[95; 96; 19; 88; 100; 92; 98; 85; 18; 98; 71; 56; 88; 80; 100; 87; 31; 92; 75; 91; 65; 42; 84; 52; 81; 17; 22; 77; 73; 41]; [73; 96; 99; 51; 85; 63; 67; 85; 53; 98; 71; 46; 100; 80; 35; 87; 93; 92; 24; 26; 52; 87; 36; 91; 100; 90; 97; 88; 85; 96]; [68; 27; 62; 88; 25; 86; 98; 49; 45; 0; 35; 90; 100; 80; 100; 87; 58; 8; 54; 91; 98; 45; 18; 91; 100; 75; 66; 88; 7; 96]; [95; 94; 99; 88; 100; 22; 98; 32; 100; 80; 50; 59; 100; 78; 100; 87; 83; 69; 100; 74; 98; 100; 38; 14; 41; 90; 97; 88; 85; 96]; [95; 96; 80; 88; 100; 68; 98; 85; 100; 30; 26; 90; 100; 23; 100; 87; 93; 49; 18; 91; 98; 11; 84; 91; 60; 74; 97; 12; 77; 96]; [95; 71; 79; 88; 58; 92; 98; 85; 100; 20; 64; 90; 100; 5; 58; 87; 93; 1; 100; 91; 98; 50; 84; 38; 58; 90; 97; 84; 85; 84]; [95; 73; 99; 88; 36; 92; 98; 85; 51; 42; 31; 69; 68; 80; 100; 67; 93; 88; 100; 91; 13; 63; 46; 5; 100; 90; 97; 88; 37; 50]; [23; 96; 99; 64; 100; 89; 98; 85; 100; 71; 19; 90; 100; 0; 73; 87; 93; 92; 37; 91; 98; 100; 84; 91; 57; 90; 30; 31; 65; 96]; [52; 96; 87; 88; 14; 56; 76; 85; 100; 98; 71; 35; 100; 80; 100; 40; 89; 92; 100; 91; 98; 79; 84; 91; 14; 90; 5; 49; 85; 96]; [16; 52; 99; 64; 100; 24; 53; 85; 87; 98; 71; 56; 11; 80; 81; 15; 93; 92; 100; 3; 12; 100; 84; 91; 78; 30; 31; 88; 45; 83]; [34; 96; 77; 88; 98; 39; 98; 20; 100; 76; 71; 77; 100; 80; 100; 87; 30; 20; 55; 91; 63; 100; 84; 11; 22; 9; 97; 88; 85; 9]; [1; 96; 99; 78; 100; 42; 98; 85; 77; 98; 3; 90; 100; 80; 71; 29; 61; 92; 15; 51; 98; 90; 17; 91; 100; 90; 97; 88; 85; 96]; [95; 96; 99; 80; 6; 26; 98; 85; 22; 98; 42; 36; 24; 38; 44; 48; 55; 92; 74; 28; 98; 41; 6; 91; 100; 28; 24; 86; 85; 96]; [95; 44; 99; 23; 100; 42; 90; 85; 100; 98; 61; 69; 100; 80; 85; 87; 93; 69; 43; 10; 98; 100; 63; 7; 62; 21; 97; 82; 20; 96]; [20; 96; 72; 88; 100; 45; 45; 74; 58; 65; 25; 90; 77; 43; 82; 47; 65; 11; 100; 58; 98; 100; 37; 48; 87; 66; 97; 59; 59; 5]; [95; 96; 99; 88; 100; 84; 27; 41; 20; 98; 71; 90; 82; 34; 44; 86; 86; 92; 100; 54; 98; 100; 84; 91; 69; 45; 23; 88; 34; 31]; [95; 91; 99; 15; 100; 92; 98; 41; 100; 93; 65; 90; 14; 39; 69; 87; 93; 13; 77; 68; 77; 100; 66; 91; 94; 90; 27; 74; 85; 96]; [95; 58; 99; 53; 3; 52; 21; 85; 100; 98; 71; 90; 100; 10; 100; 39; 21; 35; 94; 91; 98; 100; 55; 45; 100; 46; 97; 88; 85; 82]; [75; 96; 95; 40; 8; 92; 69; 85; 100; 98; 36; 90; 100; 80; 100; 87; 63; 92; 100; 91; 98; 91; 84; 91; 100; 30; 97; 88; 85; 96]; [95; 96; 71; 88; 88; 8; 98; 21; 18; 98; 71; 12; 76; 80; 19; 28; 93; 92; 48; 91; 90; 100; 75; 27; 100; 90; 97; 42; 9; 28]; [95; 96; 17; 88; 100; 92; 98; 62; 100; 98; 8; 47; 63; 61; 100; 81; 93; 92; 67; 59; 98; 100; 84; 11; 65; 90; 97; 11; 85; 77]])
23
+
24
+ let test7 _ = assert_equal [[3;2];[5;2]] (modifiedMatrix [[60; 95; 0]; [51; 67; 93]; [99; 55; 93]; [99; 97; 93]; [99; 97; 93]; [99; 4; 93]; [99; 38; 78]; [99; 97; 93]; [99; 28; 93]; [29; 97; 40]; [99; 47; 55]; [62; 59; 93]; [67; 3; 8]; [70; 44; 93]; [99; 32; 93]; [84; 97; 93]; [99; 97; 40]; [59; 54; 7]; [11; 0; 93]; [99; 48; 93]; [17; 17; 93]; [99; 97; 93]; [99; 68; 39]; [74; 97; 93]; [99; 97; 23]; [59; 21; 93]; [99; 66; 93]; [99; 97; 93]; [71; 56; 20]; [2; 17; 21]; [99; 26; 93]; [40; 26; 16]; [80; 31; 56]; [75; 97; 29]; [32; 19; 93]; [99; 97; 93]; [99; 97; 14]; [84; 97; 15]; [28; 97; 93]; [99; 97; 86]])
25
+
26
+
27
+ (* Grouping test cases *)
28
+ let suite = "Test Suite for modifiedMatrix" >::: [
29
+
30
+ "test1" >:: test1;
31
+ "test2" >:: test2;
32
+ "test3" >:: test3;
33
+ "test4" >:: test4;
34
+ "test5" >:: test5;
35
+ "test6" >:: test6;
36
+ "test7" >:: test7;
37
+ ]
38
+
39
+
40
+ (* Running the tests *)
41
+ let () = run_test_tt_main suite
42
+ end
modify_the_matrix/scala_tests/MySuite.scala ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ class MySuite extends munit.FunSuite {
3
+
4
+ test("test1") {
5
+ assertEquals(Main.modifiedMatrix(List(List(1,2,-1),List(4,-1,6),List(7,8,9))), List(List(1,2,9),List(4,8,6),List(7,8,9)))
6
+ }
7
+
8
+ test("test2") {
9
+ assertEquals(Main.modifiedMatrix(List(List(3,-1),List(5,2))), List(List(3,2),List(5,2)))
10
+ }
11
+
12
+ test("test3") {
13
+ assertEquals(Main.modifiedMatrix(List(99, 89, 89, 70, 89, 100, 93, 97, 21, 89, 95, 70, 93, 93, 55, 23, 86, 77, 13, 100, 92, 99, 89, 34, 94, 94, 99, 98, 84, 10, 80, 35, 99, 99, 93, 95, 63, 78, 48, 60, 75, 94),List(14, 89, 85, 100, 89, 1, 93, 64, 98, 89, 95, 100, 93, 100, 95, 29, 86, 31, 94, 100, 99, 13, 37, 93, 94, 94, 100, 98, 96, 83, 97, 65, 83, 99, 19, 95, 13, 99, 83, 53, 75, 55),List(1, 89, 97, 100, 89, 100, 93, 30, 8, 45, 95, 100, 62, 100, 95, 90, 86, 90, 94, 91, 54, 99, 89, 93, 94, 94, 17, 77, 96, 1, 95, 95, 99, 43, 56, 95, 28, 73, 83, 92, 74, 26),List(55, 66, 97, 8, 89, 34, 93, 56, 98, 89, 95, 100, 93, 100, 19, 90, 27, 45, 94, 100, 71, 20, 89, 93, 91, 94, 28, 98, 96, 83, 97, 85, 20, 13, 93, 95, 98, 38, 78, 92, 6, 94),List(2, 82, 97, 100, 38, 100, 93, 32, 65, 89, 95, 76, 93, 44, 64, 35, 37, 21, 2, 100, 99, 31, 26, 57, 22, 94, 63, 36, 31, 83, 69, 27, 86, 58, 93, 64, 98, 99, 83, 92, 75, 94),List(82, 89, 97, 0, 6, 16, 91, 97, 98, 89, 95, 100, 93, 28, 95, 30, 86, 90, 20, 22, 64, 57, 9, 80, 94, 26, 100, 86, 6, 83, 38, 74, 25, 33, 51, 63, 63, 63, 6, 92, 75, 94),List(96, 56, 48, 56, 89, 16, 74, 97, 29, 63, 40, 36, 93, 100, 95, 34, 86, 55, 94, 61, 34, 47, 66, 93, 94, 94, 13, 98, 96, 83, 97, 95, 16, 99, 93, 16, 46, 99, 83, 92, 75, 58),List(99, 89, 97, 97, 89, 100, 93, 97, 98, 89, 95, 100, 57, 100, 75, 90, 86, 52, 55, 100, 99, 85, 87, 29, 94, 94, 49, 98, 25, 83, 29, 14, 99, 42, 78, 54, 60, 46, 83, 70, 75, 94),List(96, 89, 47, 55, 89, 100, 85, 97, 98, 89, 95, 100, 20, 65, 76, 90, 86, 90, 86, 100, 15, 99, 89, 2, 94, 94, 40, 60, 68, 83, 97, 5, 99, 99, 62, 95, 98, 99, 83, 6, 75, 60),List(3, 89, 16, 100, 89, 84, 93, 97, 98, 89, 17, 100, 73, 100, 36, 90, 77, 8, 69, 100, 99, 69, 89, 93, 51, 79, 100, 98, 96, 83, 97, 82, 14, 28, 93, 11, 98, 51, 65, 92, 58, 94),List(46, 89, 6, 100, 49, 64, 53, 97, 4, 88, 95, 100, 32, 100, 44, 90, 48, 19, 94, 100, 50, 53, 62, 22, 94, 13, 100, 32, 96, 83, 64, 95, 7, 86, 47, 72, 61, 99, 83, 92, 75, 84),List(99, 89, 97, 100, 89, 75, 93, 97, 98, 51, 95, 100, 92, 94, 85, 89, 0, 90, 32, 70, 16, 7, 14, 55, 94, 38, 72, 78, 96, 83, 85, 5, 99, 42, 93, 8, 98, 99, 83, 8, 75, 2),List(99, 26, 26, 87, 89, 100, 93, 97, 98, 89, 95, 51, 93, 100, 95, 31, 45, 65, 37, 100, 13, 58, 74, 93, 5, 94, 100, 4, 96, 6, 97, 21, 90, 51, 93, 88, 98, 99, 66, 92, 3, 94),List(37, 45, 49, 100, 54, 100, 93, 59, 20, 89, 95, 6, 89, 100, 95, 90, 86, 90, 94, 14, 99, 99, 27, 93, 94, 94, 64, 67, 9, 83, 62, 65, 85, 20, 93, 95, 41, 11, 35, 72, 75, 94),List(99, 89, 52, 100, 89, 100, 93, 97, 59, 89, 66, 100, 93, 100, 93, 90, 86, 42, 94, 32, 99, 34, 64, 24, 94, 22, 62, 65, 96, 22, 24, 95, 74, 99, 23, 95, 74, 99, 5, 55, 75, 75),List(76, 76, 97, 29, 89, 1, 11, 72, 70, 65, 95, 90, 93, 100, 95, 90, 86, 90, 81, 7, 99, 99, 48, 42, 94, 18, 67, 98, 96, 83, 97, 95, 72, 54, 24, 95, 98, 99, 83, 92, 75, 15),List(99, 89, 97, 100, 89, 100, 18, 64, 20, 16, 44, 46, 60, 90, 95, 3, 46, 83, 94, 64, 64, 80, 89, 32, 26, 94, 100, 64, 96, 48, 97, 27, 90, 99, 20, 95, 49, 99, 1, 92, 75, 36),List(13, 89, 18, 100, 2, 57, 9, 1, 98, 89, 30, 100, 66, 100, 95, 90, 86, 5, 70, 100, 95, 8, 25, 93, 89, 94, 100, 73, 96, 83, 97, 4, 99, 99, 65, 9, 98, 10, 64, 92, 1, 25),List(6, 89, 76, 100, 89, 100, 7, 40, 98, 89, 95, 56, 43, 63, 95, 90, 1, 0, 17, 76, 99, 83, 89, 93, 94, 94, 90, 98, 96, 9, 97, 95, 30, 99, 23, 95, 16, 99, 78, 23, 75, 94),List(98, 18, 80, 100, 89, 100, 55, 97, 0, 89, 24, 43, 89, 18, 95, 90, 84, 90, 30, 41, 99, 64, 89, 78, 94, 70, 45, 59, 18, 83, 32, 95, 13, 99, 93, 95, 98, 99, 83, 78, 75, 64),List(99, 71, 15, 100, 89, 79, 93, 73, 98, 89, 95, 20, 19, 96, 82, 61, 45, 31, 58, 63, 85, 34, 89, 74, 94, 94, 18, 98, 53, 63, 97, 95, 99, 99, 72, 28, 34, 23, 83, 14, 75, 94),List(79, 89, 75, 100, 89, 3, 93, 97, 98, 89, 67, 100, 93, 0, 95, 90, 41, 76, 94, 100, 99, 94, 82, 93, 26, 43, 67, 53, 35, 83, 50, 64, 88, 50, 15, 95, 35, 27, 83, 55, 69, 94),List(81, 89, 31, 91, 89, 100, 93, 97, 9, 89, 95, 100, 93, 100, 95, 90, 23, 90, 94, 100, 99, 74, 89, 93, 68, 49, 100, 23, 19, 83, 97, 95, 99, 24, 69, 95, 47, 99, 83, 92, 75, 81),List(77, 89, 65, 100, 27, 45, 93, 40, 19, 89, 35, 100, 93, 100, 95, 90, 60, 90, 32, 52, 99, 99, 40, 93, 70, 28, 62, 98, 96, 40, 58, 95, 31, 99, 43, 95, 98, 5, 80, 92, 75, 94),List(99, 89, 59, 54, 89, 7, 66, 54, 98, 89, 57, 100, 93, 100, 95, 15, 86, 90, 94, 100, 99, 41, 89, 90, 50, 55, 100, 94, 96, 67, 97, 61, 99, 32, 38, 95, 98, 56, 21, 92, 75, 13),List(99, 21, 97, 100, 42, 100, 93, 97, 49, 3, 95, 100, 53, 93, 95, 77, 86, 3, 1, 100, 99, 99, 7, 93, 94, 94, 100, 53, 96, 83, 9, 95, 99, 58, 10, 95, 42, 99, 68, 67, 58, 94),List(99, 25, 97, 100, 89, 2, 80, 97, 5, 45, 19, 66, 88, 100, 95, 65, 74, 90, 12, 62, 99, 99, 89, 93, 83, 94, 81, 15, 96, 83, 97, 8, 99, 99, 93, 53, 9, 99, 83, 92, 64, 83),List(99, 57, 97, 100, 47, 100, 82, 97, 98, 89, 95, 58, 6, 81, 95, 90, 66, 90, 86, 16, 89, 39, 7, 93, 94, 5, 19, 7, 75, 83, 97, 95, 57, 99, 93, 38, 43, 96, 83, 52, 28, 94),List(77, 59, 20, 100, 89, 100, 93, 97, 50, 89, 95, 4, 93, 41, 38, 76, 86, 30, 94, 100, 60, 84, 69, 93, 94, 94, 97, 74, 81, 83, 11, 95, 63, 44, 1, 95, 83, 99, 44, 57, 75, 94)), List(List(99,89,89,70,89,100,93,97,21,89,95,70,93,93,55,23,86,77,13,100,92,99,89,34,94,94,99,98,84,10,80,35,99,99,93,95,63,78,48,60,75,94),List(14,89,85,100,89,1,93,64,98,89,95,100,93,100,95,29,86,31,94,100,99,13,37,93,94,94,100,98,96,83,97,65,83,99,19,95,13,99,83,53,75,55),List(1,89,97,100,89,100,93,30,8,45,95,100,62,100,95,90,86,90,94,91,54,99,89,93,94,94,17,77,96,1,95,95,99,43,56,95,28,73,83,92,74,26),List(55,66,97,8,89,34,93,56,98,89,95,100,93,100,19,90,27,45,94,100,71,20,89,93,91,94,28,98,96,83,97,85,20,13,93,95,98,38,78,92,6,94),List(2,82,97,100,38,100,93,32,65,89,95,76,93,44,64,35,37,21,2,100,99,31,26,57,22,94,63,36,31,83,69,27,86,58,93,64,98,99,83,92,75,94),List(82,89,97,0,6,16,91,97,98,89,95,100,93,28,95,30,86,90,20,22,64,57,9,80,94,26,100,86,6,83,38,74,25,33,51,63,63,63,6,92,75,94),List(96,56,48,56,89,16,74,97,29,63,40,36,93,100,95,34,86,55,94,61,34,47,66,93,94,94,13,98,96,83,97,95,16,99,93,16,46,99,83,92,75,58),List(99,89,97,97,89,100,93,97,98,89,95,100,57,100,75,90,86,52,55,100,99,85,87,29,94,94,49,98,25,83,29,14,99,42,78,54,60,46,83,70,75,94),List(96,89,47,55,89,100,85,97,98,89,95,100,20,65,76,90,86,90,86,100,15,99,89,2,94,94,40,60,68,83,97,5,99,99,62,95,98,99,83,6,75,60),List(3,89,16,100,89,84,93,97,98,89,17,100,73,100,36,90,77,8,69,100,99,69,89,93,51,79,100,98,96,83,97,82,14,28,93,11,98,51,65,92,58,94),List(46,89,6,100,49,64,53,97,4,88,95,100,32,100,44,90,48,19,94,100,50,53,62,22,94,13,100,32,96,83,64,95,7,86,47,72,61,99,83,92,75,84),List(99,89,97,100,89,75,93,97,98,51,95,100,92,94,85,89,0,90,32,70,16,7,14,55,94,38,72,78,96,83,85,5,99,42,93,8,98,99,83,8,75,2),List(99,26,26,87,89,100,93,97,98,89,95,51,93,100,95,31,45,65,37,100,13,58,74,93,5,94,100,4,96,6,97,21,90,51,93,88,98,99,66,92,3,94),List(37,45,49,100,54,100,93,59,20,89,95,6,89,100,95,90,86,90,94,14,99,99,27,93,94,94,64,67,9,83,62,65,85,20,93,95,41,11,35,72,75,94),List(99,89,52,100,89,100,93,97,59,89,66,100,93,100,93,90,86,42,94,32,99,34,64,24,94,22,62,65,96,22,24,95,74,99,23,95,74,99,5,55,75,75),List(76,76,97,29,89,1,11,72,70,65,95,90,93,100,95,90,86,90,81,7,99,99,48,42,94,18,67,98,96,83,97,95,72,54,24,95,98,99,83,92,75,15),List(99,89,97,100,89,100,18,64,20,16,44,46,60,90,95,3,46,83,94,64,64,80,89,32,26,94,100,64,96,48,97,27,90,99,20,95,49,99,1,92,75,36),List(13,89,18,100,2,57,9,1,98,89,30,100,66,100,95,90,86,5,70,100,95,8,25,93,89,94,100,73,96,83,97,4,99,99,65,9,98,10,64,92,1,25),List(6,89,76,100,89,100,7,40,98,89,95,56,43,63,95,90,1,0,17,76,99,83,89,93,94,94,90,98,96,9,97,95,30,99,23,95,16,99,78,23,75,94),List(98,18,80,100,89,100,55,97,0,89,24,43,89,18,95,90,84,90,30,41,99,64,89,78,94,70,45,59,18,83,32,95,13,99,93,95,98,99,83,78,75,64),List(99,71,15,100,89,79,93,73,98,89,95,20,19,96,82,61,45,31,58,63,85,34,89,74,94,94,18,98,53,63,97,95,99,99,72,28,34,23,83,14,75,94),List(79,89,75,100,89,3,93,97,98,89,67,100,93,0,95,90,41,76,94,100,99,94,82,93,26,43,67,53,35,83,50,64,88,50,15,95,35,27,83,55,69,94),List(81,89,31,91,89,100,93,97,9,89,95,100,93,100,95,90,23,90,94,100,99,74,89,93,68,49,100,23,19,83,97,95,99,24,69,95,47,99,83,92,75,81),List(77,89,65,100,27,45,93,40,19,89,35,100,93,100,95,90,60,90,32,52,99,99,40,93,70,28,62,98,96,40,58,95,31,99,43,95,98,5,80,92,75,94),List(99,89,59,54,89,7,66,54,98,89,57,100,93,100,95,15,86,90,94,100,99,41,89,90,50,55,100,94,96,67,97,61,99,32,38,95,98,56,21,92,75,13),List(99,21,97,100,42,100,93,97,49,3,95,100,53,93,95,77,86,3,1,100,99,99,7,93,94,94,100,53,96,83,9,95,99,58,10,95,42,99,68,67,58,94),List(99,25,97,100,89,2,80,97,5,45,19,66,88,100,95,65,74,90,12,62,99,99,89,93,83,94,81,15,96,83,97,8,99,99,93,53,9,99,83,92,64,83),List(99,57,97,100,47,100,82,97,98,89,95,58,6,81,95,90,66,90,86,16,89,39,7,93,94,5,19,7,75,83,97,95,57,99,93,38,43,96,83,52,28,94),List(77,59,20,100,89,100,93,97,50,89,95,4,93,41,38,76,86,30,94,100,60,84,69,93,94,94,97,74,81,83,11,95,63,44,1,95,83,99,44,57,75,94)))
14
+ }
15
+
16
+ test("test4") {
17
+ assertEquals(Main.modifiedMatrix(List(55, 64, 2, 93, 51, 52, 98, 39, 50, 25, 90, 72, 16, 84, 10, 5, 45, 55, 91, 67, 93, 84, 95, 99, 94, 88, 28, 100, 99),List(98, 86, 100, 93, 96, 96, 98, 70, 80, 97, 69, 15, 94, 39, 53, 62, 98, 63, 29, 70, 84, 84, 95, 99, 94, 88, 41, 55, 99),List(1, 86, 39, 93, 92, 96, 98, 40, 80, 96, 90, 53, 63, 84, 87, 82, 98, 40, 91, 65, 93, 52, 95, 99, 37, 7, 81, 39, 31),List(55, 49, 100, 93, 96, 88, 69, 99, 80, 97, 90, 99, 69, 84, 87, 82, 98, 63, 30, 92, 80, 84, 18, 70, 6, 88, 92, 100, 99),List(98, 86, 71, 93, 96, 96, 37, 53, 80, 72, 38, 99, 94, 59, 87, 0, 98, 9, 87, 75, 41, 47, 95, 28, 94, 88, 42, 18, 27),List(98, 86, 21, 68, 61, 96, 98, 95, 31, 97, 90, 99, 75, 84, 87, 66, 54, 63, 91, 77, 42, 65, 3, 44, 21, 27, 92, 23, 99),List(98, 86, 100, 44, 92, 33, 98, 99, 9, 47, 12, 23, 77, 84, 87, 82, 27, 31, 91, 92, 93, 15, 58, 99, 9, 88, 92, 90, 61),List(15, 86, 100, 10, 77, 96, 52, 99, 80, 88, 75, 80, 48, 9, 48, 35, 98, 63, 91, 81, 60, 84, 95, 99, 18, 88, 85, 24, 20),List(98, 86, 100, 93, 32, 96, 98, 40, 80, 53, 5, 99, 85, 84, 69, 82, 48, 63, 91, 92, 67, 13, 88, 44, 27, 8, 12, 100, 99),List(98, 26, 14, 12, 96, 96, 58, 6, 80, 52, 90, 99, 94, 84, 87, 82, 98, 63, 91, 79, 93, 84, 95, 53, 30, 63, 37, 92, 27),List(98, 86, 100, 22, 96, 96, 98, 43, 53, 44, 78, 73, 94, 84, 87, 82, 98, 3, 91, 28, 79, 79, 95, 99, 94, 88, 77, 53, 79),List(73, 86, 52, 93, 96, 96, 44, 65, 80, 97, 58, 51, 94, 84, 14, 82, 98, 13, 39, 92, 38, 38, 82, 41, 93, 86, 23, 100, 50),List(98, 86, 100, 93, 96, 96, 60, 99, 80, 97, 90, 99, 94, 84, 41, 82, 98, 54, 84, 67, 93, 84, 95, 99, 66, 88, 92, 100, 12),List(98, 83, 22, 50, 30, 47, 98, 35, 29, 97, 90, 33, 94, 78, 87, 82, 98, 31, 91, 92, 39, 84, 25, 99, 88, 59, 92, 5, 99),List(61, 11, 100, 93, 96, 96, 98, 21, 80, 97, 85, 17, 15, 4, 13, 82, 94, 30, 91, 0, 93, 56, 74, 73, 94, 88, 53, 46, 85),List(98, 86, 23, 83, 96, 96, 43, 99, 80, 29, 90, 99, 94, 7, 75, 75, 30, 63, 91, 92, 93, 64, 92, 91, 94, 45, 14, 97, 99),List(98, 68, 44, 63, 96, 67, 91, 99, 80, 60, 68, 99, 65, 84, 87, 82, 16, 63, 91, 46, 36, 7, 78, 99, 94, 63, 25, 100, 99),List(1, 86, 100, 43, 94, 86, 63, 87, 0, 97, 77, 99, 75, 84, 87, 82, 98, 59, 44, 50, 29, 66, 95, 99, 94, 88, 62, 100, 58),List(98, 37, 100, 66, 96, 96, 14, 99, 40, 97, 90, 99, 21, 34, 17, 82, 98, 63, 67, 92, 0, 51, 95, 99, 94, 61, 44, 100, 99)), List(List(55,64,2,93,51,52,98,39,50,25,90,72,16,84,10,5,45,55,91,67,93,84,95,99,94,88,28,100,99),List(98,86,100,93,96,96,98,70,80,97,69,15,94,39,53,62,98,63,29,70,84,84,95,99,94,88,41,55,99),List(1,86,39,93,92,96,98,40,80,96,90,53,63,84,87,82,98,40,91,65,93,52,95,99,37,7,81,39,31),List(55,49,100,93,96,88,69,99,80,97,90,99,69,84,87,82,98,63,30,92,80,84,18,70,6,88,92,100,99),List(98,86,71,93,96,96,37,53,80,72,38,99,94,59,87,0,98,9,87,75,41,47,95,28,94,88,42,18,27),List(98,86,21,68,61,96,98,95,31,97,90,99,75,84,87,66,54,63,91,77,42,65,3,44,21,27,92,23,99),List(98,86,100,44,92,33,98,99,9,47,12,23,77,84,87,82,27,31,91,92,93,15,58,99,9,88,92,90,61),List(15,86,100,10,77,96,52,99,80,88,75,80,48,9,48,35,98,63,91,81,60,84,95,99,18,88,85,24,20),List(98,86,100,93,32,96,98,40,80,53,5,99,85,84,69,82,48,63,91,92,67,13,88,44,27,8,12,100,99),List(98,26,14,12,96,96,58,6,80,52,90,99,94,84,87,82,98,63,91,79,93,84,95,53,30,63,37,92,27),List(98,86,100,22,96,96,98,43,53,44,78,73,94,84,87,82,98,3,91,28,79,79,95,99,94,88,77,53,79),List(73,86,52,93,96,96,44,65,80,97,58,51,94,84,14,82,98,13,39,92,38,38,82,41,93,86,23,100,50),List(98,86,100,93,96,96,60,99,80,97,90,99,94,84,41,82,98,54,84,67,93,84,95,99,66,88,92,100,12),List(98,83,22,50,30,47,98,35,29,97,90,33,94,78,87,82,98,31,91,92,39,84,25,99,88,59,92,5,99),List(61,11,100,93,96,96,98,21,80,97,85,17,15,4,13,82,94,30,91,0,93,56,74,73,94,88,53,46,85),List(98,86,23,83,96,96,43,99,80,29,90,99,94,7,75,75,30,63,91,92,93,64,92,91,94,45,14,97,99),List(98,68,44,63,96,67,91,99,80,60,68,99,65,84,87,82,16,63,91,46,36,7,78,99,94,63,25,100,99),List(1,86,100,43,94,86,63,87,0,97,77,99,75,84,87,82,98,59,44,50,29,66,95,99,94,88,62,100,58),List(98,37,100,66,96,96,14,99,40,97,90,99,21,34,17,82,98,63,67,92,0,51,95,99,94,61,44,100,99)))
18
+ }
19
+
20
+ test("test5") {
21
+ assertEquals(Main.modifiedMatrix(List(94, 97, 99, 15, 56, 10, 97, 58, 90, 73, 100, 89, 98, 9, 100, 72, 100, 91, 93, 41, 10, 89, 84, 88, 45, 100, 85, 40, 38, 78, 78, 64, 71, 33, 77, 45, 100, 100, 92, 13, 67, 97, 10, 53, 84),List(94, 97, 99, 86, 13, 70, 97, 32, 90, 14, 51, 13, 8, 81, 11, 88, 100, 7, 93, 100, 26, 48, 84, 88, 62, 75, 29, 95, 92, 100, 78, 27, 71, 80, 77, 56, 81, 65, 92, 100, 27, 97, 86, 81, 84),List(94, 40, 99, 89, 90, 90, 26, 79, 90, 33, 14, 89, 98, 81, 14, 88, 100, 91, 5, 56, 48, 89, 84, 88, 96, 100, 85, 42, 29, 87, 78, 85, 65, 62, 39, 56, 56, 37, 92, 9, 53, 31, 86, 67, 50),List(94, 95, 29, 89, 90, 90, 62, 89, 67, 73, 71, 89, 98, 79, 7, 88, 100, 45, 72, 100, 65, 75, 84, 88, 96, 100, 85, 90, 20, 88, 73, 65, 69, 71, 77, 31, 100, 89, 92, 100, 67, 11, 48, 81, 5),List(94, 70, 84, 5, 86, 73, 17, 89, 0, 23, 100, 77, 26, 81, 100, 88, 100, 32, 93, 92, 65, 89, 84, 75, 96, 84, 8, 24, 92, 100, 30, 11, 71, 15, 17, 56, 53, 54, 92, 100, 67, 68, 45, 56, 65),List(22, 68, 99, 12, 17, 59, 97, 89, 25, 73, 100, 89, 34, 17, 81, 88, 100, 91, 76, 62, 64, 50, 84, 45, 80, 74, 47, 58, 24, 100, 78, 40, 1, 80, 77, 56, 100, 100, 92, 100, 51, 97, 32, 23, 24),List(94, 45, 97, 89, 10, 90, 97, 89, 20, 55, 3, 65, 98, 81, 100, 7, 72, 42, 21, 68, 57, 8, 46, 84, 34, 36, 1, 95, 8, 78, 73, 6, 71, 68, 77, 26, 30, 98, 39, 63, 24, 97, 14, 81, 84),List(83, 97, 13, 89, 90, 62, 97, 6, 90, 73, 100, 31, 98, 81, 100, 63, 45, 53, 30, 3, 65, 48, 59, 17, 96, 100, 81, 58, 92, 40, 78, 51, 71, 42, 77, 39, 100, 53, 29, 100, 16, 97, 86, 72, 24),List(94, 32, 99, 89, 72, 90, 44, 89, 90, 73, 17, 89, 98, 81, 28, 88, 100, 91, 89, 18, 65, 54, 84, 88, 84, 100, 42, 34, 92, 73, 8, 62, 43, 8, 52, 56, 100, 72, 92, 100, 32, 97, 86, 81, 84),List(64, 97, 77, 82, 75, 87, 97, 53, 90, 73, 100, 89, 26, 81, 9, 66, 17, 26, 33, 10, 65, 89, 6, 32, 56, 100, 46, 95, 92, 100, 78, 82, 71, 80, 77, 56, 100, 21, 92, 49, 0, 97, 86, 81, 84),List(94, 97, 3, 24, 72, 39, 97, 89, 89, 73, 100, 89, 98, 70, 4, 88, 49, 91, 54, 14, 65, 50, 73, 86, 96, 88, 85, 95, 79, 20, 25, 85, 71, 80, 64, 56, 37, 34, 39, 100, 54, 57, 32, 81, 84),List(94, 8, 42, 13, 78, 19, 59, 89, 5, 73, 100, 89, 98, 78, 100, 88, 12, 91, 45, 100, 65, 89, 84, 88, 28, 100, 4, 9, 92, 100, 78, 85, 39, 52, 77, 56, 100, 78, 22, 100, 67, 80, 86, 56, 84)), List(List(94,97,99,15,56,10,97,58,90,73,100,89,98,9,100,72,100,91,93,41,10,89,84,88,45,100,85,40,38,78,78,64,71,33,77,45,100,100,92,13,67,97,10,53,84),List(94,97,99,86,13,70,97,32,90,14,51,13,8,81,11,88,100,7,93,100,26,48,84,88,62,75,29,95,92,100,78,27,71,80,77,56,81,65,92,100,27,97,86,81,84),List(94,40,99,89,90,90,26,79,90,33,14,89,98,81,14,88,100,91,5,56,48,89,84,88,96,100,85,42,29,87,78,85,65,62,39,56,56,37,92,9,53,31,86,67,50),List(94,95,29,89,90,90,62,89,67,73,71,89,98,79,7,88,100,45,72,100,65,75,84,88,96,100,85,90,20,88,73,65,69,71,77,31,100,89,92,100,67,11,48,81,5),List(94,70,84,5,86,73,17,89,0,23,100,77,26,81,100,88,100,32,93,92,65,89,84,75,96,84,8,24,92,100,30,11,71,15,17,56,53,54,92,100,67,68,45,56,65),List(22,68,99,12,17,59,97,89,25,73,100,89,34,17,81,88,100,91,76,62,64,50,84,45,80,74,47,58,24,100,78,40,1,80,77,56,100,100,92,100,51,97,32,23,24),List(94,45,97,89,10,90,97,89,20,55,3,65,98,81,100,7,72,42,21,68,57,8,46,84,34,36,1,95,8,78,73,6,71,68,77,26,30,98,39,63,24,97,14,81,84),List(83,97,13,89,90,62,97,6,90,73,100,31,98,81,100,63,45,53,30,3,65,48,59,17,96,100,81,58,92,40,78,51,71,42,77,39,100,53,29,100,16,97,86,72,24),List(94,32,99,89,72,90,44,89,90,73,17,89,98,81,28,88,100,91,89,18,65,54,84,88,84,100,42,34,92,73,8,62,43,8,52,56,100,72,92,100,32,97,86,81,84),List(64,97,77,82,75,87,97,53,90,73,100,89,26,81,9,66,17,26,33,10,65,89,6,32,56,100,46,95,92,100,78,82,71,80,77,56,100,21,92,49,0,97,86,81,84),List(94,97,3,24,72,39,97,89,89,73,100,89,98,70,4,88,49,91,54,14,65,50,73,86,96,88,85,95,79,20,25,85,71,80,64,56,37,34,39,100,54,57,32,81,84),List(94,8,42,13,78,19,59,89,5,73,100,89,98,78,100,88,12,91,45,100,65,89,84,88,28,100,4,9,92,100,78,85,39,52,77,56,100,78,22,100,67,80,86,56,84)))
22
+ }
23
+
24
+ test("test6") {
25
+ assertEquals(Main.modifiedMatrix(List(95, 96, 19, 88, 100, 92, 98, 85, 18, 98, 71, 56, 88, 80, 100, 87, 31, 92, 75, 91, 65, 42, 84, 52, 81, 17, 22, 77, 73, 41),List(73, 96, 99, 51, 85, 63, 67, 85, 53, 98, 71, 46, 100, 80, 35, 87, 93, 92, 24, 26, 52, 87, 36, 91, 100, 90, 97, 88, 85, 96),List(68, 27, 62, 88, 25, 86, 98, 49, 45, 0, 35, 90, 100, 80, 100, 87, 58, 8, 54, 91, 98, 45, 18, 91, 100, 75, 66, 88, 7, 96),List(95, 94, 99, 88, 100, 22, 98, 32, 100, 80, 50, 59, 100, 78, 100, 87, 83, 69, 100, 74, 98, 100, 38, 14, 41, 90, 97, 88, 85, 96),List(95, 96, 80, 88, 100, 68, 98, 85, 100, 30, 26, 90, 100, 23, 100, 87, 93, 49, 18, 91, 98, 11, 84, 91, 60, 74, 97, 12, 77, 96),List(95, 71, 79, 88, 58, 92, 98, 85, 100, 20, 64, 90, 100, 5, 58, 87, 93, 1, 100, 91, 98, 50, 84, 38, 58, 90, 97, 84, 85, 84),List(95, 73, 99, 88, 36, 92, 98, 85, 51, 42, 31, 69, 68, 80, 100, 67, 93, 88, 100, 91, 13, 63, 46, 5, 100, 90, 97, 88, 37, 50),List(23, 96, 99, 64, 100, 89, 98, 85, 100, 71, 19, 90, 100, 0, 73, 87, 93, 92, 37, 91, 98, 100, 84, 91, 57, 90, 30, 31, 65, 96),List(52, 96, 87, 88, 14, 56, 76, 85, 100, 98, 71, 35, 100, 80, 100, 40, 89, 92, 100, 91, 98, 79, 84, 91, 14, 90, 5, 49, 85, 96),List(16, 52, 99, 64, 100, 24, 53, 85, 87, 98, 71, 56, 11, 80, 81, 15, 93, 92, 100, 3, 12, 100, 84, 91, 78, 30, 31, 88, 45, 83),List(34, 96, 77, 88, 98, 39, 98, 20, 100, 76, 71, 77, 100, 80, 100, 87, 30, 20, 55, 91, 63, 100, 84, 11, 22, 9, 97, 88, 85, 9),List(1, 96, 99, 78, 100, 42, 98, 85, 77, 98, 3, 90, 100, 80, 71, 29, 61, 92, 15, 51, 98, 90, 17, 91, 100, 90, 97, 88, 85, 96),List(95, 96, 99, 80, 6, 26, 98, 85, 22, 98, 42, 36, 24, 38, 44, 48, 55, 92, 74, 28, 98, 41, 6, 91, 100, 28, 24, 86, 85, 96),List(95, 44, 99, 23, 100, 42, 90, 85, 100, 98, 61, 69, 100, 80, 85, 87, 93, 69, 43, 10, 98, 100, 63, 7, 62, 21, 97, 82, 20, 96),List(20, 96, 72, 88, 100, 45, 45, 74, 58, 65, 25, 90, 77, 43, 82, 47, 65, 11, 100, 58, 98, 100, 37, 48, 87, 66, 97, 59, 59, 5),List(95, 96, 99, 88, 100, 84, 27, 41, 20, 98, 71, 90, 82, 34, 44, 86, 86, 92, 100, 54, 98, 100, 84, 91, 69, 45, 23, 88, 34, 31),List(95, 91, 99, 15, 100, 92, 98, 41, 100, 93, 65, 90, 14, 39, 69, 87, 93, 13, 77, 68, 77, 100, 66, 91, 94, 90, 27, 74, 85, 96),List(95, 58, 99, 53, 3, 52, 21, 85, 100, 98, 71, 90, 100, 10, 100, 39, 21, 35, 94, 91, 98, 100, 55, 45, 100, 46, 97, 88, 85, 82),List(75, 96, 95, 40, 8, 92, 69, 85, 100, 98, 36, 90, 100, 80, 100, 87, 63, 92, 100, 91, 98, 91, 84, 91, 100, 30, 97, 88, 85, 96),List(95, 96, 71, 88, 88, 8, 98, 21, 18, 98, 71, 12, 76, 80, 19, 28, 93, 92, 48, 91, 90, 100, 75, 27, 100, 90, 97, 42, 9, 28),List(95, 96, 17, 88, 100, 92, 98, 62, 100, 98, 8, 47, 63, 61, 100, 81, 93, 92, 67, 59, 98, 100, 84, 11, 65, 90, 97, 11, 85, 77)), List(List(95,96,19,88,100,92,98,85,18,98,71,56,88,80,100,87,31,92,75,91,65,42,84,52,81,17,22,77,73,41),List(73,96,99,51,85,63,67,85,53,98,71,46,100,80,35,87,93,92,24,26,52,87,36,91,100,90,97,88,85,96),List(68,27,62,88,25,86,98,49,45,0,35,90,100,80,100,87,58,8,54,91,98,45,18,91,100,75,66,88,7,96),List(95,94,99,88,100,22,98,32,100,80,50,59,100,78,100,87,83,69,100,74,98,100,38,14,41,90,97,88,85,96),List(95,96,80,88,100,68,98,85,100,30,26,90,100,23,100,87,93,49,18,91,98,11,84,91,60,74,97,12,77,96),List(95,71,79,88,58,92,98,85,100,20,64,90,100,5,58,87,93,1,100,91,98,50,84,38,58,90,97,84,85,84),List(95,73,99,88,36,92,98,85,51,42,31,69,68,80,100,67,93,88,100,91,13,63,46,5,100,90,97,88,37,50),List(23,96,99,64,100,89,98,85,100,71,19,90,100,0,73,87,93,92,37,91,98,100,84,91,57,90,30,31,65,96),List(52,96,87,88,14,56,76,85,100,98,71,35,100,80,100,40,89,92,100,91,98,79,84,91,14,90,5,49,85,96),List(16,52,99,64,100,24,53,85,87,98,71,56,11,80,81,15,93,92,100,3,12,100,84,91,78,30,31,88,45,83),List(34,96,77,88,98,39,98,20,100,76,71,77,100,80,100,87,30,20,55,91,63,100,84,11,22,9,97,88,85,9),List(1,96,99,78,100,42,98,85,77,98,3,90,100,80,71,29,61,92,15,51,98,90,17,91,100,90,97,88,85,96),List(95,96,99,80,6,26,98,85,22,98,42,36,24,38,44,48,55,92,74,28,98,41,6,91,100,28,24,86,85,96),List(95,44,99,23,100,42,90,85,100,98,61,69,100,80,85,87,93,69,43,10,98,100,63,7,62,21,97,82,20,96),List(20,96,72,88,100,45,45,74,58,65,25,90,77,43,82,47,65,11,100,58,98,100,37,48,87,66,97,59,59,5),List(95,96,99,88,100,84,27,41,20,98,71,90,82,34,44,86,86,92,100,54,98,100,84,91,69,45,23,88,34,31),List(95,91,99,15,100,92,98,41,100,93,65,90,14,39,69,87,93,13,77,68,77,100,66,91,94,90,27,74,85,96),List(95,58,99,53,3,52,21,85,100,98,71,90,100,10,100,39,21,35,94,91,98,100,55,45,100,46,97,88,85,82),List(75,96,95,40,8,92,69,85,100,98,36,90,100,80,100,87,63,92,100,91,98,91,84,91,100,30,97,88,85,96),List(95,96,71,88,88,8,98,21,18,98,71,12,76,80,19,28,93,92,48,91,90,100,75,27,100,90,97,42,9,28),List(95,96,17,88,100,92,98,62,100,98,8,47,63,61,100,81,93,92,67,59,98,100,84,11,65,90,97,11,85,77)))
26
+ }
27
+
28
+ test("test7") {
29
+ assertEquals(Main.modifiedMatrix(List(60, 95, 0),List(51, 67, 93),List(99, 55, 93),List(99, 97, 93),List(99, 97, 93),List(99, 4, 93),List(99, 38, 78),List(99, 97, 93),List(99, 28, 93),List(29, 97, 40),List(99, 47, 55),List(62, 59, 93),List(67, 3, 8),List(70, 44, 93),List(99, 32, 93),List(84, 97, 93),List(99, 97, 40),List(59, 54, 7),List(11, 0, 93),List(99, 48, 93),List(17, 17, 93),List(99, 97, 93),List(99, 68, 39),List(74, 97, 93),List(99, 97, 23),List(59, 21, 93),List(99, 66, 93),List(99, 97, 93),List(71, 56, 20),List(2, 17, 21),List(99, 26, 93),List(40, 26, 16),List(80, 31, 56),List(75, 97, 29),List(32, 19, 93),List(99, 97, 93),List(99, 97, 14),List(84, 97, 15),List(28, 97, 93),List(99, 97, 86)), List(List(60,95,0),List(51,67,93),List(99,55,93),List(99,97,93),List(99,97,93),List(99,4,93),List(99,38,78),List(99,97,93),List(99,28,93),List(29,97,40),List(99,47,55),List(62,59,93),List(67,3,8),List(70,44,93),List(99,32,93),List(84,97,93),List(99,97,40),List(59,54,7),List(11,0,93),List(99,48,93),List(17,17,93),List(99,97,93),List(99,68,39),List(74,97,93),List(99,97,23),List(59,21,93),List(99,66,93),List(99,97,93),List(71,56,20),List(2,17,21),List(99,26,93),List(40,26,16),List(80,31,56),List(75,97,29),List(32,19,93),List(99,97,93),List(99,97,14),List(84,97,15),List(28,97,93),List(99,97,86)))
30
+ }
31
+
32
+ }
most_frequent_even_element/.DS_Store ADDED
Binary file (6.15 kB). View file
 
most_frequent_even_element/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 (mostFrequentEven [0,1,2,2,4,4,1])," 2 (mostFrequentEven [0,1,2,2,4,4,1]))
13
+
14
+ test2 :: Test
15
+ test2 = TestCase (assertEqual "for (mostFrequentEven [4,4,4,9,2,4])," 4 (mostFrequentEven [4,4,4,9,2,4]))
16
+
17
+ test3 :: Test
18
+ test3 = TestCase (assertEqual "for (mostFrequentEven [29,47,21,41,13,37,25,7])," (-1) (mostFrequentEven [29,47,21,41,13,37,25,7]))
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
most_frequent_even_element/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, mostFrequentEven(new ArrayList<>(Arrays.asList(0,1,2,2,4,4,1))));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals(4, mostFrequentEven(new ArrayList<>(Arrays.asList(4,4,4,9,2,4))));
19
+ }
20
+ @Test
21
+ public void test3() {
22
+ assertEquals(-1, mostFrequentEven(new ArrayList<>(Arrays.asList(29,47,21,41,13,37,25,7))));
23
+ }
24
+
25
+ }
most_frequent_even_element/meta.json ADDED
The diff for this file is too large to render. See raw diff
 
most_frequent_even_element/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 (mostFrequentEven [0;1;2;2;4;4;1])
12
+
13
+ let test2 _ = assert_equal 4 (mostFrequentEven [4;4;4;9;2;4])
14
+
15
+ let test3 _ = assert_equal (-1) (mostFrequentEven [29;47;21;41;13;37;25;7])
16
+
17
+
18
+ (* Grouping test cases *)
19
+ let suite = "Test Suite for mostFrequentEven" >::: [
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
most_frequent_even_element/scala_tests/MySuite.scala ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ class MySuite extends munit.FunSuite {
3
+
4
+ test("test1") {
5
+ assertEquals(Main.mostFrequentEven(List(0,1,2,2,4,4,1)), 2)
6
+ }
7
+
8
+ test("test2") {
9
+ assertEquals(Main.mostFrequentEven(List(4,4,4,9,2,4)), 4)
10
+ }
11
+
12
+ test("test3") {
13
+ assertEquals(Main.mostFrequentEven(List(29,47,21,41,13,37,25,7)), -1)
14
+ }
15
+
16
+ }
most_frequent_ids/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 (mostFrequentIDs [2,3,2,1] [3,2,-3,1])," [3,3,2,2] (mostFrequentIDs [2,3,2,1] [3,2,-3,1]))
13
+
14
+ test2 :: Test
15
+ test2 = TestCase (assertEqual "for (mostFrequentIDs [5,5,3] [2,-2,1])," [2,0,1] (mostFrequentIDs [5,5,3] [2,-2,1]))
16
+
17
+ test3 :: Test
18
+ test3 = TestCase (assertEqual "for (mostFrequentIDs [10, 38, 26, 63, 94, 42, 11, 30, 43, 98, 77, 86, 4, 49, 2, 36, 6, 33, 4, 2, 78, 9, 51, 96, 24, 97, 15, 100, 86, 42, 78, 49, 42, 1, 47, 8, 20, 33, 40, 72, 70, 34, 18, 12, 45, 28, 7, 60, 65, 38, 96, 37] [2, 9, 7, 4, 8, 9, 1, 7, 9, 4, 2, 5, 6, 7, 5, 2, 9, 1, 5, 7, 8, 6, 2, 9, 7, 4, 7, 7, 10, ( -8), 5, 2, 6, 9, 3, 7, 7, 3, 3, 10, 1, 1, 1, 7, 3, 5, 7, 2, 7, 9, ( -2), 4])," [2,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,11,12,12,12,12,12,12,12,12,12,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,18,18,18] (mostFrequentIDs [10, 38, 26, 63, 94, 42, 11, 30, 43, 98, 77, 86, 4, 49, 2, 36, 6, 33, 4, 2, 78, 9, 51, 96, 24, 97, 15, 100, 86, 42, 78, 49, 42, 1, 47, 8, 20, 33, 40, 72, 70, 34, 18, 12, 45, 28, 7, 60, 65, 38, 96, 37] [2, 9, 7, 4, 8, 9, 1, 7, 9, 4, 2, 5, 6, 7, 5, 2, 9, 1, 5, 7, 8, 6, 2, 9, 7, 4, 7, 7, 10, -8, 5, 2, 6, 9, 3, 7, 7, 3, 3, 10, 1, 1, 1, 7, 3, 5, 7, 2, 7, 9, -2, 4]))
19
+
20
+ test4 :: Test
21
+ test4 = TestCase (assertEqual "for (mostFrequentIDs [81, 41, 19, 14, 69, 22, 59, 25, 86, 8, 65, 67, 40, 58, 79, 40, 45, 58, 71, 57, 70, 55, 27, 4, 90, 68, 99, 73, 4, 96, 20, 73, 29, 96, 95, 17, 78, 70, 41, 41, 41, 49, 84, 12, 36, 6, 32, 63, 55, 88, 27, 27, 77, 76, 60, 24, 16, 12, 6, 51, 32, 83, 39, 13, 88, 3, 52, 55, 84, 58, 16, 28, 25, 56, 24, 100, 89, 98, 53, 34, 6, 75, 33, 51, 3, 30, 86, 17, 82, 97, 54, 13, 28, 70, 69, 24, 92, 8, 76, 45] [5, 6, 5, 10, 2, 8, 2, 2, 3, 9, 3, 3, 5, 4, 5, ( -5), 10, ( -4), 3, 3, 4, 1, 4, 2, 5, 9, 7, 9, 1, 4, 3, 6, 10, ( -1), 3, 6, 2, 3, ( -4), ( -2), 9, 2, 10, 4, 1, 8, 2, 4, 1, 3, 6, ( -6), 4, 1, 2, 5, 3, ( -1), ( -4), 4, 1, 10, 5, 3, 7, 8, 1, ( -1), 6, 3, ( -3), 2, 5, 9, 1, 4, 1, 4, 5, 7, ( -1), 4, 2, ( -2), ( -8), 7, 3, 7, 10, 6, 4, 5, ( -2), ( -4), 3, ( -1), 3, ( -5), ( -1), ( -7)])," [5,6,6,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16] (mostFrequentIDs [81, 41, 19, 14, 69, 22, 59, 25, 86, 8, 65, 67, 40, 58, 79, 40, 45, 58, 71, 57, 70, 55, 27, 4, 90, 68, 99, 73, 4, 96, 20, 73, 29, 96, 95, 17, 78, 70, 41, 41, 41, 49, 84, 12, 36, 6, 32, 63, 55, 88, 27, 27, 77, 76, 60, 24, 16, 12, 6, 51, 32, 83, 39, 13, 88, 3, 52, 55, 84, 58, 16, 28, 25, 56, 24, 100, 89, 98, 53, 34, 6, 75, 33, 51, 3, 30, 86, 17, 82, 97, 54, 13, 28, 70, 69, 24, 92, 8, 76, 45] [5, 6, 5, 10, 2, 8, 2, 2, 3, 9, 3, 3, 5, 4, 5, -5, 10, -4, 3, 3, 4, 1, 4, 2, 5, 9, 7, 9, 1, 4, 3, 6, 10, -1, 3, 6, 2, 3, -4, -2, 9, 2, 10, 4, 1, 8, 2, 4, 1, 3, 6, -6, 4, 1, 2, 5, 3, -1, -4, 4, 1, 10, 5, 3, 7, 8, 1, -1, 6, 3, -3, 2, 5, 9, 1, 4, 1, 4, 5, 7, -1, 4, 2, -2, -8, 7, 3, 7, 10, 6, 4, 5, -2, -4, 3, -1, 3, -5, -1, -7]))
22
+
23
+ test5 :: Test
24
+ test5 = TestCase (assertEqual "for (mostFrequentIDs [38, 17, 13, 84, 13, 19, 13, 41, 80, 97, 3, 40, 23, 8, 21, 84, 44, 97, 55, 54, 15, 20, 28] [1, 9, 4, 5, ( -2), 5, 5, 10, 7, 1, 6, 7, 1, 10, 9, ( -1), 1, 1, 4, 8, 3, 2, 5])," [1,9,9,9,9,9,9,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10] (mostFrequentIDs [38, 17, 13, 84, 13, 19, 13, 41, 80, 97, 3, 40, 23, 8, 21, 84, 44, 97, 55, 54, 15, 20, 28] [1, 9, 4, 5, -2, 5, 5, 10, 7, 1, 6, 7, 1, 10, 9, -1, 1, 1, 4, 8, 3, 2, 5]))
25
+
26
+ test6 :: Test
27
+ test6 = TestCase (assertEqual "for (mostFrequentIDs [100, 64, 69, 35, 71, 51, 19, 43, 56, 77, 46, 72, 3, 28, 68, 68, 100, 44, 14, 83, 86, 5, 49, 16, 47, 51, 36, 61, 51, 72, 43, 90, 94, 37, 92, 53, 82, 55, 60, 93, 3, 52, 80, 53, 25, 34, 27, 54, 28, 96, 89, 98, 27, 53, 7, 59, 89, 98, 49, 87, 71, 76, 52, 20, 83, 50, 74, 84, 77, 24, 28] [2, 10, 5, 3, 5, 10, 8, 7, 6, 1, 7, 6, 5, 4, 6, 1, 8, 10, 1, 5, 3, 6, 2, 2, 8, ( -6), 3, 10, 7, 4, 3, 4, 8, 9, 4, 10, 8, 9, 7, 2, ( -2), 7, 8, 1, 8, 8, 8, 9, 3, 7, 10, 6, 6, 10, 5, 5, ( -8), ( -6), ( -2), 3, 2, 5, 2, 3, ( -3), 1, 9, 2, ( -1), 10, ( -1)])," [2,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,14,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21] (mostFrequentIDs [100, 64, 69, 35, 71, 51, 19, 43, 56, 77, 46, 72, 3, 28, 68, 68, 100, 44, 14, 83, 86, 5, 49, 16, 47, 51, 36, 61, 51, 72, 43, 90, 94, 37, 92, 53, 82, 55, 60, 93, 3, 52, 80, 53, 25, 34, 27, 54, 28, 96, 89, 98, 27, 53, 7, 59, 89, 98, 49, 87, 71, 76, 52, 20, 83, 50, 74, 84, 77, 24, 28] [2, 10, 5, 3, 5, 10, 8, 7, 6, 1, 7, 6, 5, 4, 6, 1, 8, 10, 1, 5, 3, 6, 2, 2, 8, -6, 3, 10, 7, 4, 3, 4, 8, 9, 4, 10, 8, 9, 7, 2, -2, 7, 8, 1, 8, 8, 8, 9, 3, 7, 10, 6, 6, 10, 5, 5, -8, -6, -2, 3, 2, 5, 2, 3, -3, 1, 9, 2, -1, 10, -1]))
28
+
29
+ test7 :: Test
30
+ test7 = TestCase (assertEqual "for (mostFrequentIDs [54, 43, 27, 82, 68, 90, 84, 63, 12, 96, 40, 4, 96, 15, 81, 93, 84, 87, 43, 73, 59, 83, 61, 67, 53, 7, 17, 72, 97, 94, 6, 47, 29, 92, 82, 30, 23, 36, 40, 62, 66, 98, 54, 79, 29, 89, 66, 50, 94, 73, 41, 5, 90, 50, 92, 90, 85, 85, 83, 75, 65, 33, 17, 7, 42, 47, 83, 8, 30, 71, 89, 58, 81, 58, 53, 59, 6, 29, 20, 29, 26, 71, 55, 74] [2, 6, 10, 3, 7, 7, 10, 4, 8, 3, 4, 1, ( -3), 9, 10, 9, 9, 7, 8, 7, 3, 4, 4, 5, 8, 7, 1, 2, 8, 6, 1, 2, 3, 3, ( -3), 7, 2, 10, 9, 1, 9, 8, 7, 6, 7, 9, 7, 8, ( -5), ( -7), 8, 9, ( -2), 9, 1, ( -1), 10, ( -3), 3, 1, 6, 7, ( -1), ( -5), 3, ( -1), ( -6), 4, ( -5), 9, ( -9), 2, 2, 8, ( -3), 8, 2, 1, 1, ( -10), 8, ( -4), 9, 1])," [2,6,10,10,10,10,10,10,10,10,10,10,10,10,10,10,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19] (mostFrequentIDs [54, 43, 27, 82, 68, 90, 84, 63, 12, 96, 40, 4, 96, 15, 81, 93, 84, 87, 43, 73, 59, 83, 61, 67, 53, 7, 17, 72, 97, 94, 6, 47, 29, 92, 82, 30, 23, 36, 40, 62, 66, 98, 54, 79, 29, 89, 66, 50, 94, 73, 41, 5, 90, 50, 92, 90, 85, 85, 83, 75, 65, 33, 17, 7, 42, 47, 83, 8, 30, 71, 89, 58, 81, 58, 53, 59, 6, 29, 20, 29, 26, 71, 55, 74] [2, 6, 10, 3, 7, 7, 10, 4, 8, 3, 4, 1, -3, 9, 10, 9, 9, 7, 8, 7, 3, 4, 4, 5, 8, 7, 1, 2, 8, 6, 1, 2, 3, 3, -3, 7, 2, 10, 9, 1, 9, 8, 7, 6, 7, 9, 7, 8, -5, -7, 8, 9, -2, 9, 1, -1, 10, -3, 3, 1, 6, 7, -1, -5, 3, -1, -6, 4, -5, 9, -9, 2, 2, 8, -3, 8, 2, 1, 1, -10, 8, -4, 9, 1]))
31
+
32
+ test8 :: Test
33
+ test8 = TestCase (assertEqual "for (mostFrequentIDs [46, 94, 90, 23, 20, 54, 45, 51, 63, 97, 13, 57, 8, 19, 82, 85, 36, 78, 87, 12, 3, 2, 36, 40, 61, 16, 55, 60, 44, 70] [9, 9, 8, 9, 2, 7, 5, 6, 8, 8, 2, 6, 6, 3, 7, 7, 7, 5, 7, 10, 8, 10, ( -6), 7, 4, 9, 3, 2, 9, 6])," [9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,10,10,10,10,10,10,10,10,10,10,10] (mostFrequentIDs [46, 94, 90, 23, 20, 54, 45, 51, 63, 97, 13, 57, 8, 19, 82, 85, 36, 78, 87, 12, 3, 2, 36, 40, 61, 16, 55, 60, 44, 70] [9, 9, 8, 9, 2, 7, 5, 6, 8, 8, 2, 6, 6, 3, 7, 7, 7, 5, 7, 10, 8, 10, -6, 7, 4, 9, 3, 2, 9, 6]))
34
+
35
+ test9 :: Test
36
+ test9 = TestCase (assertEqual "for (mostFrequentIDs [55, 99, 53, 91, 88, 72, 55, 77, 39] [2, 10, 3, 5, 8, 3, 3, 10, 5])," [2,10,10,10,10,10,10,10,10] (mostFrequentIDs [55, 99, 53, 91, 88, 72, 55, 77, 39] [2, 10, 3, 5, 8, 3, 3, 10, 5]))
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
most_frequent_ids/java_tests/Main.java ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import static org.junit.jupiter.api.Assertions.*;
3
+ import org.junit.jupiter.api.Test;
4
+ import java.util.List;
5
+ import java.util.Arrays;
6
+ import java.util.ArrayList;
7
+ public class Main {
8
+ //Program start
9
+
10
+ //Program end
11
+
12
+ @Test
13
+ public void test1() {
14
+ assertEquals(new ArrayList<>(Arrays.asList(3,3,2,2)), mostFrequentIDs(new ArrayList<>(Arrays.asList(2,3,2,1)), new ArrayList<>(Arrays.asList(3,2,-3,1))));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals(new ArrayList<>(Arrays.asList(2,0,1)), mostFrequentIDs(new ArrayList<>(Arrays.asList(5,5,3)), new ArrayList<>(Arrays.asList(2,-2,1))));
19
+ }
20
+
21
+ }
most_frequent_ids/meta.json ADDED
@@ -0,0 +1,1699 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "id": 3363,
3
+ "name": "most_frequent_ids",
4
+ "difficulty": "Medium",
5
+ "link": "https://leetcode.com/problems/most-frequent-ids/",
6
+ "date": "2024-03-17 00:00:00",
7
+ "task_description": "The problem involves tracking the frequency of IDs in a collection that changes over time. You have two integer arrays, `nums` and `freq`, of equal length `n`. Each element in `nums` represents an ID, and the corresponding element in `freq` indicates how many times that ID should be added to or removed from the collection at each step. **Addition of IDs:** If `freq[i]` is positive, it means `freq[i]` IDs with the value `nums[i]` are added to the collection at step `i`. **Removal of IDs:** If `freq[i]` is negative, it means `-freq[i]` IDs with the value `nums[i]` are removed from the collection at step `i`. Return an array `ans` of length `n`, where `ans[i]` represents the **count** of the _most frequent ID_ in the collection after the `ith` step. If the collection is empty at any step, `ans[i]` should be 0 for that step. **Example 1:** **Input:** nums = [2,3,2,1], freq = [3,2,-3,1] **Output:** [3,3,2,2] **Explanation:** After step 0, we have 3 IDs with the value of 2. So `ans[0] = 3`. After step 1, we have 3 IDs with the value of 2 and 2 IDs with the value of 3. So `ans[1] = 3`. After step 2, we have 2 IDs with the value of 3. So `ans[2] = 2`. After step 3, we have 2 IDs with the value of 3 and 1 ID with the value of 1. So `ans[3] = 2`. **Example 2:** **Input:** nums = [5,5,3], freq = [2,-2,1] **Output:** [2,0,1] **Explanation:** After step 0, we have 2 IDs with the value of 5. So `ans[0] = 2`. After step 1, there are no IDs. So `ans[1] = 0`. After step 2, we have 1 ID with the value of 3. So `ans[2] = 1`. **Constraints:** `1 <= nums.length == freq.length <= 105` `1 <= nums[i] <= 105` `-105 <= freq[i] <= 105` `freq[i] != 0` The input is generated such that the occurrences of an ID will not be negative in any step.",
8
+ "public_test_cases": [
9
+ {
10
+ "label": "Example 1",
11
+ "input": "nums = [2,3,2,1], freq = [3,2,-3,1]",
12
+ "output": "[3,3,2,2] "
13
+ },
14
+ {
15
+ "label": "Example 2",
16
+ "input": "nums = [5,5,3], freq = [2,-2,1]",
17
+ "output": "[2,0,1] "
18
+ }
19
+ ],
20
+ "private_test_cases": [
21
+ {
22
+ "input": [
23
+ [
24
+ 10,
25
+ 38,
26
+ 26,
27
+ 63,
28
+ 94,
29
+ 42,
30
+ 11,
31
+ 30,
32
+ 43,
33
+ 98,
34
+ 77,
35
+ 86,
36
+ 4,
37
+ 49,
38
+ 2,
39
+ 36,
40
+ 6,
41
+ 33,
42
+ 4,
43
+ 2,
44
+ 78,
45
+ 9,
46
+ 51,
47
+ 96,
48
+ 24,
49
+ 97,
50
+ 15,
51
+ 100,
52
+ 86,
53
+ 42,
54
+ 78,
55
+ 49,
56
+ 42,
57
+ 1,
58
+ 47,
59
+ 8,
60
+ 20,
61
+ 33,
62
+ 40,
63
+ 72,
64
+ 70,
65
+ 34,
66
+ 18,
67
+ 12,
68
+ 45,
69
+ 28,
70
+ 7,
71
+ 60,
72
+ 65,
73
+ 38,
74
+ 96,
75
+ 37
76
+ ],
77
+ [
78
+ 2,
79
+ 9,
80
+ 7,
81
+ 4,
82
+ 8,
83
+ 9,
84
+ 1,
85
+ 7,
86
+ 9,
87
+ 4,
88
+ 2,
89
+ 5,
90
+ 6,
91
+ 7,
92
+ 5,
93
+ 2,
94
+ 9,
95
+ 1,
96
+ 5,
97
+ 7,
98
+ 8,
99
+ 6,
100
+ 2,
101
+ 9,
102
+ 7,
103
+ 4,
104
+ 7,
105
+ 7,
106
+ 10,
107
+ -8,
108
+ 5,
109
+ 2,
110
+ 6,
111
+ 9,
112
+ 3,
113
+ 7,
114
+ 7,
115
+ 3,
116
+ 3,
117
+ 10,
118
+ 1,
119
+ 1,
120
+ 1,
121
+ 7,
122
+ 3,
123
+ 5,
124
+ 7,
125
+ 2,
126
+ 7,
127
+ 9,
128
+ -2,
129
+ 4
130
+ ]
131
+ ],
132
+ "output": [
133
+ 2,
134
+ 9,
135
+ 9,
136
+ 9,
137
+ 9,
138
+ 9,
139
+ 9,
140
+ 9,
141
+ 9,
142
+ 9,
143
+ 9,
144
+ 9,
145
+ 9,
146
+ 9,
147
+ 9,
148
+ 9,
149
+ 9,
150
+ 9,
151
+ 11,
152
+ 12,
153
+ 12,
154
+ 12,
155
+ 12,
156
+ 12,
157
+ 12,
158
+ 12,
159
+ 12,
160
+ 12,
161
+ 15,
162
+ 15,
163
+ 15,
164
+ 15,
165
+ 15,
166
+ 15,
167
+ 15,
168
+ 15,
169
+ 15,
170
+ 15,
171
+ 15,
172
+ 15,
173
+ 15,
174
+ 15,
175
+ 15,
176
+ 15,
177
+ 15,
178
+ 15,
179
+ 15,
180
+ 15,
181
+ 15,
182
+ 18,
183
+ 18,
184
+ 18
185
+ ]
186
+ },
187
+ {
188
+ "input": [
189
+ [
190
+ 81,
191
+ 41,
192
+ 19,
193
+ 14,
194
+ 69,
195
+ 22,
196
+ 59,
197
+ 25,
198
+ 86,
199
+ 8,
200
+ 65,
201
+ 67,
202
+ 40,
203
+ 58,
204
+ 79,
205
+ 40,
206
+ 45,
207
+ 58,
208
+ 71,
209
+ 57,
210
+ 70,
211
+ 55,
212
+ 27,
213
+ 4,
214
+ 90,
215
+ 68,
216
+ 99,
217
+ 73,
218
+ 4,
219
+ 96,
220
+ 20,
221
+ 73,
222
+ 29,
223
+ 96,
224
+ 95,
225
+ 17,
226
+ 78,
227
+ 70,
228
+ 41,
229
+ 41,
230
+ 41,
231
+ 49,
232
+ 84,
233
+ 12,
234
+ 36,
235
+ 6,
236
+ 32,
237
+ 63,
238
+ 55,
239
+ 88,
240
+ 27,
241
+ 27,
242
+ 77,
243
+ 76,
244
+ 60,
245
+ 24,
246
+ 16,
247
+ 12,
248
+ 6,
249
+ 51,
250
+ 32,
251
+ 83,
252
+ 39,
253
+ 13,
254
+ 88,
255
+ 3,
256
+ 52,
257
+ 55,
258
+ 84,
259
+ 58,
260
+ 16,
261
+ 28,
262
+ 25,
263
+ 56,
264
+ 24,
265
+ 100,
266
+ 89,
267
+ 98,
268
+ 53,
269
+ 34,
270
+ 6,
271
+ 75,
272
+ 33,
273
+ 51,
274
+ 3,
275
+ 30,
276
+ 86,
277
+ 17,
278
+ 82,
279
+ 97,
280
+ 54,
281
+ 13,
282
+ 28,
283
+ 70,
284
+ 69,
285
+ 24,
286
+ 92,
287
+ 8,
288
+ 76,
289
+ 45
290
+ ],
291
+ [
292
+ 5,
293
+ 6,
294
+ 5,
295
+ 10,
296
+ 2,
297
+ 8,
298
+ 2,
299
+ 2,
300
+ 3,
301
+ 9,
302
+ 3,
303
+ 3,
304
+ 5,
305
+ 4,
306
+ 5,
307
+ -5,
308
+ 10,
309
+ -4,
310
+ 3,
311
+ 3,
312
+ 4,
313
+ 1,
314
+ 4,
315
+ 2,
316
+ 5,
317
+ 9,
318
+ 7,
319
+ 9,
320
+ 1,
321
+ 4,
322
+ 3,
323
+ 6,
324
+ 10,
325
+ -1,
326
+ 3,
327
+ 6,
328
+ 2,
329
+ 3,
330
+ -4,
331
+ -2,
332
+ 9,
333
+ 2,
334
+ 10,
335
+ 4,
336
+ 1,
337
+ 8,
338
+ 2,
339
+ 4,
340
+ 1,
341
+ 3,
342
+ 6,
343
+ -6,
344
+ 4,
345
+ 1,
346
+ 2,
347
+ 5,
348
+ 3,
349
+ -1,
350
+ -4,
351
+ 4,
352
+ 1,
353
+ 10,
354
+ 5,
355
+ 3,
356
+ 7,
357
+ 8,
358
+ 1,
359
+ -1,
360
+ 6,
361
+ 3,
362
+ -3,
363
+ 2,
364
+ 5,
365
+ 9,
366
+ 1,
367
+ 4,
368
+ 1,
369
+ 4,
370
+ 5,
371
+ 7,
372
+ -1,
373
+ 4,
374
+ 2,
375
+ -2,
376
+ -8,
377
+ 7,
378
+ 3,
379
+ 7,
380
+ 10,
381
+ 6,
382
+ 4,
383
+ 5,
384
+ -2,
385
+ -4,
386
+ 3,
387
+ -1,
388
+ 3,
389
+ -5,
390
+ -1,
391
+ -7
392
+ ]
393
+ ],
394
+ "output": [
395
+ 5,
396
+ 6,
397
+ 6,
398
+ 10,
399
+ 10,
400
+ 10,
401
+ 10,
402
+ 10,
403
+ 10,
404
+ 10,
405
+ 10,
406
+ 10,
407
+ 10,
408
+ 10,
409
+ 10,
410
+ 10,
411
+ 10,
412
+ 10,
413
+ 10,
414
+ 10,
415
+ 10,
416
+ 10,
417
+ 10,
418
+ 10,
419
+ 10,
420
+ 10,
421
+ 10,
422
+ 10,
423
+ 10,
424
+ 10,
425
+ 10,
426
+ 15,
427
+ 15,
428
+ 15,
429
+ 15,
430
+ 15,
431
+ 15,
432
+ 15,
433
+ 15,
434
+ 15,
435
+ 15,
436
+ 15,
437
+ 15,
438
+ 15,
439
+ 15,
440
+ 15,
441
+ 15,
442
+ 15,
443
+ 15,
444
+ 15,
445
+ 15,
446
+ 15,
447
+ 15,
448
+ 15,
449
+ 15,
450
+ 15,
451
+ 15,
452
+ 15,
453
+ 15,
454
+ 15,
455
+ 15,
456
+ 15,
457
+ 15,
458
+ 15,
459
+ 15,
460
+ 15,
461
+ 15,
462
+ 15,
463
+ 16,
464
+ 16,
465
+ 16,
466
+ 16,
467
+ 16,
468
+ 16,
469
+ 16,
470
+ 16,
471
+ 16,
472
+ 16,
473
+ 16,
474
+ 16,
475
+ 16,
476
+ 16,
477
+ 16,
478
+ 16,
479
+ 16,
480
+ 16,
481
+ 16,
482
+ 16,
483
+ 16,
484
+ 16,
485
+ 16,
486
+ 16,
487
+ 16,
488
+ 16,
489
+ 16,
490
+ 16,
491
+ 16,
492
+ 16,
493
+ 16,
494
+ 16
495
+ ]
496
+ },
497
+ {
498
+ "input": [
499
+ [
500
+ 38,
501
+ 17,
502
+ 13,
503
+ 84,
504
+ 13,
505
+ 19,
506
+ 13,
507
+ 41,
508
+ 80,
509
+ 97,
510
+ 3,
511
+ 40,
512
+ 23,
513
+ 8,
514
+ 21,
515
+ 84,
516
+ 44,
517
+ 97,
518
+ 55,
519
+ 54,
520
+ 15,
521
+ 20,
522
+ 28
523
+ ],
524
+ [
525
+ 1,
526
+ 9,
527
+ 4,
528
+ 5,
529
+ -2,
530
+ 5,
531
+ 5,
532
+ 10,
533
+ 7,
534
+ 1,
535
+ 6,
536
+ 7,
537
+ 1,
538
+ 10,
539
+ 9,
540
+ -1,
541
+ 1,
542
+ 1,
543
+ 4,
544
+ 8,
545
+ 3,
546
+ 2,
547
+ 5
548
+ ]
549
+ ],
550
+ "output": [
551
+ 1,
552
+ 9,
553
+ 9,
554
+ 9,
555
+ 9,
556
+ 9,
557
+ 9,
558
+ 10,
559
+ 10,
560
+ 10,
561
+ 10,
562
+ 10,
563
+ 10,
564
+ 10,
565
+ 10,
566
+ 10,
567
+ 10,
568
+ 10,
569
+ 10,
570
+ 10,
571
+ 10,
572
+ 10,
573
+ 10
574
+ ]
575
+ },
576
+ {
577
+ "input": [
578
+ [
579
+ 100,
580
+ 64,
581
+ 69,
582
+ 35,
583
+ 71,
584
+ 51,
585
+ 19,
586
+ 43,
587
+ 56,
588
+ 77,
589
+ 46,
590
+ 72,
591
+ 3,
592
+ 28,
593
+ 68,
594
+ 68,
595
+ 100,
596
+ 44,
597
+ 14,
598
+ 83,
599
+ 86,
600
+ 5,
601
+ 49,
602
+ 16,
603
+ 47,
604
+ 51,
605
+ 36,
606
+ 61,
607
+ 51,
608
+ 72,
609
+ 43,
610
+ 90,
611
+ 94,
612
+ 37,
613
+ 92,
614
+ 53,
615
+ 82,
616
+ 55,
617
+ 60,
618
+ 93,
619
+ 3,
620
+ 52,
621
+ 80,
622
+ 53,
623
+ 25,
624
+ 34,
625
+ 27,
626
+ 54,
627
+ 28,
628
+ 96,
629
+ 89,
630
+ 98,
631
+ 27,
632
+ 53,
633
+ 7,
634
+ 59,
635
+ 89,
636
+ 98,
637
+ 49,
638
+ 87,
639
+ 71,
640
+ 76,
641
+ 52,
642
+ 20,
643
+ 83,
644
+ 50,
645
+ 74,
646
+ 84,
647
+ 77,
648
+ 24,
649
+ 28
650
+ ],
651
+ [
652
+ 2,
653
+ 10,
654
+ 5,
655
+ 3,
656
+ 5,
657
+ 10,
658
+ 8,
659
+ 7,
660
+ 6,
661
+ 1,
662
+ 7,
663
+ 6,
664
+ 5,
665
+ 4,
666
+ 6,
667
+ 1,
668
+ 8,
669
+ 10,
670
+ 1,
671
+ 5,
672
+ 3,
673
+ 6,
674
+ 2,
675
+ 2,
676
+ 8,
677
+ -6,
678
+ 3,
679
+ 10,
680
+ 7,
681
+ 4,
682
+ 3,
683
+ 4,
684
+ 8,
685
+ 9,
686
+ 4,
687
+ 10,
688
+ 8,
689
+ 9,
690
+ 7,
691
+ 2,
692
+ -2,
693
+ 7,
694
+ 8,
695
+ 1,
696
+ 8,
697
+ 8,
698
+ 8,
699
+ 9,
700
+ 3,
701
+ 7,
702
+ 10,
703
+ 6,
704
+ 6,
705
+ 10,
706
+ 5,
707
+ 5,
708
+ -8,
709
+ -6,
710
+ -2,
711
+ 3,
712
+ 2,
713
+ 5,
714
+ 2,
715
+ 3,
716
+ -3,
717
+ 1,
718
+ 9,
719
+ 2,
720
+ -1,
721
+ 10,
722
+ -1
723
+ ]
724
+ ],
725
+ "output": [
726
+ 2,
727
+ 10,
728
+ 10,
729
+ 10,
730
+ 10,
731
+ 10,
732
+ 10,
733
+ 10,
734
+ 10,
735
+ 10,
736
+ 10,
737
+ 10,
738
+ 10,
739
+ 10,
740
+ 10,
741
+ 10,
742
+ 10,
743
+ 10,
744
+ 10,
745
+ 10,
746
+ 10,
747
+ 10,
748
+ 10,
749
+ 10,
750
+ 10,
751
+ 10,
752
+ 10,
753
+ 10,
754
+ 11,
755
+ 11,
756
+ 11,
757
+ 11,
758
+ 11,
759
+ 11,
760
+ 11,
761
+ 11,
762
+ 11,
763
+ 11,
764
+ 11,
765
+ 11,
766
+ 11,
767
+ 11,
768
+ 11,
769
+ 11,
770
+ 11,
771
+ 11,
772
+ 11,
773
+ 11,
774
+ 11,
775
+ 11,
776
+ 11,
777
+ 11,
778
+ 14,
779
+ 21,
780
+ 21,
781
+ 21,
782
+ 21,
783
+ 21,
784
+ 21,
785
+ 21,
786
+ 21,
787
+ 21,
788
+ 21,
789
+ 21,
790
+ 21,
791
+ 21,
792
+ 21,
793
+ 21,
794
+ 21,
795
+ 21,
796
+ 21
797
+ ]
798
+ },
799
+ {
800
+ "input": [
801
+ [
802
+ 54,
803
+ 43,
804
+ 27,
805
+ 82,
806
+ 68,
807
+ 90,
808
+ 84,
809
+ 63,
810
+ 12,
811
+ 96,
812
+ 40,
813
+ 4,
814
+ 96,
815
+ 15,
816
+ 81,
817
+ 93,
818
+ 84,
819
+ 87,
820
+ 43,
821
+ 73,
822
+ 59,
823
+ 83,
824
+ 61,
825
+ 67,
826
+ 53,
827
+ 7,
828
+ 17,
829
+ 72,
830
+ 97,
831
+ 94,
832
+ 6,
833
+ 47,
834
+ 29,
835
+ 92,
836
+ 82,
837
+ 30,
838
+ 23,
839
+ 36,
840
+ 40,
841
+ 62,
842
+ 66,
843
+ 98,
844
+ 54,
845
+ 79,
846
+ 29,
847
+ 89,
848
+ 66,
849
+ 50,
850
+ 94,
851
+ 73,
852
+ 41,
853
+ 5,
854
+ 90,
855
+ 50,
856
+ 92,
857
+ 90,
858
+ 85,
859
+ 85,
860
+ 83,
861
+ 75,
862
+ 65,
863
+ 33,
864
+ 17,
865
+ 7,
866
+ 42,
867
+ 47,
868
+ 83,
869
+ 8,
870
+ 30,
871
+ 71,
872
+ 89,
873
+ 58,
874
+ 81,
875
+ 58,
876
+ 53,
877
+ 59,
878
+ 6,
879
+ 29,
880
+ 20,
881
+ 29,
882
+ 26,
883
+ 71,
884
+ 55,
885
+ 74
886
+ ],
887
+ [
888
+ 2,
889
+ 6,
890
+ 10,
891
+ 3,
892
+ 7,
893
+ 7,
894
+ 10,
895
+ 4,
896
+ 8,
897
+ 3,
898
+ 4,
899
+ 1,
900
+ -3,
901
+ 9,
902
+ 10,
903
+ 9,
904
+ 9,
905
+ 7,
906
+ 8,
907
+ 7,
908
+ 3,
909
+ 4,
910
+ 4,
911
+ 5,
912
+ 8,
913
+ 7,
914
+ 1,
915
+ 2,
916
+ 8,
917
+ 6,
918
+ 1,
919
+ 2,
920
+ 3,
921
+ 3,
922
+ -3,
923
+ 7,
924
+ 2,
925
+ 10,
926
+ 9,
927
+ 1,
928
+ 9,
929
+ 8,
930
+ 7,
931
+ 6,
932
+ 7,
933
+ 9,
934
+ 7,
935
+ 8,
936
+ -5,
937
+ -7,
938
+ 8,
939
+ 9,
940
+ -2,
941
+ 9,
942
+ 1,
943
+ -1,
944
+ 10,
945
+ -3,
946
+ 3,
947
+ 1,
948
+ 6,
949
+ 7,
950
+ -1,
951
+ -5,
952
+ 3,
953
+ -1,
954
+ -6,
955
+ 4,
956
+ -5,
957
+ 9,
958
+ -9,
959
+ 2,
960
+ 2,
961
+ 8,
962
+ -3,
963
+ 8,
964
+ 2,
965
+ 1,
966
+ 1,
967
+ -10,
968
+ 8,
969
+ -4,
970
+ 9,
971
+ 1
972
+ ]
973
+ ],
974
+ "output": [
975
+ 2,
976
+ 6,
977
+ 10,
978
+ 10,
979
+ 10,
980
+ 10,
981
+ 10,
982
+ 10,
983
+ 10,
984
+ 10,
985
+ 10,
986
+ 10,
987
+ 10,
988
+ 10,
989
+ 10,
990
+ 10,
991
+ 19,
992
+ 19,
993
+ 19,
994
+ 19,
995
+ 19,
996
+ 19,
997
+ 19,
998
+ 19,
999
+ 19,
1000
+ 19,
1001
+ 19,
1002
+ 19,
1003
+ 19,
1004
+ 19,
1005
+ 19,
1006
+ 19,
1007
+ 19,
1008
+ 19,
1009
+ 19,
1010
+ 19,
1011
+ 19,
1012
+ 19,
1013
+ 19,
1014
+ 19,
1015
+ 19,
1016
+ 19,
1017
+ 19,
1018
+ 19,
1019
+ 19,
1020
+ 19,
1021
+ 19,
1022
+ 19,
1023
+ 19,
1024
+ 19,
1025
+ 19,
1026
+ 19,
1027
+ 19,
1028
+ 19,
1029
+ 19,
1030
+ 19,
1031
+ 19,
1032
+ 19,
1033
+ 19,
1034
+ 19,
1035
+ 19,
1036
+ 19,
1037
+ 19,
1038
+ 19,
1039
+ 19,
1040
+ 19,
1041
+ 19,
1042
+ 19,
1043
+ 19,
1044
+ 19,
1045
+ 19,
1046
+ 19,
1047
+ 19,
1048
+ 19,
1049
+ 19,
1050
+ 19,
1051
+ 19,
1052
+ 19,
1053
+ 19,
1054
+ 19,
1055
+ 19,
1056
+ 19,
1057
+ 19,
1058
+ 19
1059
+ ]
1060
+ },
1061
+ {
1062
+ "input": [
1063
+ [
1064
+ 46,
1065
+ 94,
1066
+ 90,
1067
+ 23,
1068
+ 20,
1069
+ 54,
1070
+ 45,
1071
+ 51,
1072
+ 63,
1073
+ 97,
1074
+ 13,
1075
+ 57,
1076
+ 8,
1077
+ 19,
1078
+ 82,
1079
+ 85,
1080
+ 36,
1081
+ 78,
1082
+ 87,
1083
+ 12,
1084
+ 3,
1085
+ 2,
1086
+ 36,
1087
+ 40,
1088
+ 61,
1089
+ 16,
1090
+ 55,
1091
+ 60,
1092
+ 44,
1093
+ 70
1094
+ ],
1095
+ [
1096
+ 9,
1097
+ 9,
1098
+ 8,
1099
+ 9,
1100
+ 2,
1101
+ 7,
1102
+ 5,
1103
+ 6,
1104
+ 8,
1105
+ 8,
1106
+ 2,
1107
+ 6,
1108
+ 6,
1109
+ 3,
1110
+ 7,
1111
+ 7,
1112
+ 7,
1113
+ 5,
1114
+ 7,
1115
+ 10,
1116
+ 8,
1117
+ 10,
1118
+ -6,
1119
+ 7,
1120
+ 4,
1121
+ 9,
1122
+ 3,
1123
+ 2,
1124
+ 9,
1125
+ 6
1126
+ ]
1127
+ ],
1128
+ "output": [
1129
+ 9,
1130
+ 9,
1131
+ 9,
1132
+ 9,
1133
+ 9,
1134
+ 9,
1135
+ 9,
1136
+ 9,
1137
+ 9,
1138
+ 9,
1139
+ 9,
1140
+ 9,
1141
+ 9,
1142
+ 9,
1143
+ 9,
1144
+ 9,
1145
+ 9,
1146
+ 9,
1147
+ 9,
1148
+ 10,
1149
+ 10,
1150
+ 10,
1151
+ 10,
1152
+ 10,
1153
+ 10,
1154
+ 10,
1155
+ 10,
1156
+ 10,
1157
+ 10,
1158
+ 10
1159
+ ]
1160
+ },
1161
+ {
1162
+ "input": [
1163
+ [
1164
+ 55,
1165
+ 99,
1166
+ 53,
1167
+ 91,
1168
+ 88,
1169
+ 72,
1170
+ 55,
1171
+ 77,
1172
+ 39
1173
+ ],
1174
+ [
1175
+ 2,
1176
+ 10,
1177
+ 3,
1178
+ 5,
1179
+ 8,
1180
+ 3,
1181
+ 3,
1182
+ 10,
1183
+ 5
1184
+ ]
1185
+ ],
1186
+ "output": [
1187
+ 2,
1188
+ 10,
1189
+ 10,
1190
+ 10,
1191
+ 10,
1192
+ 10,
1193
+ 10,
1194
+ 10,
1195
+ 10
1196
+ ]
1197
+ },
1198
+ {
1199
+ "input": [
1200
+ [
1201
+ 29,
1202
+ 8,
1203
+ 98,
1204
+ 34,
1205
+ 42,
1206
+ 36,
1207
+ 21,
1208
+ 42
1209
+ ],
1210
+ [
1211
+ 5,
1212
+ 2,
1213
+ 6,
1214
+ 4,
1215
+ 4,
1216
+ 7,
1217
+ 7,
1218
+ 5
1219
+ ]
1220
+ ],
1221
+ "output": [
1222
+ 5,
1223
+ 5,
1224
+ 6,
1225
+ 6,
1226
+ 6,
1227
+ 7,
1228
+ 7,
1229
+ 9
1230
+ ]
1231
+ },
1232
+ {
1233
+ "input": [
1234
+ [
1235
+ 76,
1236
+ 26,
1237
+ 63,
1238
+ 55,
1239
+ 82,
1240
+ 43,
1241
+ 89,
1242
+ 96,
1243
+ 44,
1244
+ 30,
1245
+ 37,
1246
+ 33,
1247
+ 19,
1248
+ 69,
1249
+ 38,
1250
+ 6,
1251
+ 48,
1252
+ 87,
1253
+ 71,
1254
+ 72,
1255
+ 54,
1256
+ 22,
1257
+ 35,
1258
+ 24,
1259
+ 43,
1260
+ 45,
1261
+ 98,
1262
+ 92,
1263
+ 96,
1264
+ 38,
1265
+ 71,
1266
+ 96,
1267
+ 30,
1268
+ 54,
1269
+ 16,
1270
+ 100,
1271
+ 12,
1272
+ 13,
1273
+ 78,
1274
+ 79,
1275
+ 49,
1276
+ 24,
1277
+ 71,
1278
+ 29,
1279
+ 73,
1280
+ 80,
1281
+ 47,
1282
+ 86,
1283
+ 68,
1284
+ 1,
1285
+ 93,
1286
+ 23,
1287
+ 80,
1288
+ 52,
1289
+ 47,
1290
+ 65,
1291
+ 42,
1292
+ 17,
1293
+ 57,
1294
+ 83,
1295
+ 60,
1296
+ 79,
1297
+ 21,
1298
+ 95,
1299
+ 74,
1300
+ 98,
1301
+ 41,
1302
+ 39,
1303
+ 55,
1304
+ 78,
1305
+ 17,
1306
+ 57,
1307
+ 51,
1308
+ 19,
1309
+ 42,
1310
+ 63,
1311
+ 24,
1312
+ 16,
1313
+ 5,
1314
+ 67
1315
+ ],
1316
+ [
1317
+ 5,
1318
+ 5,
1319
+ 9,
1320
+ 5,
1321
+ 5,
1322
+ 10,
1323
+ 10,
1324
+ 2,
1325
+ 6,
1326
+ 1,
1327
+ 3,
1328
+ 9,
1329
+ 7,
1330
+ 2,
1331
+ 7,
1332
+ 6,
1333
+ 9,
1334
+ 2,
1335
+ 1,
1336
+ 6,
1337
+ 8,
1338
+ 10,
1339
+ 5,
1340
+ 5,
1341
+ -2,
1342
+ 7,
1343
+ 6,
1344
+ 9,
1345
+ -1,
1346
+ 4,
1347
+ 10,
1348
+ 3,
1349
+ -1,
1350
+ -8,
1351
+ 3,
1352
+ 1,
1353
+ 9,
1354
+ 9,
1355
+ 7,
1356
+ 6,
1357
+ 4,
1358
+ 8,
1359
+ 6,
1360
+ 5,
1361
+ 2,
1362
+ 2,
1363
+ 2,
1364
+ 10,
1365
+ 6,
1366
+ 9,
1367
+ 1,
1368
+ 8,
1369
+ 3,
1370
+ 2,
1371
+ 3,
1372
+ 6,
1373
+ 6,
1374
+ 1,
1375
+ 3,
1376
+ 1,
1377
+ 4,
1378
+ 4,
1379
+ 3,
1380
+ 6,
1381
+ 8,
1382
+ -4,
1383
+ 4,
1384
+ 1,
1385
+ -5,
1386
+ 1,
1387
+ 7,
1388
+ 5,
1389
+ 6,
1390
+ 1,
1391
+ 4,
1392
+ -7,
1393
+ -8,
1394
+ -1,
1395
+ 4,
1396
+ 10
1397
+ ]
1398
+ ],
1399
+ "output": [
1400
+ 5,
1401
+ 5,
1402
+ 9,
1403
+ 9,
1404
+ 9,
1405
+ 10,
1406
+ 10,
1407
+ 10,
1408
+ 10,
1409
+ 10,
1410
+ 10,
1411
+ 10,
1412
+ 10,
1413
+ 10,
1414
+ 10,
1415
+ 10,
1416
+ 10,
1417
+ 10,
1418
+ 10,
1419
+ 10,
1420
+ 10,
1421
+ 10,
1422
+ 10,
1423
+ 10,
1424
+ 10,
1425
+ 10,
1426
+ 10,
1427
+ 10,
1428
+ 10,
1429
+ 11,
1430
+ 11,
1431
+ 11,
1432
+ 11,
1433
+ 11,
1434
+ 11,
1435
+ 11,
1436
+ 11,
1437
+ 11,
1438
+ 11,
1439
+ 11,
1440
+ 11,
1441
+ 13,
1442
+ 17,
1443
+ 17,
1444
+ 17,
1445
+ 17,
1446
+ 17,
1447
+ 17,
1448
+ 17,
1449
+ 17,
1450
+ 17,
1451
+ 17,
1452
+ 17,
1453
+ 17,
1454
+ 17,
1455
+ 17,
1456
+ 17,
1457
+ 17,
1458
+ 17,
1459
+ 17,
1460
+ 17,
1461
+ 17,
1462
+ 17,
1463
+ 17,
1464
+ 17,
1465
+ 17,
1466
+ 17,
1467
+ 17,
1468
+ 17,
1469
+ 17,
1470
+ 17,
1471
+ 17,
1472
+ 17,
1473
+ 17,
1474
+ 17,
1475
+ 17,
1476
+ 17,
1477
+ 17,
1478
+ 17,
1479
+ 17
1480
+ ]
1481
+ },
1482
+ {
1483
+ "input": [
1484
+ [
1485
+ 34,
1486
+ 93,
1487
+ 58,
1488
+ 85,
1489
+ 47,
1490
+ 57,
1491
+ 7,
1492
+ 13,
1493
+ 12,
1494
+ 21,
1495
+ 3,
1496
+ 89,
1497
+ 86,
1498
+ 7,
1499
+ 99,
1500
+ 20,
1501
+ 12,
1502
+ 51,
1503
+ 17,
1504
+ 53,
1505
+ 93,
1506
+ 58,
1507
+ 61,
1508
+ 84,
1509
+ 21,
1510
+ 80,
1511
+ 75,
1512
+ 6,
1513
+ 36,
1514
+ 43,
1515
+ 2,
1516
+ 52,
1517
+ 22,
1518
+ 40,
1519
+ 68,
1520
+ 21,
1521
+ 25,
1522
+ 59,
1523
+ 1,
1524
+ 75,
1525
+ 83,
1526
+ 92,
1527
+ 68,
1528
+ 61,
1529
+ 51,
1530
+ 41,
1531
+ 98,
1532
+ 71,
1533
+ 44,
1534
+ 24,
1535
+ 79,
1536
+ 94,
1537
+ 9,
1538
+ 71,
1539
+ 80,
1540
+ 61,
1541
+ 37,
1542
+ 63,
1543
+ 68,
1544
+ 6,
1545
+ 1,
1546
+ 90,
1547
+ 93,
1548
+ 79,
1549
+ 18,
1550
+ 20,
1551
+ 34
1552
+ ],
1553
+ [
1554
+ 10,
1555
+ 4,
1556
+ 10,
1557
+ 7,
1558
+ 3,
1559
+ 4,
1560
+ 5,
1561
+ 2,
1562
+ 7,
1563
+ 1,
1564
+ 2,
1565
+ 9,
1566
+ 4,
1567
+ 7,
1568
+ 5,
1569
+ 1,
1570
+ 10,
1571
+ 10,
1572
+ 6,
1573
+ 5,
1574
+ 8,
1575
+ 3,
1576
+ 3,
1577
+ 6,
1578
+ 4,
1579
+ 2,
1580
+ 1,
1581
+ 7,
1582
+ 2,
1583
+ 9,
1584
+ 7,
1585
+ 8,
1586
+ 8,
1587
+ 2,
1588
+ 3,
1589
+ 10,
1590
+ 3,
1591
+ 1,
1592
+ 9,
1593
+ 5,
1594
+ 10,
1595
+ 8,
1596
+ 6,
1597
+ -1,
1598
+ -6,
1599
+ 3,
1600
+ 6,
1601
+ 4,
1602
+ 5,
1603
+ 6,
1604
+ 1,
1605
+ 1,
1606
+ 8,
1607
+ -3,
1608
+ -1,
1609
+ 10,
1610
+ 1,
1611
+ 9,
1612
+ 6,
1613
+ -2,
1614
+ 1,
1615
+ 5,
1616
+ -5,
1617
+ 3,
1618
+ 4,
1619
+ -1,
1620
+ -3
1621
+ ]
1622
+ ],
1623
+ "output": [
1624
+ 10,
1625
+ 10,
1626
+ 10,
1627
+ 10,
1628
+ 10,
1629
+ 10,
1630
+ 10,
1631
+ 10,
1632
+ 10,
1633
+ 10,
1634
+ 10,
1635
+ 10,
1636
+ 10,
1637
+ 12,
1638
+ 12,
1639
+ 12,
1640
+ 17,
1641
+ 17,
1642
+ 17,
1643
+ 17,
1644
+ 17,
1645
+ 17,
1646
+ 17,
1647
+ 17,
1648
+ 17,
1649
+ 17,
1650
+ 17,
1651
+ 17,
1652
+ 17,
1653
+ 17,
1654
+ 17,
1655
+ 17,
1656
+ 17,
1657
+ 17,
1658
+ 17,
1659
+ 17,
1660
+ 17,
1661
+ 17,
1662
+ 17,
1663
+ 17,
1664
+ 17,
1665
+ 17,
1666
+ 17,
1667
+ 17,
1668
+ 17,
1669
+ 17,
1670
+ 17,
1671
+ 17,
1672
+ 17,
1673
+ 17,
1674
+ 17,
1675
+ 17,
1676
+ 17,
1677
+ 17,
1678
+ 17,
1679
+ 17,
1680
+ 17,
1681
+ 17,
1682
+ 17,
1683
+ 17,
1684
+ 17,
1685
+ 17,
1686
+ 17,
1687
+ 17,
1688
+ 17,
1689
+ 17,
1690
+ 17
1691
+ ]
1692
+ }
1693
+ ],
1694
+ "haskell_template": "mostFrequentIDs :: [Int] -> [Int] -> [Int]\nmostFrequentIDs nums freq ",
1695
+ "ocaml_template": "let mostFrequentIDs (nums: int list) (freq: int list) : int list = ",
1696
+ "scala_template": "def mostFrequentIDs(nums: List[Int],freq: List[Int]): List[Int] = { \n \n}",
1697
+ "java_template": "class Solution {\n public long[] mostFrequentIDs(int[] nums, int[] freq) {\n \n }\n}",
1698
+ "python_template": "class Solution(object):\n def mostFrequentIDs(self, nums, freq):\n \"\"\"\n :type nums: List[int]\n :type freq: List[int]\n :rtype: List[int]\n \"\"\"\n "
1699
+ }
most_frequent_ids/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 [3;3;2;2] (mostFrequentIDs [2;3;2;1] [3;2;-3;1])
12
+
13
+ let test2 _ = assert_equal [2;0;1] (mostFrequentIDs [5;5;3] [2;-2;1])
14
+
15
+ let test3 _ = assert_equal [2;9;9;9;9;9;9;9;9;9;9;9;9;9;9;9;9;9;11;12;12;12;12;12;12;12;12;12;15;15;15;15;15;15;15;15;15;15;15;15;15;15;15;15;15;15;15;15;15;18;18;18] (mostFrequentIDs [10; 38; 26; 63; 94; 42; 11; 30; 43; 98; 77; 86; 4; 49; 2; 36; 6; 33; 4; 2; 78; 9; 51; 96; 24; 97; 15; 100; 86; 42; 78; 49; 42; 1; 47; 8; 20; 33; 40; 72; 70; 34; 18; 12; 45; 28; 7; 60; 65; 38; 96; 37] [2; 9; 7; 4; 8; 9; 1; 7; 9; 4; 2; 5; 6; 7; 5; 2; 9; 1; 5; 7; 8; 6; 2; 9; 7; 4; 7; 7; 10; ( -8); 5; 2; 6; 9; 3; 7; 7; 3; 3; 10; 1; 1; 1; 7; 3; 5; 7; 2; 7; 9; ( -2); 4])
16
+
17
+ let test4 _ = assert_equal [5;6;6;10;10;10;10;10;10;10;10;10;10;10;10;10;10;10;10;10;10;10;10;10;10;10;10;10;10;10;10;15;15;15;15;15;15;15;15;15;15;15;15;15;15;15;15;15;15;15;15;15;15;15;15;15;15;15;15;15;15;15;15;15;15;15;15;15;16;16;16;16;16;16;16;16;16;16;16;16;16;16;16;16;16;16;16;16;16;16;16;16;16;16;16;16;16;16;16;16] (mostFrequentIDs [81; 41; 19; 14; 69; 22; 59; 25; 86; 8; 65; 67; 40; 58; 79; 40; 45; 58; 71; 57; 70; 55; 27; 4; 90; 68; 99; 73; 4; 96; 20; 73; 29; 96; 95; 17; 78; 70; 41; 41; 41; 49; 84; 12; 36; 6; 32; 63; 55; 88; 27; 27; 77; 76; 60; 24; 16; 12; 6; 51; 32; 83; 39; 13; 88; 3; 52; 55; 84; 58; 16; 28; 25; 56; 24; 100; 89; 98; 53; 34; 6; 75; 33; 51; 3; 30; 86; 17; 82; 97; 54; 13; 28; 70; 69; 24; 92; 8; 76; 45] [5; 6; 5; 10; 2; 8; 2; 2; 3; 9; 3; 3; 5; 4; 5; ( -5); 10; ( -4); 3; 3; 4; 1; 4; 2; 5; 9; 7; 9; 1; 4; 3; 6; 10; ( -1); 3; 6; 2; 3; ( -4); ( -2); 9; 2; 10; 4; 1; 8; 2; 4; 1; 3; 6; ( -6); 4; 1; 2; 5; 3; ( -1); ( -4); 4; 1; 10; 5; 3; 7; 8; 1; ( -1); 6; 3; ( -3); 2; 5; 9; 1; 4; 1; 4; 5; 7; ( -1); 4; 2; ( -2); ( -8); 7; 3; 7; 10; 6; 4; 5; ( -2); ( -4); 3; ( -1); 3; ( -5); ( -1); ( -7)])
18
+
19
+ let test5 _ = assert_equal [1;9;9;9;9;9;9;10;10;10;10;10;10;10;10;10;10;10;10;10;10;10;10] (mostFrequentIDs [38; 17; 13; 84; 13; 19; 13; 41; 80; 97; 3; 40; 23; 8; 21; 84; 44; 97; 55; 54; 15; 20; 28] [1; 9; 4; 5; ( -2); 5; 5; 10; 7; 1; 6; 7; 1; 10; 9; ( -1); 1; 1; 4; 8; 3; 2; 5])
20
+
21
+ let test6 _ = assert_equal [2;10;10;10;10;10;10;10;10;10;10;10;10;10;10;10;10;10;10;10;10;10;10;10;10;10;10;10;11;11;11;11;11;11;11;11;11;11;11;11;11;11;11;11;11;11;11;11;11;11;11;11;14;21;21;21;21;21;21;21;21;21;21;21;21;21;21;21;21;21;21] (mostFrequentIDs [100; 64; 69; 35; 71; 51; 19; 43; 56; 77; 46; 72; 3; 28; 68; 68; 100; 44; 14; 83; 86; 5; 49; 16; 47; 51; 36; 61; 51; 72; 43; 90; 94; 37; 92; 53; 82; 55; 60; 93; 3; 52; 80; 53; 25; 34; 27; 54; 28; 96; 89; 98; 27; 53; 7; 59; 89; 98; 49; 87; 71; 76; 52; 20; 83; 50; 74; 84; 77; 24; 28] [2; 10; 5; 3; 5; 10; 8; 7; 6; 1; 7; 6; 5; 4; 6; 1; 8; 10; 1; 5; 3; 6; 2; 2; 8; ( -6); 3; 10; 7; 4; 3; 4; 8; 9; 4; 10; 8; 9; 7; 2; ( -2); 7; 8; 1; 8; 8; 8; 9; 3; 7; 10; 6; 6; 10; 5; 5; ( -8); ( -6); ( -2); 3; 2; 5; 2; 3; ( -3); 1; 9; 2; ( -1); 10; ( -1)])
22
+
23
+ let test7 _ = assert_equal [2;6;10;10;10;10;10;10;10;10;10;10;10;10;10;10;19;19;19;19;19;19;19;19;19;19;19;19;19;19;19;19;19;19;19;19;19;19;19;19;19;19;19;19;19;19;19;19;19;19;19;19;19;19;19;19;19;19;19;19;19;19;19;19;19;19;19;19;19;19;19;19;19;19;19;19;19;19;19;19;19;19;19;19] (mostFrequentIDs [54; 43; 27; 82; 68; 90; 84; 63; 12; 96; 40; 4; 96; 15; 81; 93; 84; 87; 43; 73; 59; 83; 61; 67; 53; 7; 17; 72; 97; 94; 6; 47; 29; 92; 82; 30; 23; 36; 40; 62; 66; 98; 54; 79; 29; 89; 66; 50; 94; 73; 41; 5; 90; 50; 92; 90; 85; 85; 83; 75; 65; 33; 17; 7; 42; 47; 83; 8; 30; 71; 89; 58; 81; 58; 53; 59; 6; 29; 20; 29; 26; 71; 55; 74] [2; 6; 10; 3; 7; 7; 10; 4; 8; 3; 4; 1; ( -3); 9; 10; 9; 9; 7; 8; 7; 3; 4; 4; 5; 8; 7; 1; 2; 8; 6; 1; 2; 3; 3; ( -3); 7; 2; 10; 9; 1; 9; 8; 7; 6; 7; 9; 7; 8; ( -5); ( -7); 8; 9; ( -2); 9; 1; ( -1); 10; ( -3); 3; 1; 6; 7; ( -1); ( -5); 3; ( -1); ( -6); 4; ( -5); 9; ( -9); 2; 2; 8; ( -3); 8; 2; 1; 1; ( -10); 8; ( -4); 9; 1])
24
+
25
+ let test8 _ = assert_equal [9;9;9;9;9;9;9;9;9;9;9;9;9;9;9;9;9;9;9;10;10;10;10;10;10;10;10;10;10;10] (mostFrequentIDs [46; 94; 90; 23; 20; 54; 45; 51; 63; 97; 13; 57; 8; 19; 82; 85; 36; 78; 87; 12; 3; 2; 36; 40; 61; 16; 55; 60; 44; 70] [9; 9; 8; 9; 2; 7; 5; 6; 8; 8; 2; 6; 6; 3; 7; 7; 7; 5; 7; 10; 8; 10; ( -6); 7; 4; 9; 3; 2; 9; 6])
26
+
27
+ let test9 _ = assert_equal [2;10;10;10;10;10;10;10;10] (mostFrequentIDs [55; 99; 53; 91; 88; 72; 55; 77; 39] [2; 10; 3; 5; 8; 3; 3; 10; 5])
28
+
29
+ let test10 _ = assert_equal [5;5;6;6;6;7;7;9] (mostFrequentIDs [29; 8; 98; 34; 42; 36; 21; 42] [5; 2; 6; 4; 4; 7; 7; 5])
30
+
31
+
32
+ (* Grouping test cases *)
33
+ let suite = "Test Suite for mostFrequentIDs" >::: [
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
most_frequent_ids/scala_tests/MySuite.scala ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ class MySuite extends munit.FunSuite {
3
+
4
+ test("test1") {
5
+ assertEquals(Main.mostFrequentIDs(List(2,3,2,1),List(3,2,-3,1)), List(3,3,2,2))
6
+ }
7
+
8
+ test("test2") {
9
+ assertEquals(Main.mostFrequentIDs(List(5,5,3),List(2,-2,1)), List(2,0,1))
10
+ }
11
+
12
+ test("test3") {
13
+ assertEquals(Main.mostFrequentIDs(List(10, 38, 26, 63, 94, 42, 11, 30, 43, 98, 77, 86, 4, 49, 2, 36, 6, 33, 4, 2, 78, 9, 51, 96, 24, 97, 15, 100, 86, 42, 78, 49, 42, 1, 47, 8, 20, 33, 40, 72, 70, 34, 18, 12, 45, 28, 7, 60, 65, 38, 96, 37),List(2, 9, 7, 4, 8, 9, 1, 7, 9, 4, 2, 5, 6, 7, 5, 2, 9, 1, 5, 7, 8, 6, 2, 9, 7, 4, 7, 7, 10, -8, 5, 2, 6, 9, 3, 7, 7, 3, 3, 10, 1, 1, 1, 7, 3, 5, 7, 2, 7, 9, -2, 4)), List(2,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,11,12,12,12,12,12,12,12,12,12,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,18,18,18))
14
+ }
15
+
16
+ test("test4") {
17
+ assertEquals(Main.mostFrequentIDs(List(81, 41, 19, 14, 69, 22, 59, 25, 86, 8, 65, 67, 40, 58, 79, 40, 45, 58, 71, 57, 70, 55, 27, 4, 90, 68, 99, 73, 4, 96, 20, 73, 29, 96, 95, 17, 78, 70, 41, 41, 41, 49, 84, 12, 36, 6, 32, 63, 55, 88, 27, 27, 77, 76, 60, 24, 16, 12, 6, 51, 32, 83, 39, 13, 88, 3, 52, 55, 84, 58, 16, 28, 25, 56, 24, 100, 89, 98, 53, 34, 6, 75, 33, 51, 3, 30, 86, 17, 82, 97, 54, 13, 28, 70, 69, 24, 92, 8, 76, 45),List(5, 6, 5, 10, 2, 8, 2, 2, 3, 9, 3, 3, 5, 4, 5, -5, 10, -4, 3, 3, 4, 1, 4, 2, 5, 9, 7, 9, 1, 4, 3, 6, 10, -1, 3, 6, 2, 3, -4, -2, 9, 2, 10, 4, 1, 8, 2, 4, 1, 3, 6, -6, 4, 1, 2, 5, 3, -1, -4, 4, 1, 10, 5, 3, 7, 8, 1, -1, 6, 3, -3, 2, 5, 9, 1, 4, 1, 4, 5, 7, -1, 4, 2, -2, -8, 7, 3, 7, 10, 6, 4, 5, -2, -4, 3, -1, 3, -5, -1, -7)), List(5,6,6,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16))
18
+ }
19
+
20
+ test("test5") {
21
+ assertEquals(Main.mostFrequentIDs(List(38, 17, 13, 84, 13, 19, 13, 41, 80, 97, 3, 40, 23, 8, 21, 84, 44, 97, 55, 54, 15, 20, 28),List(1, 9, 4, 5, -2, 5, 5, 10, 7, 1, 6, 7, 1, 10, 9, -1, 1, 1, 4, 8, 3, 2, 5)), List(1,9,9,9,9,9,9,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10))
22
+ }
23
+
24
+ test("test6") {
25
+ assertEquals(Main.mostFrequentIDs(List(100, 64, 69, 35, 71, 51, 19, 43, 56, 77, 46, 72, 3, 28, 68, 68, 100, 44, 14, 83, 86, 5, 49, 16, 47, 51, 36, 61, 51, 72, 43, 90, 94, 37, 92, 53, 82, 55, 60, 93, 3, 52, 80, 53, 25, 34, 27, 54, 28, 96, 89, 98, 27, 53, 7, 59, 89, 98, 49, 87, 71, 76, 52, 20, 83, 50, 74, 84, 77, 24, 28),List(2, 10, 5, 3, 5, 10, 8, 7, 6, 1, 7, 6, 5, 4, 6, 1, 8, 10, 1, 5, 3, 6, 2, 2, 8, -6, 3, 10, 7, 4, 3, 4, 8, 9, 4, 10, 8, 9, 7, 2, -2, 7, 8, 1, 8, 8, 8, 9, 3, 7, 10, 6, 6, 10, 5, 5, -8, -6, -2, 3, 2, 5, 2, 3, -3, 1, 9, 2, -1, 10, -1)), List(2,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,14,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21))
26
+ }
27
+
28
+ test("test7") {
29
+ assertEquals(Main.mostFrequentIDs(List(54, 43, 27, 82, 68, 90, 84, 63, 12, 96, 40, 4, 96, 15, 81, 93, 84, 87, 43, 73, 59, 83, 61, 67, 53, 7, 17, 72, 97, 94, 6, 47, 29, 92, 82, 30, 23, 36, 40, 62, 66, 98, 54, 79, 29, 89, 66, 50, 94, 73, 41, 5, 90, 50, 92, 90, 85, 85, 83, 75, 65, 33, 17, 7, 42, 47, 83, 8, 30, 71, 89, 58, 81, 58, 53, 59, 6, 29, 20, 29, 26, 71, 55, 74),List(2, 6, 10, 3, 7, 7, 10, 4, 8, 3, 4, 1, -3, 9, 10, 9, 9, 7, 8, 7, 3, 4, 4, 5, 8, 7, 1, 2, 8, 6, 1, 2, 3, 3, -3, 7, 2, 10, 9, 1, 9, 8, 7, 6, 7, 9, 7, 8, -5, -7, 8, 9, -2, 9, 1, -1, 10, -3, 3, 1, 6, 7, -1, -5, 3, -1, -6, 4, -5, 9, -9, 2, 2, 8, -3, 8, 2, 1, 1, -10, 8, -4, 9, 1)), List(2,6,10,10,10,10,10,10,10,10,10,10,10,10,10,10,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19))
30
+ }
31
+
32
+ test("test8") {
33
+ assertEquals(Main.mostFrequentIDs(List(46, 94, 90, 23, 20, 54, 45, 51, 63, 97, 13, 57, 8, 19, 82, 85, 36, 78, 87, 12, 3, 2, 36, 40, 61, 16, 55, 60, 44, 70),List(9, 9, 8, 9, 2, 7, 5, 6, 8, 8, 2, 6, 6, 3, 7, 7, 7, 5, 7, 10, 8, 10, -6, 7, 4, 9, 3, 2, 9, 6)), List(9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,10,10,10,10,10,10,10,10,10,10,10))
34
+ }
35
+
36
+ test("test9") {
37
+ assertEquals(Main.mostFrequentIDs(List(55, 99, 53, 91, 88, 72, 55, 77, 39),List(2, 10, 3, 5, 8, 3, 3, 10, 5)), List(2,10,10,10,10,10,10,10,10))
38
+ }
39
+
40
+ test("test10") {
41
+ assertEquals(Main.mostFrequentIDs(List(29, 8, 98, 34, 42, 36, 21, 42),List(5, 2, 6, 4, 4, 7, 7, 5)), List(5,5,6,6,6,7,7,9))
42
+ }
43
+
44
+ }
most_frequent_number_following_key_in_an_array/.DS_Store ADDED
Binary file (6.15 kB). View file
 
most_frequent_number_following_key_in_an_array/haskell_tests/Main.hs ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ module Main where
3
+ import Test.HUnit
4
+
5
+ --Program start
6
+
7
+ --Program end
8
+
9
+ -- Test cases
10
+
11
+ test1 :: Test
12
+ test1 = TestCase (assertEqual "for (mostFrequent [1,100,200,1,100] 1)," 100 (mostFrequent [1,100,200,1,100] 1))
13
+
14
+ test2 :: Test
15
+ test2 = TestCase (assertEqual "for (mostFrequent [2,2,2,2,3] 2)," 2 (mostFrequent [2,2,2,2,3] 2))
16
+
17
+
18
+ -- Grouping test cases
19
+ tests :: Test
20
+ tests = TestList [TestLabel "Test1" test1]
21
+
22
+ -- Running the tests
23
+ main :: IO Counts
24
+ main = runTestTT tests
most_frequent_number_following_key_in_an_array/java_tests/Main.java ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import static org.junit.jupiter.api.Assertions.*;
3
+ import org.junit.jupiter.api.Test;
4
+ import java.util.List;
5
+ import java.util.Arrays;
6
+ import java.util.ArrayList;
7
+ public class Main {
8
+ //Program start
9
+
10
+ //Program end
11
+
12
+ @Test
13
+ public void test1() {
14
+ assertEquals(100, mostFrequent(new ArrayList<>(Arrays.asList(1,100,200,1,100)), 1));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals(2, mostFrequent(new ArrayList<>(Arrays.asList(2,2,2,2,3)), 2));
19
+ }
20
+
21
+ }
most_frequent_number_following_key_in_an_array/meta.json ADDED
The diff for this file is too large to render. See raw diff
 
most_frequent_number_following_key_in_an_array/ocaml_tests/main.ml ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ module Main = struct
3
+ open OUnit2
4
+
5
+ (* Program start *)
6
+
7
+ (* Program end *)
8
+
9
+ (* Test cases *)
10
+
11
+ let test1 _ = assert_equal 100 (mostFrequent [1;100;200;1;100] 1)
12
+
13
+ let test2 _ = assert_equal 2 (mostFrequent [2;2;2;2;3] 2)
14
+
15
+
16
+ (* Grouping test cases *)
17
+ let suite = "Test Suite for mostFrequent" >::: [
18
+
19
+ "test1" >:: test1;
20
+ "test2" >:: test2;
21
+ ]
22
+
23
+
24
+ (* Running the tests *)
25
+ let () = run_test_tt_main suite
26
+ end
most_frequent_number_following_key_in_an_array/scala_tests/MySuite.scala ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ class MySuite extends munit.FunSuite {
3
+
4
+ test("test1") {
5
+ assertEquals(Main.mostFrequent(List(1,100,200,1,100),1), 100)
6
+ }
7
+
8
+ test("test2") {
9
+ assertEquals(Main.mostFrequent(List(2,2,2,2,3),2), 2)
10
+ }
11
+
12
+ }
most_frequent_prime/haskell_tests/Main.hs ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ module Main where
3
+ import Test.HUnit
4
+
5
+ --Program start
6
+ mostFrequentPrime :: [[Int]] -> Int
7
+ mostFrequentPrime mat = undefined
8
+
9
+ --Program end
10
+
11
+ -- Test cases
12
+
13
+ test1 :: Test
14
+ test1 = TestCase (assertEqual "for (mostFrequentPrime [[1,1],[9,9],[1,1]])," 19 (mostFrequentPrime [[1,1],[9,9],[1,1]]))
15
+
16
+ test2 :: Test
17
+ test2 = TestCase (assertEqual "for (mostFrequentPrime [[7]])," (-1) (mostFrequentPrime [[7]]))
18
+
19
+ test3 :: Test
20
+ test3 = TestCase (assertEqual "for (mostFrequentPrime [[9,7,8],[4,6,5],[2,8,6]])," 97 (mostFrequentPrime [[9,7,8],[4,6,5],[2,8,6]]))
21
+
22
+ test4 :: Test
23
+ test4 = TestCase (assertEqual "for (mostFrequentPrime [[8, 7], [6, 7]])," 67 (mostFrequentPrime [[8, 7], [6, 7]]))
24
+
25
+ test5 :: Test
26
+ test5 = TestCase (assertEqual "for (mostFrequentPrime [[6, 3, 6], [9, 4, 2], [7, 2, 3]])," 23 (mostFrequentPrime [[6, 3, 6], [9, 4, 2], [7, 2, 3]]))
27
+
28
+ test6 :: Test
29
+ test6 = TestCase (assertEqual "for (mostFrequentPrime [[7], [2]])," (-1) (mostFrequentPrime [[7], [2]]))
30
+
31
+ test7 :: Test
32
+ test7 = TestCase (assertEqual "for (mostFrequentPrime [[7, 9, 6], [6, 8, 4], [8, 4, 4], [9, 1, 1], [4, 2, 8], [9, 2, 9]])," 41 (mostFrequentPrime [[7, 9, 6], [6, 8, 4], [8, 4, 4], [9, 1, 1], [4, 2, 8], [9, 2, 9]]))
33
+
34
+ test8 :: Test
35
+ test8 = TestCase (assertEqual "for (mostFrequentPrime [[4, 6, 5], [7, 4, 1], [4, 1, 5], [8, 3, 1], [2, 5, 1], [4, 5, 9]])," 11 (mostFrequentPrime [[4, 6, 5], [7, 4, 1], [4, 1, 5], [8, 3, 1], [2, 5, 1], [4, 5, 9]]))
36
+
37
+
38
+ -- Grouping test cases
39
+ tests :: Test
40
+ tests = TestList [TestLabel "Test1" test1, TestLabel "Test2" test2, TestLabel "Test3" test3, TestLabel "Test4" test4, TestLabel "Test5" test5, TestLabel "Test6" test6, TestLabel "Test7" test7]
41
+
42
+ -- Running the tests
43
+ main :: IO Counts
44
+ main = runTestTT tests
most_frequent_prime/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(19, mostFrequentPrime(Arrays.asList(Arrays.asList(1,1),Arrays.asList(9,9),Arrays.asList(1,1))));
14
+ }
15
+ @Test
16
+ public void test2() {
17
+ assertEquals(-1, mostFrequentPrime(Arrays.asList(Arrays.asList(7))));
18
+ }
19
+ @Test
20
+ public void test3() {
21
+ assertEquals(97, mostFrequentPrime(Arrays.asList(Arrays.asList(9,7,8),Arrays.asList(4,6,5),Arrays.asList(2,8,6))));
22
+ }
23
+
24
+ }
most_frequent_prime/meta.json ADDED
@@ -0,0 +1,146 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "id": 3314,
3
+ "name": "most_frequent_prime",
4
+ "difficulty": "Medium",
5
+ "link": "https://leetcode.com/problems/most-frequent-prime/",
6
+ "date": "2024-02-11 00:00:00",
7
+ "task_description": "You are given a `m x n` **0-indexed **2D** **matrix `mat`. From every cell, you can create numbers in the following way: There could be at most `8` paths from the cells namely: east, south-east, south, south-west, west, north-west, north, and north-east. Select a path from them and append digits in this path to the number being formed by traveling in this direction. Note that numbers are generated at every step, for example, if the digits along the path are `1, 9, 1`, then there will be three numbers generated along the way: `1, 19, 191`. Return _the most frequent prime number **greater** than _`10`_ out of all the numbers created by traversing the matrix or _`-1`_ if no such prime number exists. If there are multiple prime numbers with the highest frequency, then return the largest among them._ **Note:** It is invalid to change the direction during the move. **Example 1:** ** ** ``` ** Input:** mat = [[1,1],[9,9],[1,1]] **Output:** 19 **Explanation:** From cell (0,0) there are 3 possible directions and the numbers greater than 10 which can be created in those directions are: East: [11], South-East: [19], South: [19,191]. Numbers greater than 10 created from the cell (0,1) in all possible directions are: [19,191,19,11]. Numbers greater than 10 created from the cell (1,0) in all possible directions are: [99,91,91,91,91]. Numbers greater than 10 created from the cell (1,1) in all possible directions are: [91,91,99,91,91]. Numbers greater than 10 created from the cell (2,0) in all possible directions are: [11,19,191,19]. Numbers greater than 10 created from the cell (2,1) in all possible directions are: [11,19,19,191]. The most frequent prime number among all the created numbers is 19. ``` **Example 2:** ``` **Input:** mat = [[7]] **Output:** -1 **Explanation:** The only number which can be formed is 7. It is a prime number however it is not greater than 10, so return -1. ``` **Example 3:** ``` **Input:** mat = [[9,7,8],[4,6,5],[2,8,6]] **Output:** 97 **Explanation:** Numbers greater than 10 created from the cell (0,0) in all possible directions are: [97,978,96,966,94,942]. Numbers greater than 10 created from the cell (0,1) in all possible directions are: [78,75,76,768,74,79]. Numbers greater than 10 created from the cell (0,2) in all possible directions are: [85,856,86,862,87,879]. Numbers greater than 10 created from the cell (1,0) in all possible directions are: [46,465,48,42,49,47]. Numbers greater than 10 created from the cell (1,1) in all possible directions are: [65,66,68,62,64,69,67,68]. Numbers greater than 10 created from the cell (1,2) in all possible directions are: [56,58,56,564,57,58]. Numbers greater than 10 created from the cell (2,0) in all possible directions are: [28,286,24,249,26,268]. Numbers greater than 10 created from the cell (2,1) in all possible directions are: [86,82,84,86,867,85]. Numbers greater than 10 created from the cell (2,2) in all possible directions are: [68,682,66,669,65,658]. The most frequent prime number among all the created numbers is 97. ``` **Constraints:** `m == mat.length` `n == mat[i].length` `1 <= m, n <= 6` `1 <= mat[i][j] <= 9`",
8
+ "public_test_cases": [
9
+ {
10
+ "label": "Example 1",
11
+ "input": "mat = [[1,1],[9,9],[1,1]]",
12
+ "output": "19 "
13
+ },
14
+ {
15
+ "label": "Example 2",
16
+ "input": "mat = [[7]]",
17
+ "output": "-1 "
18
+ },
19
+ {
20
+ "label": "Example 3",
21
+ "input": "mat = [[9,7,8],[4,6,5],[2,8,6]]",
22
+ "output": "97 "
23
+ }
24
+ ],
25
+ "private_test_cases": [
26
+ {
27
+ "input": [
28
+ [
29
+ 8,
30
+ 7
31
+ ],
32
+ [
33
+ 6,
34
+ 7
35
+ ]
36
+ ],
37
+ "output": 67
38
+ },
39
+ {
40
+ "input": [
41
+ [
42
+ 6,
43
+ 3,
44
+ 6
45
+ ],
46
+ [
47
+ 9,
48
+ 4,
49
+ 2
50
+ ],
51
+ [
52
+ 7,
53
+ 2,
54
+ 3
55
+ ]
56
+ ],
57
+ "output": 23
58
+ },
59
+ {
60
+ "input": [
61
+ [
62
+ 7
63
+ ],
64
+ [
65
+ 2
66
+ ]
67
+ ],
68
+ "output": -1
69
+ },
70
+ {
71
+ "input": [
72
+ [
73
+ 7,
74
+ 9,
75
+ 6
76
+ ],
77
+ [
78
+ 6,
79
+ 8,
80
+ 4
81
+ ],
82
+ [
83
+ 8,
84
+ 4,
85
+ 4
86
+ ],
87
+ [
88
+ 9,
89
+ 1,
90
+ 1
91
+ ],
92
+ [
93
+ 4,
94
+ 2,
95
+ 8
96
+ ],
97
+ [
98
+ 9,
99
+ 2,
100
+ 9
101
+ ]
102
+ ],
103
+ "output": 41
104
+ },
105
+ {
106
+ "input": [
107
+ [
108
+ 4,
109
+ 6,
110
+ 5
111
+ ],
112
+ [
113
+ 7,
114
+ 4,
115
+ 1
116
+ ],
117
+ [
118
+ 4,
119
+ 1,
120
+ 5
121
+ ],
122
+ [
123
+ 8,
124
+ 3,
125
+ 1
126
+ ],
127
+ [
128
+ 2,
129
+ 5,
130
+ 1
131
+ ],
132
+ [
133
+ 4,
134
+ 5,
135
+ 9
136
+ ]
137
+ ],
138
+ "output": 11
139
+ }
140
+ ],
141
+ "haskell_template": "mostFrequentPrime :: [[Int]] -> Int\nmostFrequentPrime mat ",
142
+ "ocaml_template": "let mostFrequentPrime (mat: int list list) : int = ",
143
+ "scala_template": "def mostFrequentPrime(mat: List[List[Int]]): Int = { \n \n}",
144
+ "java_template": "class Solution {\n public int mostFrequentPrime(int[][] mat) {\n \n }\n}",
145
+ "python_template": "class Solution(object):\n def mostFrequentPrime(self, mat):\n \"\"\"\n :type mat: List[List[int]]\n :rtype: int\n \"\"\"\n "
146
+ }
most_frequent_prime/ocaml_tests/main.ml ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ module Main = struct
3
+ open OUnit2
4
+
5
+ (* Program start *)
6
+ let mostFrequentPrime (mat: int list list) : int = failwith "Not implemented"
7
+
8
+ (* Program end *)
9
+
10
+ (* Test cases *)
11
+
12
+ let test1 _ = assert_equal 19 (mostFrequentPrime [[1;1];[9;9];[1;1]])
13
+
14
+ let test2 _ = assert_equal (-1) (mostFrequentPrime [[7]])
15
+
16
+ let test3 _ = assert_equal 97 (mostFrequentPrime [[9;7;8];[4;6;5];[2;8;6]])
17
+
18
+ let test4 _ = assert_equal 97 (mostFrequentPrime [[8; 7]; [6; 7]])
19
+
20
+ let test5 _ = assert_equal 97 (mostFrequentPrime [[6; 3; 6]; [9; 4; 2]; [7; 2; 3]])
21
+
22
+ let test6 _ = assert_equal 97 (mostFrequentPrime [[7]; [2]])
23
+
24
+ let test7 _ = assert_equal 97 (mostFrequentPrime [[7; 9; 6]; [6; 8; 4]; [8; 4; 4]; [9; 1; 1]; [4; 2; 8]; [9; 2; 9]])
25
+
26
+ let test8 _ = assert_equal 97 (mostFrequentPrime [[4; 6; 5]; [7; 4; 1]; [4; 1; 5]; [8; 3; 1]; [2; 5; 1]; [4; 5; 9]])
27
+
28
+
29
+ (* Grouping test cases *)
30
+ let suite = "Test Suite for mostFrequentPrime" >::: [
31
+
32
+ "test1" >:: test1;
33
+ "test2" >:: test2;
34
+ "test3" >:: test3;
35
+ "test4" >:: test4;
36
+ "test5" >:: test5;
37
+ "test6" >:: test6;
38
+ "test7" >:: test7;
39
+ "test8" >:: test8;
40
+ ]
41
+
42
+
43
+ (* Running the tests *)
44
+ let () = run_test_tt_main suite
45
+ end
most_frequent_prime/scala_tests/MySuite.scala ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ class MySuite extends munit.FunSuite {
3
+
4
+ test("test1") {
5
+ assertEquals(Main.mostFrequentPrime(List(List(1,1),List(9,9),List(1,1))), 19)
6
+ }
7
+
8
+ test("test2") {
9
+ assertEquals(Main.mostFrequentPrime(List(List(7))), -1)
10
+ }
11
+
12
+ test("test3") {
13
+ assertEquals(Main.mostFrequentPrime(List(List(9,7,8),List(4,6,5),List(2,8,6))), 97)
14
+ }
15
+
16
+ test("test4") {
17
+ assertEquals(Main.mostFrequentPrime(List(8, 7),List(6, 7)), 67)
18
+ }
19
+
20
+ test("test5") {
21
+ assertEquals(Main.mostFrequentPrime(List(6, 3, 6),List(9, 4, 2),List(7, 2, 3)), 23)
22
+ }
23
+
24
+ test("test6") {
25
+ assertEquals(Main.mostFrequentPrime(List(7),List(2)), -1)
26
+ }
27
+
28
+ test("test7") {
29
+ assertEquals(Main.mostFrequentPrime(List(7, 9, 6),List(6, 8, 4),List(8, 4, 4),List(9, 1, 1),List(4, 2, 8),List(9, 2, 9)), 41)
30
+ }
31
+
32
+ test("test8") {
33
+ assertEquals(Main.mostFrequentPrime(List(4, 6, 5),List(7, 4, 1),List(4, 1, 5),List(8, 3, 1),List(2, 5, 1),List(4, 5, 9)), 11)
34
+ }
35
+
36
+ }
most_popular_video_creator/.DS_Store ADDED
Binary file (6.15 kB). View file
 
most_popular_video_creator/haskell_tests/Main.hs ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ module Main where
3
+ import Test.HUnit
4
+
5
+ --Program start
6
+
7
+ --Program end
8
+
9
+ -- Test cases
10
+
11
+ test1 :: Test
12
+ test1 = TestCase (assertEqual "for (mostPopularCreator [ \"alice \", \"bob \", \"alice \", \"chris \"] [ \"one \", \"two \", \"three \", \"four \"] [5,10,5,4])," [["alice","one"],["bob","two"]] (mostPopularCreator ["alice","bob","alice","chris"] ["one","two","three","four"] [5,10,5,4]))
13
+
14
+ test2 :: Test
15
+ test2 = TestCase (assertEqual "for (mostPopularCreator [ \"alice \", \"alice \", \"alice \"] [ \"a \", \"b \", \"c \"] [1,2,2])," [["alice","b"]] (mostPopularCreator ["alice","alice","alice"] ["a","b","c"] [1,2,2]))
16
+
17
+
18
+ -- Grouping test cases
19
+ tests :: Test
20
+ tests = TestList [TestLabel "Test1" test1]
21
+
22
+ -- Running the tests
23
+ main :: IO Counts
24
+ main = runTestTT tests
most_popular_video_creator/java_tests/Main.java ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import static org.junit.jupiter.api.Assertions.*;
3
+ import org.junit.jupiter.api.Test;
4
+ import java.util.List;
5
+ import java.util.Arrays;
6
+ import java.util.ArrayList;
7
+ public class Main {
8
+ //Program start
9
+
10
+ //Program end
11
+
12
+ @Test
13
+ public void test1() {
14
+ assertEquals(new ArrayList<>(Arrays.asList(new ArrayList<>(Arrays.asList("alice","one")),new ArrayList<>(Arrays.asList("bob","two")))), mostPopularCreator(new ArrayList<>(Arrays.asList("alice","bob","alice","chris")), new ArrayList<>(Arrays.asList("one","two","three","four")), new ArrayList<>(Arrays.asList(5,10,5,4))));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals(new ArrayList<>(Arrays.asList(new ArrayList<>(Arrays.asList("alice","b")))), mostPopularCreator(new ArrayList<>(Arrays.asList("alice","alice","alice")), new ArrayList<>(Arrays.asList("a","b","c")), new ArrayList<>(Arrays.asList(1,2,2))));
19
+ }
20
+
21
+ }
most_popular_video_creator/meta.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:623220c849a88063e02d8f4624a534fb77f78fa172c53deac315cfeef9ad3a17
3
+ size 50029700
most_popular_video_creator/ocaml_tests/main.ml ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ module Main = struct
3
+ open OUnit2
4
+
5
+ (* Program start *)
6
+
7
+ (* Program end *)
8
+
9
+ (* Test cases *)
10
+
11
+ let test1 _ = assert_equal [["alice";"one"];["bob";"two"]] (mostPopularCreator ["alice";"bob";"alice";"chris"] ["one";"two";"three";"four"] [5;10;5;4])
12
+
13
+ let test2 _ = assert_equal [["alice";"b"]] (mostPopularCreator ["alice";"alice";"alice"] ["a";"b";"c"] [1;2;2])
14
+
15
+
16
+ (* Grouping test cases *)
17
+ let suite = "Test Suite for mostPopularCreator" >::: [
18
+
19
+ "test1" >:: test1;
20
+ "test2" >:: test2;
21
+ ]
22
+
23
+
24
+ (* Running the tests *)
25
+ let () = run_test_tt_main suite
26
+ end
most_popular_video_creator/scala_tests/MySuite.scala ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ class MySuite extends munit.FunSuite {
3
+
4
+ test("test1") {
5
+ assertEquals(Main.mostPopularCreator(List("alice","bob","alice","chris"),List("one","two","three","four"),List(5,10,5,4)), List(List("alice","one"),List("bob","two")))
6
+ }
7
+
8
+ test("test2") {
9
+ assertEquals(Main.mostPopularCreator(List("alice","alice","alice"),List("a","b","c"),List(1,2,2)), List(List("alice","b")))
10
+ }
11
+
12
+ }
most_profitable_path_in_a_tree/.DS_Store ADDED
Binary file (6.15 kB). View file
 
most_profitable_path_in_a_tree/haskell_tests/Main.hs ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ module Main where
3
+ import Test.HUnit
4
+
5
+ --Program start
6
+
7
+ --Program end
8
+
9
+ -- Test cases
10
+
11
+ test1 :: Test
12
+ test1 = TestCase (assertEqual "for (mostProfitablePath [[0,1],[1,2],[1,3],[3,4]] 3 [-2,4,2,-4,6])," 6 (mostProfitablePath [[0,1],[1,2],[1,3],[3,4]] 3 [-2,4,2,-4,6]))
13
+
14
+ test2 :: Test
15
+ test2 = TestCase (assertEqual "for (mostProfitablePath [[0,1]] 1 [-7280,2350])," (-7280) (mostProfitablePath [[0,1]] 1 [-7280,2350]))
16
+
17
+
18
+ -- Grouping test cases
19
+ tests :: Test
20
+ tests = TestList [TestLabel "Test1" test1]
21
+
22
+ -- Running the tests
23
+ main :: IO Counts
24
+ main = runTestTT tests
most_profitable_path_in_a_tree/java_tests/Main.java ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import static org.junit.jupiter.api.Assertions.*;
3
+ import org.junit.jupiter.api.Test;
4
+ import java.util.List;
5
+ import java.util.Arrays;
6
+ import java.util.ArrayList;
7
+ public class Main {
8
+ //Program start
9
+
10
+ //Program end
11
+
12
+ @Test
13
+ public void test1() {
14
+ assertEquals(6, mostProfitablePath(new ArrayList<>(Arrays.asList(new ArrayList<>(Arrays.asList(0,1)),new ArrayList<>(Arrays.asList(1,2)),new ArrayList<>(Arrays.asList(1,3)),new ArrayList<>(Arrays.asList(3,4)))), 3, new ArrayList<>(Arrays.asList(-2,4,2,-4,6))));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals(-7280, mostProfitablePath(new ArrayList<>(Arrays.asList(new ArrayList<>(Arrays.asList(0,1)))), 1, new ArrayList<>(Arrays.asList(-7280,2350))));
19
+ }
20
+
21
+ }
most_profitable_path_in_a_tree/meta.json ADDED
@@ -0,0 +1,2792 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "id": 2564,
3
+ "name": "most_profitable_path_in_a_tree",
4
+ "difficulty": "Medium",
5
+ "link": "https://leetcode.com/problems/most-profitable-path-in-a-tree/",
6
+ "date": "1667001600000",
7
+ "task_description": "There is an undirected tree with `n` nodes labeled from `0` to `n - 1`, rooted at node `0`. You are given a 2D integer array `edges` of length `n - 1` where `edges[i] = [ai, bi]` indicates that there is an edge between nodes `ai` and `bi` in the tree. At every node `i`, there is a gate. You are also given an array of even integers `amount`, where `amount[i]` represents: the price needed to open the gate at node `i`, if `amount[i]` is negative, or, the cash reward obtained on opening the gate at node `i`, otherwise. The game goes on as follows: Initially, Alice is at node `0` and Bob is at node `bob`. At every second, Alice and Bob each move to an adjacent node. Alice moves towards some **leaf node**, while Bob moves towards node `0`. For **every** node along their path, Alice and Bob either spend money to open the gate at that node, or accept the reward. Note that: If the gate is **already open**, no price will be required, nor will there be any cash reward. If Alice and Bob reach the node **simultaneously**, they share the price/reward for opening the gate there. In other words, if the price to open the gate is `c`, then both Alice and Bob pay `c / 2` each. Similarly, if the reward at the gate is `c`, both of them receive `c / 2` each. If Alice reaches a leaf node, she stops moving. Similarly, if Bob reaches node `0`, he stops moving. Note that these events are **independent** of each other. Return_ the **maximum** net income Alice can have if she travels towards the optimal leaf node._ **Example 1:** ``` **Input:** edges = [[0,1],[1,2],[1,3],[3,4]], bob = 3, amount = [-2,4,2,-4,6] **Output:** 6 **Explanation:** The above diagram represents the given tree. The game goes as follows: - Alice is initially on node 0, Bob on node 3. They open the gates of their respective nodes. Alice's net income is now -2. - Both Alice and Bob move to node 1. Since they reach here simultaneously, they open the gate together and share the reward. Alice's net income becomes -2 + (4 / 2) = 0. - Alice moves on to node 3. Since Bob already opened its gate, Alice's income remains unchanged. Bob moves on to node 0, and stops moving. - Alice moves on to node 4 and opens the gate there. Her net income becomes 0 + 6 = 6. Now, neither Alice nor Bob can make any further moves, and the game ends. It is not possible for Alice to get a higher net income. ``` **Example 2:** ``` **Input:** edges = [[0,1]], bob = 1, amount = [-7280,2350] **Output:** -7280 **Explanation:** Alice follows the path 0->1 whereas Bob follows the path 1->0. Thus, Alice opens the gate at node 0 only. Hence, her net income is -7280. ``` **Constraints:** `2 <= n <= 105` `edges.length == n - 1` `edges[i].length == 2` `0 <= ai, bi < n` `ai != bi` `edges` represents a valid tree. `1 <= bob < n` `amount.length == n` `amount[i]` is an **even** integer in the range `[-104, 104]`.",
8
+ "public_test_cases": [
9
+ {
10
+ "label": "Example 1",
11
+ "input": "edges = [[0,1],[1,2],[1,3],[3,4]], bob = 3, amount = [-2,4,2,-4,6]",
12
+ "output": "6 "
13
+ },
14
+ {
15
+ "label": "Example 2",
16
+ "input": "edges = [[0,1]], bob = 1, amount = [-7280,2350]",
17
+ "output": "-7280 "
18
+ }
19
+ ],
20
+ "private_test_cases": [
21
+ {
22
+ "input": [
23
+ [
24
+ [
25
+ 0,
26
+ 1
27
+ ],
28
+ [
29
+ 0,
30
+ 2
31
+ ],
32
+ [
33
+ 1,
34
+ 3
35
+ ],
36
+ [
37
+ 0,
38
+ 4
39
+ ],
40
+ [
41
+ 0,
42
+ 5
43
+ ],
44
+ [
45
+ 4,
46
+ 6
47
+ ],
48
+ [
49
+ 1,
50
+ 7
51
+ ],
52
+ [
53
+ 2,
54
+ 8
55
+ ],
56
+ [
57
+ 6,
58
+ 9
59
+ ],
60
+ [
61
+ 6,
62
+ 10
63
+ ],
64
+ [
65
+ 10,
66
+ 11
67
+ ],
68
+ [
69
+ 1,
70
+ 12
71
+ ],
72
+ [
73
+ 6,
74
+ 13
75
+ ],
76
+ [
77
+ 12,
78
+ 14
79
+ ],
80
+ [
81
+ 0,
82
+ 15
83
+ ]
84
+ ],
85
+ 13,
86
+ [
87
+ 18,
88
+ 42,
89
+ 64,
90
+ -68,
91
+ -80,
92
+ -28,
93
+ 78,
94
+ -78,
95
+ 16,
96
+ 60,
97
+ 42,
98
+ -100,
99
+ 52,
100
+ 26,
101
+ 6,
102
+ -80
103
+ ]
104
+ ],
105
+ "output": 118
106
+ },
107
+ {
108
+ "input": [
109
+ [
110
+ [
111
+ 0,
112
+ 1
113
+ ],
114
+ [
115
+ 0,
116
+ 2
117
+ ],
118
+ [
119
+ 2,
120
+ 3
121
+ ],
122
+ [
123
+ 1,
124
+ 4
125
+ ],
126
+ [
127
+ 3,
128
+ 5
129
+ ],
130
+ [
131
+ 2,
132
+ 6
133
+ ],
134
+ [
135
+ 5,
136
+ 7
137
+ ],
138
+ [
139
+ 7,
140
+ 8
141
+ ],
142
+ [
143
+ 1,
144
+ 9
145
+ ],
146
+ [
147
+ 1,
148
+ 10
149
+ ],
150
+ [
151
+ 8,
152
+ 11
153
+ ],
154
+ [
155
+ 5,
156
+ 12
157
+ ],
158
+ [
159
+ 1,
160
+ 13
161
+ ],
162
+ [
163
+ 13,
164
+ 14
165
+ ],
166
+ [
167
+ 8,
168
+ 15
169
+ ],
170
+ [
171
+ 12,
172
+ 16
173
+ ],
174
+ [
175
+ 2,
176
+ 17
177
+ ],
178
+ [
179
+ 6,
180
+ 18
181
+ ],
182
+ [
183
+ 6,
184
+ 19
185
+ ],
186
+ [
187
+ 6,
188
+ 20
189
+ ],
190
+ [
191
+ 8,
192
+ 21
193
+ ],
194
+ [
195
+ 7,
196
+ 22
197
+ ],
198
+ [
199
+ 8,
200
+ 23
201
+ ],
202
+ [
203
+ 1,
204
+ 24
205
+ ],
206
+ [
207
+ 13,
208
+ 25
209
+ ],
210
+ [
211
+ 20,
212
+ 26
213
+ ],
214
+ [
215
+ 14,
216
+ 27
217
+ ],
218
+ [
219
+ 5,
220
+ 28
221
+ ],
222
+ [
223
+ 15,
224
+ 29
225
+ ],
226
+ [
227
+ 29,
228
+ 30
229
+ ],
230
+ [
231
+ 29,
232
+ 31
233
+ ],
234
+ [
235
+ 24,
236
+ 32
237
+ ],
238
+ [
239
+ 22,
240
+ 33
241
+ ],
242
+ [
243
+ 6,
244
+ 34
245
+ ],
246
+ [
247
+ 14,
248
+ 35
249
+ ],
250
+ [
251
+ 31,
252
+ 36
253
+ ],
254
+ [
255
+ 4,
256
+ 37
257
+ ],
258
+ [
259
+ 12,
260
+ 38
261
+ ],
262
+ [
263
+ 21,
264
+ 39
265
+ ],
266
+ [
267
+ 34,
268
+ 40
269
+ ],
270
+ [
271
+ 22,
272
+ 41
273
+ ],
274
+ [
275
+ 37,
276
+ 42
277
+ ],
278
+ [
279
+ 34,
280
+ 43
281
+ ],
282
+ [
283
+ 19,
284
+ 44
285
+ ],
286
+ [
287
+ 4,
288
+ 45
289
+ ],
290
+ [
291
+ 7,
292
+ 46
293
+ ],
294
+ [
295
+ 39,
296
+ 47
297
+ ],
298
+ [
299
+ 15,
300
+ 48
301
+ ],
302
+ [
303
+ 22,
304
+ 49
305
+ ],
306
+ [
307
+ 38,
308
+ 50
309
+ ],
310
+ [
311
+ 38,
312
+ 51
313
+ ],
314
+ [
315
+ 23,
316
+ 52
317
+ ],
318
+ [
319
+ 50,
320
+ 53
321
+ ],
322
+ [
323
+ 24,
324
+ 54
325
+ ],
326
+ [
327
+ 0,
328
+ 55
329
+ ],
330
+ [
331
+ 22,
332
+ 56
333
+ ],
334
+ [
335
+ 38,
336
+ 57
337
+ ],
338
+ [
339
+ 5,
340
+ 58
341
+ ],
342
+ [
343
+ 47,
344
+ 59
345
+ ],
346
+ [
347
+ 53,
348
+ 60
349
+ ],
350
+ [
351
+ 60,
352
+ 61
353
+ ],
354
+ [
355
+ 4,
356
+ 62
357
+ ],
358
+ [
359
+ 18,
360
+ 63
361
+ ],
362
+ [
363
+ 19,
364
+ 64
365
+ ],
366
+ [
367
+ 34,
368
+ 65
369
+ ],
370
+ [
371
+ 0,
372
+ 66
373
+ ],
374
+ [
375
+ 60,
376
+ 67
377
+ ],
378
+ [
379
+ 9,
380
+ 68
381
+ ],
382
+ [
383
+ 14,
384
+ 69
385
+ ],
386
+ [
387
+ 3,
388
+ 70
389
+ ],
390
+ [
391
+ 11,
392
+ 71
393
+ ],
394
+ [
395
+ 12,
396
+ 72
397
+ ],
398
+ [
399
+ 9,
400
+ 73
401
+ ],
402
+ [
403
+ 30,
404
+ 74
405
+ ],
406
+ [
407
+ 54,
408
+ 75
409
+ ],
410
+ [
411
+ 54,
412
+ 76
413
+ ],
414
+ [
415
+ 19,
416
+ 77
417
+ ],
418
+ [
419
+ 63,
420
+ 78
421
+ ],
422
+ [
423
+ 64,
424
+ 79
425
+ ],
426
+ [
427
+ 53,
428
+ 80
429
+ ],
430
+ [
431
+ 44,
432
+ 81
433
+ ],
434
+ [
435
+ 61,
436
+ 82
437
+ ],
438
+ [
439
+ 0,
440
+ 83
441
+ ],
442
+ [
443
+ 80,
444
+ 84
445
+ ],
446
+ [
447
+ 78,
448
+ 85
449
+ ],
450
+ [
451
+ 82,
452
+ 86
453
+ ],
454
+ [
455
+ 50,
456
+ 87
457
+ ],
458
+ [
459
+ 79,
460
+ 88
461
+ ],
462
+ [
463
+ 31,
464
+ 89
465
+ ],
466
+ [
467
+ 80,
468
+ 90
469
+ ],
470
+ [
471
+ 6,
472
+ 91
473
+ ],
474
+ [
475
+ 9,
476
+ 92
477
+ ],
478
+ [
479
+ 4,
480
+ 93
481
+ ],
482
+ [
483
+ 29,
484
+ 94
485
+ ],
486
+ [
487
+ 14,
488
+ 95
489
+ ],
490
+ [
491
+ 18,
492
+ 96
493
+ ],
494
+ [
495
+ 54,
496
+ 97
497
+ ],
498
+ [
499
+ 89,
500
+ 98
501
+ ],
502
+ [
503
+ 51,
504
+ 99
505
+ ],
506
+ [
507
+ 64,
508
+ 100
509
+ ],
510
+ [
511
+ 12,
512
+ 101
513
+ ]
514
+ ],
515
+ 93,
516
+ [
517
+ 6,
518
+ 34,
519
+ -48,
520
+ -42,
521
+ -28,
522
+ -34,
523
+ 70,
524
+ -46,
525
+ -16,
526
+ -80,
527
+ -20,
528
+ 70,
529
+ -8,
530
+ 28,
531
+ -78,
532
+ 22,
533
+ 88,
534
+ -40,
535
+ 0,
536
+ -94,
537
+ 70,
538
+ 86,
539
+ -78,
540
+ 32,
541
+ 0,
542
+ -104,
543
+ 46,
544
+ 90,
545
+ 84,
546
+ 84,
547
+ -98,
548
+ -48,
549
+ 22,
550
+ 86,
551
+ 86,
552
+ 76,
553
+ 62,
554
+ -8,
555
+ 60,
556
+ -96,
557
+ -34,
558
+ -20,
559
+ -72,
560
+ -52,
561
+ -104,
562
+ 40,
563
+ 80,
564
+ 40,
565
+ -76,
566
+ -92,
567
+ -102,
568
+ -30,
569
+ -20,
570
+ 0,
571
+ -8,
572
+ 8,
573
+ 72,
574
+ -12,
575
+ 58,
576
+ -94,
577
+ 44,
578
+ 92,
579
+ -16,
580
+ 24,
581
+ -76,
582
+ -22,
583
+ -14,
584
+ -40,
585
+ -72,
586
+ -22,
587
+ 68,
588
+ -58,
589
+ 52,
590
+ 90,
591
+ 38,
592
+ -4,
593
+ -92,
594
+ -48,
595
+ 66,
596
+ 92,
597
+ 80,
598
+ 42,
599
+ 98,
600
+ -88,
601
+ 20,
602
+ -100,
603
+ 14,
604
+ 24,
605
+ -16,
606
+ 12,
607
+ 56,
608
+ -34,
609
+ 78,
610
+ -60,
611
+ -38,
612
+ 70,
613
+ -20,
614
+ 36,
615
+ -82,
616
+ -38,
617
+ 16,
618
+ 38
619
+ ]
620
+ ],
621
+ "output": 144
622
+ },
623
+ {
624
+ "input": [
625
+ [
626
+ [
627
+ 0,
628
+ 1
629
+ ],
630
+ [
631
+ 0,
632
+ 2
633
+ ],
634
+ [
635
+ 2,
636
+ 3
637
+ ],
638
+ [
639
+ 2,
640
+ 4
641
+ ],
642
+ [
643
+ 3,
644
+ 5
645
+ ],
646
+ [
647
+ 5,
648
+ 6
649
+ ],
650
+ [
651
+ 0,
652
+ 7
653
+ ],
654
+ [
655
+ 2,
656
+ 8
657
+ ],
658
+ [
659
+ 7,
660
+ 9
661
+ ],
662
+ [
663
+ 3,
664
+ 10
665
+ ],
666
+ [
667
+ 8,
668
+ 11
669
+ ],
670
+ [
671
+ 11,
672
+ 12
673
+ ],
674
+ [
675
+ 8,
676
+ 13
677
+ ],
678
+ [
679
+ 1,
680
+ 14
681
+ ],
682
+ [
683
+ 0,
684
+ 15
685
+ ],
686
+ [
687
+ 7,
688
+ 16
689
+ ],
690
+ [
691
+ 1,
692
+ 17
693
+ ],
694
+ [
695
+ 13,
696
+ 18
697
+ ],
698
+ [
699
+ 2,
700
+ 19
701
+ ],
702
+ [
703
+ 9,
704
+ 20
705
+ ],
706
+ [
707
+ 19,
708
+ 21
709
+ ],
710
+ [
711
+ 2,
712
+ 22
713
+ ],
714
+ [
715
+ 4,
716
+ 23
717
+ ],
718
+ [
719
+ 19,
720
+ 24
721
+ ],
722
+ [
723
+ 18,
724
+ 25
725
+ ],
726
+ [
727
+ 19,
728
+ 26
729
+ ],
730
+ [
731
+ 12,
732
+ 27
733
+ ],
734
+ [
735
+ 25,
736
+ 28
737
+ ],
738
+ [
739
+ 4,
740
+ 29
741
+ ],
742
+ [
743
+ 19,
744
+ 30
745
+ ],
746
+ [
747
+ 1,
748
+ 31
749
+ ],
750
+ [
751
+ 14,
752
+ 32
753
+ ],
754
+ [
755
+ 19,
756
+ 33
757
+ ],
758
+ [
759
+ 10,
760
+ 34
761
+ ],
762
+ [
763
+ 28,
764
+ 35
765
+ ],
766
+ [
767
+ 30,
768
+ 36
769
+ ],
770
+ [
771
+ 28,
772
+ 37
773
+ ],
774
+ [
775
+ 16,
776
+ 38
777
+ ],
778
+ [
779
+ 37,
780
+ 39
781
+ ],
782
+ [
783
+ 7,
784
+ 40
785
+ ],
786
+ [
787
+ 19,
788
+ 41
789
+ ],
790
+ [
791
+ 34,
792
+ 42
793
+ ],
794
+ [
795
+ 32,
796
+ 43
797
+ ],
798
+ [
799
+ 42,
800
+ 44
801
+ ],
802
+ [
803
+ 40,
804
+ 45
805
+ ],
806
+ [
807
+ 6,
808
+ 46
809
+ ],
810
+ [
811
+ 46,
812
+ 47
813
+ ],
814
+ [
815
+ 35,
816
+ 48
817
+ ],
818
+ [
819
+ 12,
820
+ 49
821
+ ],
822
+ [
823
+ 42,
824
+ 50
825
+ ],
826
+ [
827
+ 19,
828
+ 51
829
+ ],
830
+ [
831
+ 28,
832
+ 52
833
+ ],
834
+ [
835
+ 15,
836
+ 53
837
+ ],
838
+ [
839
+ 41,
840
+ 54
841
+ ],
842
+ [
843
+ 53,
844
+ 55
845
+ ],
846
+ [
847
+ 0,
848
+ 56
849
+ ]
850
+ ],
851
+ 1,
852
+ [
853
+ -60,
854
+ 54,
855
+ 0,
856
+ -20,
857
+ 80,
858
+ 20,
859
+ 12,
860
+ -72,
861
+ -52,
862
+ 84,
863
+ 96,
864
+ 96,
865
+ -86,
866
+ 62,
867
+ 24,
868
+ -8,
869
+ -38,
870
+ -36,
871
+ 0,
872
+ 96,
873
+ 74,
874
+ 62,
875
+ 96,
876
+ 14,
877
+ 100,
878
+ 6,
879
+ -64,
880
+ -58,
881
+ -40,
882
+ 22,
883
+ -20,
884
+ -12,
885
+ 102,
886
+ -76,
887
+ -56,
888
+ 94,
889
+ 28,
890
+ 0,
891
+ -2,
892
+ -50,
893
+ -32,
894
+ 100,
895
+ 96,
896
+ -62,
897
+ -36,
898
+ 28,
899
+ -100,
900
+ 2,
901
+ 82,
902
+ 32,
903
+ 48,
904
+ -62,
905
+ -70,
906
+ -64,
907
+ -6,
908
+ -46,
909
+ 16
910
+ ]
911
+ ],
912
+ "output": 136
913
+ },
914
+ {
915
+ "input": [
916
+ [
917
+ [
918
+ 0,
919
+ 1
920
+ ],
921
+ [
922
+ 1,
923
+ 2
924
+ ],
925
+ [
926
+ 1,
927
+ 3
928
+ ],
929
+ [
930
+ 3,
931
+ 4
932
+ ],
933
+ [
934
+ 2,
935
+ 5
936
+ ],
937
+ [
938
+ 0,
939
+ 6
940
+ ],
941
+ [
942
+ 5,
943
+ 7
944
+ ],
945
+ [
946
+ 3,
947
+ 8
948
+ ],
949
+ [
950
+ 6,
951
+ 9
952
+ ],
953
+ [
954
+ 6,
955
+ 10
956
+ ],
957
+ [
958
+ 3,
959
+ 11
960
+ ],
961
+ [
962
+ 1,
963
+ 12
964
+ ],
965
+ [
966
+ 4,
967
+ 13
968
+ ],
969
+ [
970
+ 1,
971
+ 14
972
+ ],
973
+ [
974
+ 7,
975
+ 15
976
+ ],
977
+ [
978
+ 6,
979
+ 16
980
+ ],
981
+ [
982
+ 6,
983
+ 17
984
+ ],
985
+ [
986
+ 12,
987
+ 18
988
+ ],
989
+ [
990
+ 13,
991
+ 19
992
+ ],
993
+ [
994
+ 15,
995
+ 20
996
+ ],
997
+ [
998
+ 19,
999
+ 21
1000
+ ],
1001
+ [
1002
+ 17,
1003
+ 22
1004
+ ],
1005
+ [
1006
+ 1,
1007
+ 23
1008
+ ],
1009
+ [
1010
+ 17,
1011
+ 24
1012
+ ],
1013
+ [
1014
+ 1,
1015
+ 25
1016
+ ],
1017
+ [
1018
+ 11,
1019
+ 26
1020
+ ],
1021
+ [
1022
+ 18,
1023
+ 27
1024
+ ],
1025
+ [
1026
+ 16,
1027
+ 28
1028
+ ],
1029
+ [
1030
+ 21,
1031
+ 29
1032
+ ],
1033
+ [
1034
+ 19,
1035
+ 30
1036
+ ],
1037
+ [
1038
+ 6,
1039
+ 31
1040
+ ],
1041
+ [
1042
+ 12,
1043
+ 32
1044
+ ],
1045
+ [
1046
+ 17,
1047
+ 33
1048
+ ],
1049
+ [
1050
+ 27,
1051
+ 34
1052
+ ],
1053
+ [
1054
+ 31,
1055
+ 35
1056
+ ],
1057
+ [
1058
+ 25,
1059
+ 36
1060
+ ],
1061
+ [
1062
+ 17,
1063
+ 37
1064
+ ],
1065
+ [
1066
+ 20,
1067
+ 38
1068
+ ],
1069
+ [
1070
+ 33,
1071
+ 39
1072
+ ],
1073
+ [
1074
+ 28,
1075
+ 40
1076
+ ],
1077
+ [
1078
+ 20,
1079
+ 41
1080
+ ],
1081
+ [
1082
+ 29,
1083
+ 42
1084
+ ],
1085
+ [
1086
+ 12,
1087
+ 43
1088
+ ],
1089
+ [
1090
+ 29,
1091
+ 44
1092
+ ],
1093
+ [
1094
+ 37,
1095
+ 45
1096
+ ],
1097
+ [
1098
+ 44,
1099
+ 46
1100
+ ],
1101
+ [
1102
+ 37,
1103
+ 47
1104
+ ],
1105
+ [
1106
+ 30,
1107
+ 48
1108
+ ],
1109
+ [
1110
+ 45,
1111
+ 49
1112
+ ],
1113
+ [
1114
+ 32,
1115
+ 50
1116
+ ],
1117
+ [
1118
+ 48,
1119
+ 51
1120
+ ],
1121
+ [
1122
+ 50,
1123
+ 52
1124
+ ],
1125
+ [
1126
+ 9,
1127
+ 53
1128
+ ],
1129
+ [
1130
+ 9,
1131
+ 54
1132
+ ],
1133
+ [
1134
+ 5,
1135
+ 55
1136
+ ],
1137
+ [
1138
+ 50,
1139
+ 56
1140
+ ],
1141
+ [
1142
+ 53,
1143
+ 57
1144
+ ],
1145
+ [
1146
+ 28,
1147
+ 58
1148
+ ],
1149
+ [
1150
+ 29,
1151
+ 59
1152
+ ],
1153
+ [
1154
+ 46,
1155
+ 60
1156
+ ],
1157
+ [
1158
+ 32,
1159
+ 61
1160
+ ],
1161
+ [
1162
+ 15,
1163
+ 62
1164
+ ],
1165
+ [
1166
+ 41,
1167
+ 63
1168
+ ],
1169
+ [
1170
+ 61,
1171
+ 64
1172
+ ],
1173
+ [
1174
+ 17,
1175
+ 65
1176
+ ],
1177
+ [
1178
+ 12,
1179
+ 66
1180
+ ],
1181
+ [
1182
+ 17,
1183
+ 67
1184
+ ],
1185
+ [
1186
+ 42,
1187
+ 68
1188
+ ]
1189
+ ],
1190
+ 49,
1191
+ [
1192
+ 12,
1193
+ 6,
1194
+ -76,
1195
+ -104,
1196
+ -96,
1197
+ -14,
1198
+ 30,
1199
+ 88,
1200
+ -10,
1201
+ 98,
1202
+ -38,
1203
+ 66,
1204
+ 18,
1205
+ 18,
1206
+ 46,
1207
+ 36,
1208
+ -86,
1209
+ -90,
1210
+ 96,
1211
+ 20,
1212
+ -2,
1213
+ 76,
1214
+ 16,
1215
+ -52,
1216
+ 82,
1217
+ 84,
1218
+ 54,
1219
+ -4,
1220
+ 22,
1221
+ -38,
1222
+ -78,
1223
+ -22,
1224
+ 68,
1225
+ 8,
1226
+ -54,
1227
+ 60,
1228
+ 36,
1229
+ 74,
1230
+ -46,
1231
+ -60,
1232
+ -6,
1233
+ 10,
1234
+ 4,
1235
+ -100,
1236
+ -92,
1237
+ 56,
1238
+ 94,
1239
+ 70,
1240
+ 6,
1241
+ 42,
1242
+ -76,
1243
+ -36,
1244
+ 64,
1245
+ 94,
1246
+ -80,
1247
+ 62,
1248
+ -36,
1249
+ 76,
1250
+ -96,
1251
+ -88,
1252
+ -20,
1253
+ -66,
1254
+ 10,
1255
+ 0,
1256
+ 96,
1257
+ 46,
1258
+ -58,
1259
+ 28,
1260
+ 42
1261
+ ]
1262
+ ],
1263
+ "output": 310
1264
+ },
1265
+ {
1266
+ "input": [
1267
+ [
1268
+ [
1269
+ 0,
1270
+ 1
1271
+ ],
1272
+ [
1273
+ 1,
1274
+ 2
1275
+ ],
1276
+ [
1277
+ 0,
1278
+ 3
1279
+ ],
1280
+ [
1281
+ 2,
1282
+ 4
1283
+ ],
1284
+ [
1285
+ 3,
1286
+ 5
1287
+ ],
1288
+ [
1289
+ 5,
1290
+ 6
1291
+ ],
1292
+ [
1293
+ 0,
1294
+ 7
1295
+ ],
1296
+ [
1297
+ 0,
1298
+ 8
1299
+ ],
1300
+ [
1301
+ 2,
1302
+ 9
1303
+ ],
1304
+ [
1305
+ 9,
1306
+ 10
1307
+ ],
1308
+ [
1309
+ 2,
1310
+ 11
1311
+ ],
1312
+ [
1313
+ 2,
1314
+ 12
1315
+ ],
1316
+ [
1317
+ 12,
1318
+ 13
1319
+ ],
1320
+ [
1321
+ 11,
1322
+ 14
1323
+ ],
1324
+ [
1325
+ 8,
1326
+ 15
1327
+ ],
1328
+ [
1329
+ 11,
1330
+ 16
1331
+ ],
1332
+ [
1333
+ 16,
1334
+ 17
1335
+ ],
1336
+ [
1337
+ 16,
1338
+ 18
1339
+ ],
1340
+ [
1341
+ 17,
1342
+ 19
1343
+ ],
1344
+ [
1345
+ 7,
1346
+ 20
1347
+ ],
1348
+ [
1349
+ 7,
1350
+ 21
1351
+ ],
1352
+ [
1353
+ 10,
1354
+ 22
1355
+ ],
1356
+ [
1357
+ 18,
1358
+ 23
1359
+ ],
1360
+ [
1361
+ 12,
1362
+ 24
1363
+ ],
1364
+ [
1365
+ 7,
1366
+ 25
1367
+ ],
1368
+ [
1369
+ 6,
1370
+ 26
1371
+ ],
1372
+ [
1373
+ 21,
1374
+ 27
1375
+ ],
1376
+ [
1377
+ 14,
1378
+ 28
1379
+ ],
1380
+ [
1381
+ 22,
1382
+ 29
1383
+ ],
1384
+ [
1385
+ 13,
1386
+ 30
1387
+ ],
1388
+ [
1389
+ 1,
1390
+ 31
1391
+ ],
1392
+ [
1393
+ 24,
1394
+ 32
1395
+ ],
1396
+ [
1397
+ 19,
1398
+ 33
1399
+ ],
1400
+ [
1401
+ 10,
1402
+ 34
1403
+ ],
1404
+ [
1405
+ 25,
1406
+ 35
1407
+ ],
1408
+ [
1409
+ 15,
1410
+ 36
1411
+ ],
1412
+ [
1413
+ 29,
1414
+ 37
1415
+ ],
1416
+ [
1417
+ 9,
1418
+ 38
1419
+ ],
1420
+ [
1421
+ 25,
1422
+ 39
1423
+ ],
1424
+ [
1425
+ 39,
1426
+ 40
1427
+ ],
1428
+ [
1429
+ 8,
1430
+ 41
1431
+ ],
1432
+ [
1433
+ 40,
1434
+ 42
1435
+ ],
1436
+ [
1437
+ 17,
1438
+ 43
1439
+ ],
1440
+ [
1441
+ 24,
1442
+ 44
1443
+ ],
1444
+ [
1445
+ 2,
1446
+ 45
1447
+ ],
1448
+ [
1449
+ 23,
1450
+ 46
1451
+ ],
1452
+ [
1453
+ 27,
1454
+ 47
1455
+ ],
1456
+ [
1457
+ 18,
1458
+ 48
1459
+ ],
1460
+ [
1461
+ 32,
1462
+ 49
1463
+ ],
1464
+ [
1465
+ 23,
1466
+ 50
1467
+ ],
1468
+ [
1469
+ 14,
1470
+ 51
1471
+ ],
1472
+ [
1473
+ 6,
1474
+ 52
1475
+ ],
1476
+ [
1477
+ 37,
1478
+ 53
1479
+ ],
1480
+ [
1481
+ 33,
1482
+ 54
1483
+ ],
1484
+ [
1485
+ 5,
1486
+ 55
1487
+ ],
1488
+ [
1489
+ 15,
1490
+ 56
1491
+ ],
1492
+ [
1493
+ 54,
1494
+ 57
1495
+ ],
1496
+ [
1497
+ 42,
1498
+ 58
1499
+ ],
1500
+ [
1501
+ 50,
1502
+ 59
1503
+ ],
1504
+ [
1505
+ 31,
1506
+ 60
1507
+ ],
1508
+ [
1509
+ 29,
1510
+ 61
1511
+ ],
1512
+ [
1513
+ 37,
1514
+ 62
1515
+ ],
1516
+ [
1517
+ 6,
1518
+ 63
1519
+ ]
1520
+ ],
1521
+ 9,
1522
+ [
1523
+ -22,
1524
+ 24,
1525
+ -58,
1526
+ 6,
1527
+ 18,
1528
+ -92,
1529
+ -72,
1530
+ -54,
1531
+ -102,
1532
+ -78,
1533
+ -72,
1534
+ 76,
1535
+ 50,
1536
+ -78,
1537
+ -54,
1538
+ 0,
1539
+ -54,
1540
+ 90,
1541
+ 80,
1542
+ -102,
1543
+ -96,
1544
+ 102,
1545
+ 82,
1546
+ 48,
1547
+ -12,
1548
+ 62,
1549
+ -66,
1550
+ 94,
1551
+ 88,
1552
+ 28,
1553
+ -4,
1554
+ -18,
1555
+ -36,
1556
+ -12,
1557
+ 20,
1558
+ 12,
1559
+ -8,
1560
+ -68,
1561
+ 52,
1562
+ -16,
1563
+ 74,
1564
+ 18,
1565
+ 30,
1566
+ 52,
1567
+ 8,
1568
+ 8,
1569
+ 62,
1570
+ 30,
1571
+ -50,
1572
+ 92,
1573
+ -8,
1574
+ -40,
1575
+ 36,
1576
+ 92,
1577
+ -80,
1578
+ -102,
1579
+ -24,
1580
+ -6,
1581
+ -46,
1582
+ -80,
1583
+ -22,
1584
+ 70,
1585
+ -20,
1586
+ 64
1587
+ ]
1588
+ ],
1589
+ "output": 214
1590
+ },
1591
+ {
1592
+ "input": [
1593
+ [
1594
+ [
1595
+ 0,
1596
+ 1
1597
+ ],
1598
+ [
1599
+ 1,
1600
+ 2
1601
+ ],
1602
+ [
1603
+ 1,
1604
+ 3
1605
+ ],
1606
+ [
1607
+ 0,
1608
+ 4
1609
+ ],
1610
+ [
1611
+ 4,
1612
+ 5
1613
+ ],
1614
+ [
1615
+ 1,
1616
+ 6
1617
+ ],
1618
+ [
1619
+ 3,
1620
+ 7
1621
+ ],
1622
+ [
1623
+ 0,
1624
+ 8
1625
+ ],
1626
+ [
1627
+ 6,
1628
+ 9
1629
+ ],
1630
+ [
1631
+ 2,
1632
+ 10
1633
+ ],
1634
+ [
1635
+ 8,
1636
+ 11
1637
+ ],
1638
+ [
1639
+ 1,
1640
+ 12
1641
+ ],
1642
+ [
1643
+ 1,
1644
+ 13
1645
+ ],
1646
+ [
1647
+ 10,
1648
+ 14
1649
+ ],
1650
+ [
1651
+ 14,
1652
+ 15
1653
+ ],
1654
+ [
1655
+ 7,
1656
+ 16
1657
+ ],
1658
+ [
1659
+ 9,
1660
+ 17
1661
+ ],
1662
+ [
1663
+ 2,
1664
+ 18
1665
+ ],
1666
+ [
1667
+ 18,
1668
+ 19
1669
+ ],
1670
+ [
1671
+ 5,
1672
+ 20
1673
+ ],
1674
+ [
1675
+ 20,
1676
+ 21
1677
+ ],
1678
+ [
1679
+ 17,
1680
+ 22
1681
+ ],
1682
+ [
1683
+ 15,
1684
+ 23
1685
+ ],
1686
+ [
1687
+ 2,
1688
+ 24
1689
+ ],
1690
+ [
1691
+ 21,
1692
+ 25
1693
+ ],
1694
+ [
1695
+ 3,
1696
+ 26
1697
+ ],
1698
+ [
1699
+ 23,
1700
+ 27
1701
+ ],
1702
+ [
1703
+ 10,
1704
+ 28
1705
+ ],
1706
+ [
1707
+ 2,
1708
+ 29
1709
+ ],
1710
+ [
1711
+ 17,
1712
+ 30
1713
+ ],
1714
+ [
1715
+ 8,
1716
+ 31
1717
+ ],
1718
+ [
1719
+ 14,
1720
+ 32
1721
+ ],
1722
+ [
1723
+ 22,
1724
+ 33
1725
+ ],
1726
+ [
1727
+ 3,
1728
+ 34
1729
+ ],
1730
+ [
1731
+ 21,
1732
+ 35
1733
+ ],
1734
+ [
1735
+ 0,
1736
+ 36
1737
+ ],
1738
+ [
1739
+ 26,
1740
+ 37
1741
+ ],
1742
+ [
1743
+ 32,
1744
+ 38
1745
+ ],
1746
+ [
1747
+ 21,
1748
+ 39
1749
+ ],
1750
+ [
1751
+ 1,
1752
+ 40
1753
+ ],
1754
+ [
1755
+ 33,
1756
+ 41
1757
+ ],
1758
+ [
1759
+ 17,
1760
+ 42
1761
+ ],
1762
+ [
1763
+ 5,
1764
+ 43
1765
+ ],
1766
+ [
1767
+ 12,
1768
+ 44
1769
+ ],
1770
+ [
1771
+ 33,
1772
+ 45
1773
+ ],
1774
+ [
1775
+ 27,
1776
+ 46
1777
+ ],
1778
+ [
1779
+ 12,
1780
+ 47
1781
+ ],
1782
+ [
1783
+ 41,
1784
+ 48
1785
+ ],
1786
+ [
1787
+ 45,
1788
+ 49
1789
+ ],
1790
+ [
1791
+ 29,
1792
+ 50
1793
+ ],
1794
+ [
1795
+ 43,
1796
+ 51
1797
+ ],
1798
+ [
1799
+ 6,
1800
+ 52
1801
+ ],
1802
+ [
1803
+ 1,
1804
+ 53
1805
+ ],
1806
+ [
1807
+ 23,
1808
+ 54
1809
+ ],
1810
+ [
1811
+ 12,
1812
+ 55
1813
+ ],
1814
+ [
1815
+ 32,
1816
+ 56
1817
+ ],
1818
+ [
1819
+ 43,
1820
+ 57
1821
+ ],
1822
+ [
1823
+ 57,
1824
+ 58
1825
+ ],
1826
+ [
1827
+ 14,
1828
+ 59
1829
+ ],
1830
+ [
1831
+ 39,
1832
+ 60
1833
+ ],
1834
+ [
1835
+ 25,
1836
+ 61
1837
+ ],
1838
+ [
1839
+ 46,
1840
+ 62
1841
+ ],
1842
+ [
1843
+ 18,
1844
+ 63
1845
+ ],
1846
+ [
1847
+ 7,
1848
+ 64
1849
+ ],
1850
+ [
1851
+ 37,
1852
+ 65
1853
+ ],
1854
+ [
1855
+ 48,
1856
+ 66
1857
+ ],
1858
+ [
1859
+ 14,
1860
+ 67
1861
+ ],
1862
+ [
1863
+ 52,
1864
+ 68
1865
+ ],
1866
+ [
1867
+ 12,
1868
+ 69
1869
+ ],
1870
+ [
1871
+ 8,
1872
+ 70
1873
+ ],
1874
+ [
1875
+ 18,
1876
+ 71
1877
+ ],
1878
+ [
1879
+ 13,
1880
+ 72
1881
+ ],
1882
+ [
1883
+ 5,
1884
+ 73
1885
+ ],
1886
+ [
1887
+ 52,
1888
+ 74
1889
+ ],
1890
+ [
1891
+ 37,
1892
+ 75
1893
+ ],
1894
+ [
1895
+ 8,
1896
+ 76
1897
+ ],
1898
+ [
1899
+ 62,
1900
+ 77
1901
+ ],
1902
+ [
1903
+ 36,
1904
+ 78
1905
+ ],
1906
+ [
1907
+ 31,
1908
+ 79
1909
+ ]
1910
+ ],
1911
+ 48,
1912
+ [
1913
+ 18,
1914
+ 72,
1915
+ 34,
1916
+ -40,
1917
+ -62,
1918
+ 84,
1919
+ 74,
1920
+ -102,
1921
+ 0,
1922
+ 98,
1923
+ 100,
1924
+ -84,
1925
+ -62,
1926
+ -8,
1927
+ 98,
1928
+ 72,
1929
+ 86,
1930
+ -16,
1931
+ 72,
1932
+ -32,
1933
+ 16,
1934
+ -36,
1935
+ 0,
1936
+ 86,
1937
+ 30,
1938
+ 70,
1939
+ -52,
1940
+ 76,
1941
+ 8,
1942
+ 70,
1943
+ -12,
1944
+ 60,
1945
+ -92,
1946
+ 38,
1947
+ 76,
1948
+ 54,
1949
+ 32,
1950
+ -28,
1951
+ 14,
1952
+ 74,
1953
+ -8,
1954
+ -64,
1955
+ -62,
1956
+ -14,
1957
+ 2,
1958
+ 102,
1959
+ -96,
1960
+ -58,
1961
+ 44,
1962
+ -58,
1963
+ 46,
1964
+ 104,
1965
+ -14,
1966
+ 28,
1967
+ -90,
1968
+ -20,
1969
+ -88,
1970
+ 38,
1971
+ -26,
1972
+ -46,
1973
+ 98,
1974
+ 24,
1975
+ -34,
1976
+ -90,
1977
+ -70,
1978
+ -80,
1979
+ 90,
1980
+ -20,
1981
+ 96,
1982
+ -84,
1983
+ 94,
1984
+ 6,
1985
+ 104,
1986
+ -48,
1987
+ -38,
1988
+ 30,
1989
+ -10,
1990
+ -78,
1991
+ -16,
1992
+ 0
1993
+ ]
1994
+ ],
1995
+ "output": 390
1996
+ },
1997
+ {
1998
+ "input": [
1999
+ [
2000
+ [
2001
+ 0,
2002
+ 1
2003
+ ],
2004
+ [
2005
+ 0,
2006
+ 2
2007
+ ],
2008
+ [
2009
+ 0,
2010
+ 3
2011
+ ],
2012
+ [
2013
+ 3,
2014
+ 4
2015
+ ],
2016
+ [
2017
+ 4,
2018
+ 5
2019
+ ],
2020
+ [
2021
+ 2,
2022
+ 6
2023
+ ],
2024
+ [
2025
+ 3,
2026
+ 7
2027
+ ],
2028
+ [
2029
+ 0,
2030
+ 8
2031
+ ],
2032
+ [
2033
+ 8,
2034
+ 9
2035
+ ],
2036
+ [
2037
+ 3,
2038
+ 10
2039
+ ],
2040
+ [
2041
+ 1,
2042
+ 11
2043
+ ],
2044
+ [
2045
+ 10,
2046
+ 12
2047
+ ],
2048
+ [
2049
+ 2,
2050
+ 13
2051
+ ],
2052
+ [
2053
+ 11,
2054
+ 14
2055
+ ],
2056
+ [
2057
+ 11,
2058
+ 15
2059
+ ],
2060
+ [
2061
+ 12,
2062
+ 16
2063
+ ],
2064
+ [
2065
+ 9,
2066
+ 17
2067
+ ],
2068
+ [
2069
+ 13,
2070
+ 18
2071
+ ],
2072
+ [
2073
+ 5,
2074
+ 19
2075
+ ],
2076
+ [
2077
+ 12,
2078
+ 20
2079
+ ],
2080
+ [
2081
+ 19,
2082
+ 21
2083
+ ],
2084
+ [
2085
+ 4,
2086
+ 22
2087
+ ],
2088
+ [
2089
+ 3,
2090
+ 23
2091
+ ],
2092
+ [
2093
+ 10,
2094
+ 24
2095
+ ],
2096
+ [
2097
+ 11,
2098
+ 25
2099
+ ],
2100
+ [
2101
+ 5,
2102
+ 26
2103
+ ],
2104
+ [
2105
+ 12,
2106
+ 27
2107
+ ],
2108
+ [
2109
+ 9,
2110
+ 28
2111
+ ],
2112
+ [
2113
+ 18,
2114
+ 29
2115
+ ],
2116
+ [
2117
+ 13,
2118
+ 30
2119
+ ],
2120
+ [
2121
+ 14,
2122
+ 31
2123
+ ],
2124
+ [
2125
+ 10,
2126
+ 32
2127
+ ],
2128
+ [
2129
+ 0,
2130
+ 33
2131
+ ],
2132
+ [
2133
+ 14,
2134
+ 34
2135
+ ]
2136
+ ],
2137
+ 33,
2138
+ [
2139
+ 90,
2140
+ 50,
2141
+ -32,
2142
+ 102,
2143
+ -14,
2144
+ -32,
2145
+ -72,
2146
+ -8,
2147
+ -52,
2148
+ 46,
2149
+ -44,
2150
+ 86,
2151
+ 42,
2152
+ 0,
2153
+ 100,
2154
+ -86,
2155
+ -22,
2156
+ 72,
2157
+ -94,
2158
+ 92,
2159
+ -80,
2160
+ -32,
2161
+ -98,
2162
+ -90,
2163
+ -94,
2164
+ 38,
2165
+ 16,
2166
+ -28,
2167
+ 60,
2168
+ 68,
2169
+ 76,
2170
+ 12,
2171
+ -80,
2172
+ 64,
2173
+ -70
2174
+ ]
2175
+ ],
2176
+ "output": 338
2177
+ },
2178
+ {
2179
+ "input": [
2180
+ [
2181
+ [
2182
+ 0,
2183
+ 1
2184
+ ],
2185
+ [
2186
+ 1,
2187
+ 2
2188
+ ],
2189
+ [
2190
+ 0,
2191
+ 3
2192
+ ],
2193
+ [
2194
+ 3,
2195
+ 4
2196
+ ],
2197
+ [
2198
+ 1,
2199
+ 5
2200
+ ],
2201
+ [
2202
+ 2,
2203
+ 6
2204
+ ],
2205
+ [
2206
+ 5,
2207
+ 7
2208
+ ],
2209
+ [
2210
+ 3,
2211
+ 8
2212
+ ],
2213
+ [
2214
+ 0,
2215
+ 9
2216
+ ],
2217
+ [
2218
+ 1,
2219
+ 10
2220
+ ],
2221
+ [
2222
+ 3,
2223
+ 11
2224
+ ],
2225
+ [
2226
+ 4,
2227
+ 12
2228
+ ],
2229
+ [
2230
+ 9,
2231
+ 13
2232
+ ],
2233
+ [
2234
+ 6,
2235
+ 14
2236
+ ],
2237
+ [
2238
+ 9,
2239
+ 15
2240
+ ],
2241
+ [
2242
+ 6,
2243
+ 16
2244
+ ],
2245
+ [
2246
+ 16,
2247
+ 17
2248
+ ],
2249
+ [
2250
+ 10,
2251
+ 18
2252
+ ],
2253
+ [
2254
+ 13,
2255
+ 19
2256
+ ],
2257
+ [
2258
+ 15,
2259
+ 20
2260
+ ],
2261
+ [
2262
+ 1,
2263
+ 21
2264
+ ],
2265
+ [
2266
+ 2,
2267
+ 22
2268
+ ],
2269
+ [
2270
+ 22,
2271
+ 23
2272
+ ],
2273
+ [
2274
+ 23,
2275
+ 24
2276
+ ],
2277
+ [
2278
+ 19,
2279
+ 25
2280
+ ],
2281
+ [
2282
+ 8,
2283
+ 26
2284
+ ],
2285
+ [
2286
+ 4,
2287
+ 27
2288
+ ],
2289
+ [
2290
+ 7,
2291
+ 28
2292
+ ],
2293
+ [
2294
+ 20,
2295
+ 29
2296
+ ],
2297
+ [
2298
+ 29,
2299
+ 30
2300
+ ],
2301
+ [
2302
+ 20,
2303
+ 31
2304
+ ],
2305
+ [
2306
+ 1,
2307
+ 32
2308
+ ],
2309
+ [
2310
+ 26,
2311
+ 33
2312
+ ],
2313
+ [
2314
+ 24,
2315
+ 34
2316
+ ],
2317
+ [
2318
+ 9,
2319
+ 35
2320
+ ],
2321
+ [
2322
+ 28,
2323
+ 36
2324
+ ],
2325
+ [
2326
+ 25,
2327
+ 37
2328
+ ],
2329
+ [
2330
+ 0,
2331
+ 38
2332
+ ],
2333
+ [
2334
+ 19,
2335
+ 39
2336
+ ],
2337
+ [
2338
+ 17,
2339
+ 40
2340
+ ],
2341
+ [
2342
+ 37,
2343
+ 41
2344
+ ],
2345
+ [
2346
+ 8,
2347
+ 42
2348
+ ]
2349
+ ],
2350
+ 28,
2351
+ [
2352
+ -72,
2353
+ -80,
2354
+ 74,
2355
+ 60,
2356
+ -62,
2357
+ 94,
2358
+ 24,
2359
+ -2,
2360
+ 0,
2361
+ 0,
2362
+ 88,
2363
+ -86,
2364
+ -62,
2365
+ 38,
2366
+ -18,
2367
+ -104,
2368
+ 74,
2369
+ -32,
2370
+ -26,
2371
+ 58,
2372
+ -26,
2373
+ 30,
2374
+ 38,
2375
+ 6,
2376
+ -74,
2377
+ -24,
2378
+ 24,
2379
+ -70,
2380
+ 86,
2381
+ 80,
2382
+ 24,
2383
+ 18,
2384
+ -54,
2385
+ 54,
2386
+ 34,
2387
+ -92,
2388
+ -68,
2389
+ -6,
2390
+ -20,
2391
+ 4,
2392
+ 86,
2393
+ -10,
2394
+ 40
2395
+ ]
2396
+ ],
2397
+ "output": 74
2398
+ },
2399
+ {
2400
+ "input": [
2401
+ [
2402
+ [
2403
+ 0,
2404
+ 1
2405
+ ],
2406
+ [
2407
+ 1,
2408
+ 2
2409
+ ],
2410
+ [
2411
+ 0,
2412
+ 3
2413
+ ],
2414
+ [
2415
+ 2,
2416
+ 4
2417
+ ],
2418
+ [
2419
+ 2,
2420
+ 5
2421
+ ],
2422
+ [
2423
+ 5,
2424
+ 6
2425
+ ],
2426
+ [
2427
+ 2,
2428
+ 7
2429
+ ],
2430
+ [
2431
+ 5,
2432
+ 8
2433
+ ],
2434
+ [
2435
+ 2,
2436
+ 9
2437
+ ],
2438
+ [
2439
+ 8,
2440
+ 10
2441
+ ],
2442
+ [
2443
+ 5,
2444
+ 11
2445
+ ],
2446
+ [
2447
+ 3,
2448
+ 12
2449
+ ],
2450
+ [
2451
+ 10,
2452
+ 13
2453
+ ],
2454
+ [
2455
+ 1,
2456
+ 14
2457
+ ],
2458
+ [
2459
+ 11,
2460
+ 15
2461
+ ],
2462
+ [
2463
+ 2,
2464
+ 16
2465
+ ],
2466
+ [
2467
+ 15,
2468
+ 17
2469
+ ],
2470
+ [
2471
+ 15,
2472
+ 18
2473
+ ],
2474
+ [
2475
+ 9,
2476
+ 19
2477
+ ]
2478
+ ],
2479
+ 8,
2480
+ [
2481
+ -26,
2482
+ 102,
2483
+ 28,
2484
+ -86,
2485
+ -32,
2486
+ 60,
2487
+ -52,
2488
+ -88,
2489
+ 28,
2490
+ -92,
2491
+ 74,
2492
+ 78,
2493
+ 12,
2494
+ 96,
2495
+ -30,
2496
+ 104,
2497
+ 72,
2498
+ 36,
2499
+ -40,
2500
+ 8
2501
+ ]
2502
+ ],
2503
+ "output": 308
2504
+ },
2505
+ {
2506
+ "input": [
2507
+ [
2508
+ [
2509
+ 0,
2510
+ 1
2511
+ ],
2512
+ [
2513
+ 1,
2514
+ 2
2515
+ ],
2516
+ [
2517
+ 0,
2518
+ 3
2519
+ ],
2520
+ [
2521
+ 3,
2522
+ 4
2523
+ ],
2524
+ [
2525
+ 1,
2526
+ 5
2527
+ ],
2528
+ [
2529
+ 5,
2530
+ 6
2531
+ ],
2532
+ [
2533
+ 2,
2534
+ 7
2535
+ ],
2536
+ [
2537
+ 0,
2538
+ 8
2539
+ ],
2540
+ [
2541
+ 7,
2542
+ 9
2543
+ ],
2544
+ [
2545
+ 7,
2546
+ 10
2547
+ ],
2548
+ [
2549
+ 8,
2550
+ 11
2551
+ ],
2552
+ [
2553
+ 7,
2554
+ 12
2555
+ ],
2556
+ [
2557
+ 0,
2558
+ 13
2559
+ ],
2560
+ [
2561
+ 13,
2562
+ 14
2563
+ ],
2564
+ [
2565
+ 10,
2566
+ 15
2567
+ ],
2568
+ [
2569
+ 9,
2570
+ 16
2571
+ ],
2572
+ [
2573
+ 6,
2574
+ 17
2575
+ ],
2576
+ [
2577
+ 4,
2578
+ 18
2579
+ ],
2580
+ [
2581
+ 1,
2582
+ 19
2583
+ ],
2584
+ [
2585
+ 1,
2586
+ 20
2587
+ ],
2588
+ [
2589
+ 16,
2590
+ 21
2591
+ ],
2592
+ [
2593
+ 4,
2594
+ 22
2595
+ ],
2596
+ [
2597
+ 15,
2598
+ 23
2599
+ ],
2600
+ [
2601
+ 6,
2602
+ 24
2603
+ ],
2604
+ [
2605
+ 5,
2606
+ 25
2607
+ ],
2608
+ [
2609
+ 24,
2610
+ 26
2611
+ ],
2612
+ [
2613
+ 25,
2614
+ 27
2615
+ ],
2616
+ [
2617
+ 20,
2618
+ 28
2619
+ ],
2620
+ [
2621
+ 18,
2622
+ 29
2623
+ ],
2624
+ [
2625
+ 12,
2626
+ 30
2627
+ ],
2628
+ [
2629
+ 16,
2630
+ 31
2631
+ ],
2632
+ [
2633
+ 31,
2634
+ 32
2635
+ ],
2636
+ [
2637
+ 2,
2638
+ 33
2639
+ ],
2640
+ [
2641
+ 25,
2642
+ 34
2643
+ ],
2644
+ [
2645
+ 10,
2646
+ 35
2647
+ ],
2648
+ [
2649
+ 17,
2650
+ 36
2651
+ ],
2652
+ [
2653
+ 11,
2654
+ 37
2655
+ ],
2656
+ [
2657
+ 34,
2658
+ 38
2659
+ ],
2660
+ [
2661
+ 13,
2662
+ 39
2663
+ ],
2664
+ [
2665
+ 12,
2666
+ 40
2667
+ ],
2668
+ [
2669
+ 25,
2670
+ 41
2671
+ ],
2672
+ [
2673
+ 5,
2674
+ 42
2675
+ ],
2676
+ [
2677
+ 9,
2678
+ 43
2679
+ ],
2680
+ [
2681
+ 30,
2682
+ 44
2683
+ ],
2684
+ [
2685
+ 19,
2686
+ 45
2687
+ ],
2688
+ [
2689
+ 3,
2690
+ 46
2691
+ ],
2692
+ [
2693
+ 45,
2694
+ 47
2695
+ ],
2696
+ [
2697
+ 28,
2698
+ 48
2699
+ ],
2700
+ [
2701
+ 26,
2702
+ 49
2703
+ ],
2704
+ [
2705
+ 39,
2706
+ 50
2707
+ ],
2708
+ [
2709
+ 28,
2710
+ 51
2711
+ ],
2712
+ [
2713
+ 7,
2714
+ 52
2715
+ ],
2716
+ [
2717
+ 25,
2718
+ 53
2719
+ ],
2720
+ [
2721
+ 12,
2722
+ 54
2723
+ ]
2724
+ ],
2725
+ 53,
2726
+ [
2727
+ 72,
2728
+ 10,
2729
+ -70,
2730
+ 68,
2731
+ -36,
2732
+ 30,
2733
+ -78,
2734
+ -22,
2735
+ 18,
2736
+ 46,
2737
+ -26,
2738
+ -28,
2739
+ 42,
2740
+ 46,
2741
+ -100,
2742
+ -84,
2743
+ -16,
2744
+ -44,
2745
+ -72,
2746
+ 44,
2747
+ 52,
2748
+ -90,
2749
+ -104,
2750
+ -58,
2751
+ -88,
2752
+ -22,
2753
+ 6,
2754
+ -98,
2755
+ -60,
2756
+ -8,
2757
+ 6,
2758
+ -30,
2759
+ -98,
2760
+ 82,
2761
+ 34,
2762
+ -28,
2763
+ 0,
2764
+ -62,
2765
+ -80,
2766
+ 0,
2767
+ 64,
2768
+ 60,
2769
+ 70,
2770
+ -38,
2771
+ 52,
2772
+ 24,
2773
+ 0,
2774
+ 58,
2775
+ 84,
2776
+ -72,
2777
+ -74,
2778
+ -80,
2779
+ -16,
2780
+ 90,
2781
+ -42
2782
+ ]
2783
+ ],
2784
+ "output": 208
2785
+ }
2786
+ ],
2787
+ "haskell_template": "mostProfitablePath :: [[Int]] -> Int -> [Int] -> Int\nmostProfitablePath edges bob amount ",
2788
+ "ocaml_template": "let mostProfitablePath (edges: int list list) (bob: int) (amount: int list) : int = ",
2789
+ "scala_template": "def mostProfitablePath(edges: List[List[Int]],bob: Int,amount: List[Int]): Int = { \n \n}",
2790
+ "java_template": "public static int mostProfitablePath(List<List<Integer>> edges, int bob, List<Integer> amount) {\n\n}",
2791
+ "python_template": "class Solution(object):\n def mostProfitablePath(self, edges, bob, amount):\n \"\"\"\n :type edges: List[List[int]]\n :type bob: int\n :type amount: List[int]\n :rtype: int\n \"\"\"\n "
2792
+ }
most_profitable_path_in_a_tree/ocaml_tests/main.ml ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ module Main = struct
3
+ open OUnit2
4
+
5
+ (* Program start *)
6
+
7
+ (* Program end *)
8
+
9
+ (* Test cases *)
10
+
11
+ let test1 _ = assert_equal 6 (mostProfitablePath [[0;1];[1;2];[1;3];[3;4]] 3 [-2;4;2;-4;6])
12
+
13
+ let test2 _ = assert_equal (-7280) (mostProfitablePath [[0;1]] 1 [-7280;2350])
14
+
15
+
16
+ (* Grouping test cases *)
17
+ let suite = "Test Suite for mostProfitablePath" >::: [
18
+
19
+ "test1" >:: test1;
20
+ "test2" >:: test2;
21
+ ]
22
+
23
+
24
+ (* Running the tests *)
25
+ let () = run_test_tt_main suite
26
+ end