DatasetRepo commited on
Commit
690fee2
·
verified ·
1 Parent(s): 885b1d8

da0138e5ceb25a98ca1595896dc61d6c144847c0f13acffc912f4b6047c7f4d2

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 +5 -0
  2. maximum_and_sum_of_array/java_tests/Main.java +21 -0
  3. maximum_and_sum_of_array/meta.json +157 -0
  4. maximum_and_sum_of_array/ocaml_tests/main.ml +26 -0
  5. maximum_and_sum_of_array/scala_tests/MySuite.scala +12 -0
  6. maximum_area_of_longest_diagonal_rectangle/haskell_tests/Main.hs +47 -0
  7. maximum_area_of_longest_diagonal_rectangle/java_tests/Main.java +20 -0
  8. maximum_area_of_longest_diagonal_rectangle/meta.json +2497 -0
  9. maximum_area_of_longest_diagonal_rectangle/ocaml_tests/main.ml +51 -0
  10. maximum_area_of_longest_diagonal_rectangle/scala_tests/MySuite.scala +44 -0
  11. maximum_area_rectangle_with_point_constraints_i/haskell_tests/Main.hs +44 -0
  12. maximum_area_rectangle_with_point_constraints_i/java_tests/Main.java +24 -0
  13. maximum_area_rectangle_with_point_constraints_i/meta.json +185 -0
  14. maximum_area_rectangle_with_point_constraints_i/ocaml_tests/main.ml +45 -0
  15. maximum_area_rectangle_with_point_constraints_i/scala_tests/MySuite.scala +36 -0
  16. maximum_area_rectangle_with_point_constraints_ii/haskell_tests/Main.hs +45 -0
  17. maximum_area_rectangle_with_point_constraints_ii/java_tests/Main.java +25 -0
  18. maximum_area_rectangle_with_point_constraints_ii/meta.json +362 -0
  19. maximum_area_rectangle_with_point_constraints_ii/ocaml_tests/main.ml +50 -0
  20. maximum_area_rectangle_with_point_constraints_ii/scala_tests/MySuite.scala +44 -0
  21. maximum_bags_with_full_capacity_of_rocks/haskell_tests/Main.hs +0 -0
  22. maximum_bags_with_full_capacity_of_rocks/java_tests/Main.java +21 -0
  23. maximum_bags_with_full_capacity_of_rocks/meta.json +3 -0
  24. maximum_bags_with_full_capacity_of_rocks/ocaml_tests/main.ml +0 -0
  25. maximum_bags_with_full_capacity_of_rocks/scala_tests/MySuite.scala +0 -0
  26. maximum_balanced_subsequence_sum/java_tests/Main.java +24 -0
  27. maximum_beauty_of_an_array_after_applying_operation/.DS_Store +0 -0
  28. maximum_beauty_of_an_array_after_applying_operation/haskell_tests/Main.hs +24 -0
  29. maximum_beauty_of_an_array_after_applying_operation/java_tests/Main.java +21 -0
  30. maximum_beauty_of_an_array_after_applying_operation/meta.json +3 -0
  31. maximum_beauty_of_an_array_after_applying_operation/ocaml_tests/main.ml +26 -0
  32. maximum_beauty_of_an_array_after_applying_operation/scala_tests/MySuite.scala +12 -0
  33. maximum_coins_from_k_consecutive_bags/haskell_tests/Main.hs +3 -0
  34. maximum_coins_from_k_consecutive_bags/java_tests/Main.java +21 -0
  35. maximum_coins_from_k_consecutive_bags/meta.json +3 -0
  36. maximum_coins_from_k_consecutive_bags/ocaml_tests/main.ml +0 -0
  37. maximum_coins_from_k_consecutive_bags/scala_tests/MySuite.scala +0 -0
  38. maximum_consecutive_floors_without_special_floors/.DS_Store +0 -0
  39. maximum_consecutive_floors_without_special_floors/haskell_tests/Main.hs +24 -0
  40. maximum_consecutive_floors_without_special_floors/java_tests/Main.java +21 -0
  41. maximum_consecutive_floors_without_special_floors/meta.json +3 -0
  42. maximum_consecutive_floors_without_special_floors/ocaml_tests/main.ml +26 -0
  43. maximum_consecutive_floors_without_special_floors/scala_tests/MySuite.scala +12 -0
  44. maximum_containers_on_a_ship/haskell_tests/Main.hs +45 -0
  45. maximum_containers_on_a_ship/java_tests/Main.java +21 -0
  46. maximum_containers_on_a_ship/meta.json +107 -0
  47. maximum_containers_on_a_ship/ocaml_tests/main.ml +50 -0
  48. maximum_containers_on_a_ship/scala_tests/MySuite.scala +44 -0
  49. maximum_count_of_positive_integer_and_negative_integer/.DS_Store +0 -0
  50. maximum_count_of_positive_integer_and_negative_integer/haskell_tests/Main.hs +27 -0
.gitattributes CHANGED
@@ -165,3 +165,8 @@ maximize_the_profit_as_the_salesman/meta.json filter=lfs diff=lfs merge=lfs -tex
165
  maximize_value_of_function_in_a_ball_passing_game/meta.json filter=lfs diff=lfs merge=lfs -text
166
  maximize_win_from_two_segments/meta.json filter=lfs diff=lfs merge=lfs -text
167
  maximum_and_minimum_sums_of_at_most_size_k_subarrays/meta.json filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
165
  maximize_value_of_function_in_a_ball_passing_game/meta.json filter=lfs diff=lfs merge=lfs -text
166
  maximize_win_from_two_segments/meta.json filter=lfs diff=lfs merge=lfs -text
167
  maximum_and_minimum_sums_of_at_most_size_k_subarrays/meta.json filter=lfs diff=lfs merge=lfs -text
168
+ maximum_bags_with_full_capacity_of_rocks/meta.json filter=lfs diff=lfs merge=lfs -text
169
+ maximum_beauty_of_an_array_after_applying_operation/meta.json filter=lfs diff=lfs merge=lfs -text
170
+ maximum_coins_from_k_consecutive_bags/haskell_tests/Main.hs filter=lfs diff=lfs merge=lfs -text
171
+ maximum_coins_from_k_consecutive_bags/meta.json filter=lfs diff=lfs merge=lfs -text
172
+ maximum_consecutive_floors_without_special_floors/meta.json filter=lfs diff=lfs merge=lfs -text
maximum_and_sum_of_array/java_tests/Main.java ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import static org.junit.jupiter.api.Assertions.*;
3
+ import org.junit.jupiter.api.Test;
4
+ import java.util.List;
5
+ import java.util.Arrays;
6
+ import java.util.ArrayList;
7
+ public class Main {
8
+ //Program start
9
+
10
+ //Program end
11
+
12
+ @Test
13
+ public void test1() {
14
+ assertEquals(9, maximumANDSum(new ArrayList<>(Arrays.asList(1,2,3,4,5,6)), 3));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals(24, maximumANDSum(new ArrayList<>(Arrays.asList(1,3,10,4,7,1)), 9));
19
+ }
20
+
21
+ }
maximum_and_sum_of_array/meta.json ADDED
@@ -0,0 +1,157 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "id": 2291,
3
+ "name": "maximum_and_sum_of_array",
4
+ "difficulty": "Hard",
5
+ "link": "https://leetcode.com/problems/maximum-and-sum-of-array/",
6
+ "date": "1644105600000",
7
+ "task_description": "You are given an integer array `nums` of length `n` and an integer `numSlots` such that `2 * numSlots >= n`. There are `numSlots` slots numbered from `1` to `numSlots`. You have to place all `n` integers into the slots such that each slot contains at **most** two numbers. The **AND sum** of a given placement is the sum of the **bitwise** `AND` of every number with its respective slot number. For example, the **AND sum** of placing the numbers `[1, 3]` into slot `1` and `[4, 6]` into slot `2` is equal to `(1 AND 1) + (3 AND 1) + (4 AND 2) + (6 AND 2) = 1 + 1 + 0 + 2 = 4`. Return _the maximum possible **AND sum** of _`nums`_ given _`numSlots`_ slots._ **Example 1:** ``` **Input:** nums = [1,2,3,4,5,6], numSlots = 3 **Output:** 9 **Explanation:** One possible placement is [1, 4] into slot 1, [2, 6] into slot 2, and [3, 5] into slot 3. This gives the maximum AND sum of (1 AND 1) + (4 AND 1) + (2 AND 2) + (6 AND 2) + (3 AND 3) + (5 AND 3) = 1 + 0 + 2 + 2 + 3 + 1 = 9. ``` **Example 2:** ``` **Input:** nums = [1,3,10,4,7,1], numSlots = 9 **Output:** 24 **Explanation:** One possible placement is [1, 1] into slot 1, [3] into slot 3, [4] into slot 4, [7] into slot 7, and [10] into slot 9. This gives the maximum AND sum of (1 AND 1) + (1 AND 1) + (3 AND 3) + (4 AND 4) + (7 AND 7) + (10 AND 9) = 1 + 1 + 3 + 4 + 7 + 8 = 24. Note that slots 2, 5, 6, and 8 are empty which is permitted. ``` **Constraints:** `n == nums.length` `1 <= numSlots <= 9` `1 <= n <= 2 * numSlots` `1 <= nums[i] <= 15`",
8
+ "public_test_cases": [
9
+ {
10
+ "label": "Example 1",
11
+ "input": "nums = [1,2,3,4,5,6], numSlots = 3",
12
+ "output": "9 "
13
+ },
14
+ {
15
+ "label": "Example 2",
16
+ "input": "nums = [1,3,10,4,7,1], numSlots = 9",
17
+ "output": "24 "
18
+ }
19
+ ],
20
+ "private_test_cases": [
21
+ {
22
+ "input": [
23
+ [
24
+ 6
25
+ ],
26
+ 1
27
+ ],
28
+ "output": 0
29
+ },
30
+ {
31
+ "input": [
32
+ [
33
+ 2
34
+ ],
35
+ 3
36
+ ],
37
+ "output": 2
38
+ },
39
+ {
40
+ "input": [
41
+ [
42
+ 8,
43
+ 5,
44
+ 15,
45
+ 3
46
+ ],
47
+ 9
48
+ ],
49
+ "output": 25
50
+ },
51
+ {
52
+ "input": [
53
+ [
54
+ 10,
55
+ 8,
56
+ 2,
57
+ 12,
58
+ 6,
59
+ 1,
60
+ 9,
61
+ 13,
62
+ 15,
63
+ 15
64
+ ],
65
+ 7
66
+ ],
67
+ "output": 35
68
+ },
69
+ {
70
+ "input": [
71
+ [
72
+ 3,
73
+ 9,
74
+ 5,
75
+ 4,
76
+ 6,
77
+ 1
78
+ ],
79
+ 3
80
+ ],
81
+ "output": 8
82
+ },
83
+ {
84
+ "input": [
85
+ [
86
+ 9,
87
+ 15,
88
+ 12,
89
+ 10,
90
+ 6,
91
+ 6,
92
+ 10,
93
+ 10,
94
+ 14,
95
+ 12
96
+ ],
97
+ 9
98
+ ],
99
+ "output": 66
100
+ },
101
+ {
102
+ "input": [
103
+ [
104
+ 7,
105
+ 3,
106
+ 7,
107
+ 12,
108
+ 5,
109
+ 6
110
+ ],
111
+ 3
112
+ ],
113
+ "output": 11
114
+ },
115
+ {
116
+ "input": [
117
+ [
118
+ 6
119
+ ],
120
+ 2
121
+ ],
122
+ "output": 2
123
+ },
124
+ {
125
+ "input": [
126
+ [
127
+ 6,
128
+ 3,
129
+ 9,
130
+ 7
131
+ ],
132
+ 3
133
+ ],
134
+ "output": 9
135
+ },
136
+ {
137
+ "input": [
138
+ [
139
+ 13,
140
+ 10,
141
+ 13,
142
+ 7,
143
+ 9,
144
+ 8,
145
+ 3
146
+ ],
147
+ 5
148
+ ],
149
+ "output": 20
150
+ }
151
+ ],
152
+ "haskell_template": "maximumANDSum :: [Int] -> Int -> Int\nmaximumANDSum nums numSlots ",
153
+ "ocaml_template": "let maximumANDSum (nums: int list) (numSlots: int) : int = ",
154
+ "scala_template": "def maximumANDSum(nums: List[Int],numSlots: Int): Int = { \n \n}",
155
+ "java_template": "public static int maximumANDSum(List<Integer> nums, int numSlots) {\n\n}",
156
+ "python_template": "class Solution(object):\n def maximumANDSum(self, nums, numSlots):\n \"\"\"\n :type nums: List[int]\n :type numSlots: int\n :rtype: int\n \"\"\"\n "
157
+ }
maximum_and_sum_of_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 9 (maximumANDSum [1;2;3;4;5;6] 3)
12
+
13
+ let test2 _ = assert_equal 24 (maximumANDSum [1;3;10;4;7;1] 9)
14
+
15
+
16
+ (* Grouping test cases *)
17
+ let suite = "Test Suite for maximumANDSum" >::: [
18
+
19
+ "test1" >:: test1;
20
+ "test2" >:: test2;
21
+ ]
22
+
23
+
24
+ (* Running the tests *)
25
+ let () = run_test_tt_main suite
26
+ end
maximum_and_sum_of_array/scala_tests/MySuite.scala ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ class MySuite extends munit.FunSuite {
3
+
4
+ test("test1") {
5
+ assertEquals(Main.maximumANDSum(List(1,2,3,4,5,6),3), 9)
6
+ }
7
+
8
+ test("test2") {
9
+ assertEquals(Main.maximumANDSum(List(1,3,10,4,7,1),9), 24)
10
+ }
11
+
12
+ }
maximum_area_of_longest_diagonal_rectangle/haskell_tests/Main.hs ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ module Main where
3
+ import Test.HUnit
4
+
5
+ --Program start
6
+ areaOfMaxDiagonal :: [[Int]] -> Int
7
+ areaOfMaxDiagonal dimensions = undefined
8
+
9
+ --Program end
10
+
11
+ -- Test cases
12
+
13
+ test1 :: Test
14
+ test1 = TestCase (assertEqual "for (areaOfMaxDiagonal [[9,3],[8,6]])," 48 (areaOfMaxDiagonal [[9,3],[8,6]]))
15
+
16
+ test2 :: Test
17
+ test2 = TestCase (assertEqual "for (areaOfMaxDiagonal [[3,4],[4,3]])," 12 (areaOfMaxDiagonal [[3,4],[4,3]]))
18
+
19
+ test3 :: Test
20
+ test3 = TestCase (assertEqual "for (areaOfMaxDiagonal [[53, 90], [36, 93], [72, 97], [24, 85], [22, 27], [75, 46], [12, 31], [80, 30], [56, 5], [9, 24], [38, 62], [74, 57], [59, 55], [44, 9], [48, 93], [17, 72], [15, 1], [56, 58], [94, 38], [22, 59], [28, 53], [13, 63], [63, 80], [46, 70], [67, 60], [58, 60], [69, 93], [31, 50], [62, 85], [30, 79], [29, 71], [47, 54], [30, 10], [79, 48], [6, 12], [59, 49], [13, 97], [26, 3], [15, 30], [15, 94], [11, 74], [10, 71], [2, 63], [89, 87], [1, 76], [23, 57], [43, 86], [17, 65], [47, 92], [24, 27], [71, 22], [55, 56], [64, 5], [60, 93], [4, 68], [35, 90], [92, 70], [42, 25], [97, 28], [28, 34], [60, 7], [85, 4], [49, 72], [34, 68], [2, 87], [2, 91], [4, 28], [7, 81], [93, 30], [94, 87], [23, 5], [35, 37], [16, 70], [8, 92], [67, 62], [99, 67]])," 8178 (areaOfMaxDiagonal [[53, 90], [36, 93], [72, 97], [24, 85], [22, 27], [75, 46], [12, 31], [80, 30], [56, 5], [9, 24], [38, 62], [74, 57], [59, 55], [44, 9], [48, 93], [17, 72], [15, 1], [56, 58], [94, 38], [22, 59], [28, 53], [13, 63], [63, 80], [46, 70], [67, 60], [58, 60], [69, 93], [31, 50], [62, 85], [30, 79], [29, 71], [47, 54], [30, 10], [79, 48], [6, 12], [59, 49], [13, 97], [26, 3], [15, 30], [15, 94], [11, 74], [10, 71], [2, 63], [89, 87], [1, 76], [23, 57], [43, 86], [17, 65], [47, 92], [24, 27], [71, 22], [55, 56], [64, 5], [60, 93], [4, 68], [35, 90], [92, 70], [42, 25], [97, 28], [28, 34], [60, 7], [85, 4], [49, 72], [34, 68], [2, 87], [2, 91], [4, 28], [7, 81], [93, 30], [94, 87], [23, 5], [35, 37], [16, 70], [8, 92], [67, 62], [99, 67]]))
21
+
22
+ test4 :: Test
23
+ test4 = TestCase (assertEqual "for (areaOfMaxDiagonal [[29, 68], [26, 9], [97, 3], [87, 29], [37, 80], [40, 81], [97, 73], [18, 96], [4, 26], [100, 73], [37, 41], [68, 21], [8, 34], [16, 27], [21, 43], [60, 94], [51, 28], [63, 24], [98, 8], [65, 47], [71, 56], [2, 20], [21, 9], [72, 82], [50, 3], [11, 34], [12, 31], [56, 54], [83, 49], [1, 84], [45, 73], [76, 11], [20, 20], [38, 82], [24, 70], [17, 21], [82, 54], [3, 86], [38, 59], [62, 49], [49, 65], [16, 94], [89, 59], [88, 70], [60, 44], [18, 5], [11, 7], [58, 78], [86, 39], [89, 40], [67, 80], [35, 11], [30, 7], [43, 64], [52, 96], [96, 88], [21, 67], [38, 56], [85, 42], [46, 9], [52, 66], [19, 73], [45, 84], [74, 28], [77, 91], [28, 8], [48, 42], [27, 13], [1, 6], [14, 92], [38, 71], [7, 57], [98, 36], [96, 72]])," 8448 (areaOfMaxDiagonal [[29, 68], [26, 9], [97, 3], [87, 29], [37, 80], [40, 81], [97, 73], [18, 96], [4, 26], [100, 73], [37, 41], [68, 21], [8, 34], [16, 27], [21, 43], [60, 94], [51, 28], [63, 24], [98, 8], [65, 47], [71, 56], [2, 20], [21, 9], [72, 82], [50, 3], [11, 34], [12, 31], [56, 54], [83, 49], [1, 84], [45, 73], [76, 11], [20, 20], [38, 82], [24, 70], [17, 21], [82, 54], [3, 86], [38, 59], [62, 49], [49, 65], [16, 94], [89, 59], [88, 70], [60, 44], [18, 5], [11, 7], [58, 78], [86, 39], [89, 40], [67, 80], [35, 11], [30, 7], [43, 64], [52, 96], [96, 88], [21, 67], [38, 56], [85, 42], [46, 9], [52, 66], [19, 73], [45, 84], [74, 28], [77, 91], [28, 8], [48, 42], [27, 13], [1, 6], [14, 92], [38, 71], [7, 57], [98, 36], [96, 72]]))
24
+
25
+ test5 :: Test
26
+ test5 = TestCase (assertEqual "for (areaOfMaxDiagonal [[99, 69], [91, 27], [7, 39], [3, 59], [18, 6], [72, 32], [17, 2], [91, 28], [86, 90], [21, 12], [7, 53], [35, 61], [31, 99], [11, 100], [71, 7], [93, 72], [73, 44], [39, 12], [76, 89], [56, 45], [52, 51], [4, 59], [30, 32], [50, 25], [55, 16], [21, 89], [39, 59], [96, 30], [37, 49], [33, 60], [97, 66], [61, 88], [45, 35], [22, 53], [34, 69], [24, 78], [15, 58], [41, 72], [18, 25], [64, 100], [99, 47], [2, 90], [86, 71], [14, 16], [3, 52], [87, 82], [46, 39], [89, 4], [8, 61], [49, 12], [29, 37], [59, 99], [16, 93], [32, 7], [26, 65], [61, 53], [12, 78], [59, 44], [17, 55], [16, 1], [93, 84], [11, 27], [61, 81], [43, 12], [60, 44], [71, 19], [86, 27], [69, 96], [12, 47], [12, 82], [69, 1], [65, 19], [79, 61], [99, 35], [43, 98], [95, 34]])," 7812 (areaOfMaxDiagonal [[99, 69], [91, 27], [7, 39], [3, 59], [18, 6], [72, 32], [17, 2], [91, 28], [86, 90], [21, 12], [7, 53], [35, 61], [31, 99], [11, 100], [71, 7], [93, 72], [73, 44], [39, 12], [76, 89], [56, 45], [52, 51], [4, 59], [30, 32], [50, 25], [55, 16], [21, 89], [39, 59], [96, 30], [37, 49], [33, 60], [97, 66], [61, 88], [45, 35], [22, 53], [34, 69], [24, 78], [15, 58], [41, 72], [18, 25], [64, 100], [99, 47], [2, 90], [86, 71], [14, 16], [3, 52], [87, 82], [46, 39], [89, 4], [8, 61], [49, 12], [29, 37], [59, 99], [16, 93], [32, 7], [26, 65], [61, 53], [12, 78], [59, 44], [17, 55], [16, 1], [93, 84], [11, 27], [61, 81], [43, 12], [60, 44], [71, 19], [86, 27], [69, 96], [12, 47], [12, 82], [69, 1], [65, 19], [79, 61], [99, 35], [43, 98], [95, 34]]))
27
+
28
+ test6 :: Test
29
+ test6 = TestCase (assertEqual "for (areaOfMaxDiagonal [[86, 75], [71, 72], [35, 60], [25, 82], [6, 54], [38, 8], [97, 15], [31, 75], [4, 14], [10, 1], [78, 6], [5, 45], [92, 28], [37, 41], [93, 78], [90, 23], [25, 20], [41, 82], [35, 5], [66, 97], [49, 48], [76, 83], [82, 38], [42, 99], [79, 57], [100, 74], [17, 96], [71, 97], [24, 32], [24, 99], [53, 84], [47, 8], [47, 96], [86, 6], [87, 61], [6, 82], [9, 48], [60, 91], [68, 5], [88, 23], [59, 22], [24, 11], [56, 92], [31, 81], [41, 73], [25, 83], [83, 27], [51, 81], [28, 37], [65, 88], [25, 18], [100, 7], [7, 25], [11, 80], [52, 56], [2, 75], [38, 6], [99, 59], [11, 96], [79, 40], [30, 20], [45, 56], [74, 55], [86, 90], [3, 16], [93, 37], [38, 11], [42, 68], [97, 90], [8, 1], [18, 87], [39, 81], [49, 86], [33, 90], [72, 31], [69, 1], [3, 55], [8, 97], [41, 99], [17, 44], [47, 57], [49, 54], [84, 27], [55, 60]])," 8730 (areaOfMaxDiagonal [[86, 75], [71, 72], [35, 60], [25, 82], [6, 54], [38, 8], [97, 15], [31, 75], [4, 14], [10, 1], [78, 6], [5, 45], [92, 28], [37, 41], [93, 78], [90, 23], [25, 20], [41, 82], [35, 5], [66, 97], [49, 48], [76, 83], [82, 38], [42, 99], [79, 57], [100, 74], [17, 96], [71, 97], [24, 32], [24, 99], [53, 84], [47, 8], [47, 96], [86, 6], [87, 61], [6, 82], [9, 48], [60, 91], [68, 5], [88, 23], [59, 22], [24, 11], [56, 92], [31, 81], [41, 73], [25, 83], [83, 27], [51, 81], [28, 37], [65, 88], [25, 18], [100, 7], [7, 25], [11, 80], [52, 56], [2, 75], [38, 6], [99, 59], [11, 96], [79, 40], [30, 20], [45, 56], [74, 55], [86, 90], [3, 16], [93, 37], [38, 11], [42, 68], [97, 90], [8, 1], [18, 87], [39, 81], [49, 86], [33, 90], [72, 31], [69, 1], [3, 55], [8, 97], [41, 99], [17, 44], [47, 57], [49, 54], [84, 27], [55, 60]]))
30
+
31
+ test7 :: Test
32
+ test7 = TestCase (assertEqual "for (areaOfMaxDiagonal [[61, 83], [51, 14], [73, 9], [55, 57], [53, 43], [59, 24], [83, 22], [16, 70], [27, 30], [32, 16], [100, 99], [52, 61], [29, 4], [25, 39], [18, 97], [23, 55], [11, 53], [4, 5], [87, 35], [96, 89], [82, 98], [85, 11], [65, 2], [25, 72], [86, 86], [83, 100], [46, 76], [39, 71], [34, 41], [90, 8], [51, 42], [4, 64], [23, 87], [9, 52], [14, 26], [11, 17], [52, 28], [20, 18], [77, 50], [41, 54], [54, 46], [33, 57], [55, 97], [81, 54], [53, 35], [22, 52], [6, 15], [11, 64], [65, 48], [75, 32], [71, 80], [69, 39], [79, 100], [94, 53]])," 9900 (areaOfMaxDiagonal [[61, 83], [51, 14], [73, 9], [55, 57], [53, 43], [59, 24], [83, 22], [16, 70], [27, 30], [32, 16], [100, 99], [52, 61], [29, 4], [25, 39], [18, 97], [23, 55], [11, 53], [4, 5], [87, 35], [96, 89], [82, 98], [85, 11], [65, 2], [25, 72], [86, 86], [83, 100], [46, 76], [39, 71], [34, 41], [90, 8], [51, 42], [4, 64], [23, 87], [9, 52], [14, 26], [11, 17], [52, 28], [20, 18], [77, 50], [41, 54], [54, 46], [33, 57], [55, 97], [81, 54], [53, 35], [22, 52], [6, 15], [11, 64], [65, 48], [75, 32], [71, 80], [69, 39], [79, 100], [94, 53]]))
33
+
34
+ test8 :: Test
35
+ test8 = TestCase (assertEqual "for (areaOfMaxDiagonal [[3, 28], [22, 39], [56, 6], [62, 49], [30, 29], [17, 41], [81, 47], [94, 16], [50, 8], [23, 42], [56, 82], [40, 89], [64, 93], [13, 55], [80, 39], [59, 69], [2, 22], [57, 52], [65, 30], [38, 70], [76, 38], [26, 28], [83, 37], [7, 73], [79, 17], [62, 70], [66, 84], [30, 36], [99, 90]])," 8910 (areaOfMaxDiagonal [[3, 28], [22, 39], [56, 6], [62, 49], [30, 29], [17, 41], [81, 47], [94, 16], [50, 8], [23, 42], [56, 82], [40, 89], [64, 93], [13, 55], [80, 39], [59, 69], [2, 22], [57, 52], [65, 30], [38, 70], [76, 38], [26, 28], [83, 37], [7, 73], [79, 17], [62, 70], [66, 84], [30, 36], [99, 90]]))
36
+
37
+ test9 :: Test
38
+ test9 = TestCase (assertEqual "for (areaOfMaxDiagonal [[40, 47], [58, 90], [10, 3], [70, 81], [95, 87], [52, 29], [12, 31], [46, 77], [62, 63], [8, 28], [1, 71], [52, 47], [51, 87], [48, 47], [91, 48], [45, 37], [73, 23], [83, 52], [47, 42], [75, 81], [83, 72], [75, 77], [11, 31], [94, 8], [23, 32], [98, 82], [37, 39], [61, 77], [14, 22], [58, 92], [60, 13], [67, 43], [80, 13], [68, 40], [42, 26], [35, 39], [81, 28], [83, 61], [37, 15], [23, 83], [51, 77], [13, 39], [99, 66], [97, 96], [32, 91], [41, 71], [16, 59], [42, 42], [4, 75], [88, 8], [54, 28], [20, 43], [30, 23], [31, 76], [79, 91], [30, 23], [95, 39], [16, 75], [25, 61], [27, 8], [69, 9], [10, 89], [39, 19], [39, 34], [27, 24], [26, 75], [75, 24], [28, 97], [80, 36], [32, 40], [61, 36], [22, 57], [76, 53], [82, 39], [54, 19], [39, 43], [33, 53], [29, 78], [69, 77], [71, 57], [54, 78], [52, 75], [31, 26], [78, 91], [36, 18], [68, 65], [99, 38], [45, 76], [92, 7]])," 9312 (areaOfMaxDiagonal [[40, 47], [58, 90], [10, 3], [70, 81], [95, 87], [52, 29], [12, 31], [46, 77], [62, 63], [8, 28], [1, 71], [52, 47], [51, 87], [48, 47], [91, 48], [45, 37], [73, 23], [83, 52], [47, 42], [75, 81], [83, 72], [75, 77], [11, 31], [94, 8], [23, 32], [98, 82], [37, 39], [61, 77], [14, 22], [58, 92], [60, 13], [67, 43], [80, 13], [68, 40], [42, 26], [35, 39], [81, 28], [83, 61], [37, 15], [23, 83], [51, 77], [13, 39], [99, 66], [97, 96], [32, 91], [41, 71], [16, 59], [42, 42], [4, 75], [88, 8], [54, 28], [20, 43], [30, 23], [31, 76], [79, 91], [30, 23], [95, 39], [16, 75], [25, 61], [27, 8], [69, 9], [10, 89], [39, 19], [39, 34], [27, 24], [26, 75], [75, 24], [28, 97], [80, 36], [32, 40], [61, 36], [22, 57], [76, 53], [82, 39], [54, 19], [39, 43], [33, 53], [29, 78], [69, 77], [71, 57], [54, 78], [52, 75], [31, 26], [78, 91], [36, 18], [68, 65], [99, 38], [45, 76], [92, 7]]))
39
+
40
+
41
+ -- Grouping test cases
42
+ tests :: Test
43
+ tests = TestList [TestLabel "Test1" test1, TestLabel "Test2" test2, TestLabel "Test3" test3, TestLabel "Test4" test4, TestLabel "Test5" test5, TestLabel "Test6" test6, TestLabel "Test7" test7, TestLabel "Test8" test8, TestLabel "Test9" test9]
44
+
45
+ -- Running the tests
46
+ main :: IO Counts
47
+ main = runTestTT tests
maximum_area_of_longest_diagonal_rectangle/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(48, areaOfMaxDiagonal(Arrays.asList(Arrays.asList(9,3),Arrays.asList(8,6))));
14
+ }
15
+ @Test
16
+ public void test2() {
17
+ assertEquals(12, areaOfMaxDiagonal(Arrays.asList(Arrays.asList(3,4),Arrays.asList(4,3))));
18
+ }
19
+
20
+ }
maximum_area_of_longest_diagonal_rectangle/meta.json ADDED
@@ -0,0 +1,2497 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "id": 3251,
3
+ "name": "maximum_area_of_longest_diagonal_rectangle",
4
+ "difficulty": "Easy",
5
+ "link": "https://leetcode.com/problems/maximum-area-of-longest-diagonal-rectangle/",
6
+ "date": "2023-12-31 00:00:00",
7
+ "task_description": "You are given a 2D **0-indexed **integer array `dimensions`. For all indices `i`, `0 <= i < dimensions.length`, `dimensions[i][0]` represents the length and `dimensions[i][1]` represents the width of the rectangle `i`. Return _the **area** of the rectangle having the **longest** diagonal. If there are multiple rectangles with the longest diagonal, return the area of the rectangle having the **maximum** area._ **Example 1:** ``` **Input:** dimensions = [[9,3],[8,6]] **Output:** 48 **Explanation:** For index = 0, length = 9 and width = 3. Diagonal length = sqrt(9 * 9 + 3 * 3) = sqrt(90) ≈ 9.487. For index = 1, length = 8 and width = 6. Diagonal length = sqrt(8 * 8 + 6 * 6) = sqrt(100) = 10. So, the rectangle at index 1 has a greater diagonal length therefore we return area = 8 * 6 = 48. ``` **Example 2:** ``` **Input:** dimensions = [[3,4],[4,3]] **Output:** 12 **Explanation:** Length of diagonal is the same for both which is 5, so maximum area = 12. ``` **Constraints:** `1 <= dimensions.length <= 100` `dimensions[i].length == 2` `1 <= dimensions[i][0], dimensions[i][1] <= 100`",
8
+ "public_test_cases": [
9
+ {
10
+ "label": "Example 1",
11
+ "input": "dimensions = [[9,3],[8,6]]",
12
+ "output": "48 "
13
+ },
14
+ {
15
+ "label": "Example 2",
16
+ "input": "dimensions = [[3,4],[4,3]]",
17
+ "output": "12 "
18
+ }
19
+ ],
20
+ "private_test_cases": [
21
+ {
22
+ "input": [
23
+ [
24
+ 53,
25
+ 90
26
+ ],
27
+ [
28
+ 36,
29
+ 93
30
+ ],
31
+ [
32
+ 72,
33
+ 97
34
+ ],
35
+ [
36
+ 24,
37
+ 85
38
+ ],
39
+ [
40
+ 22,
41
+ 27
42
+ ],
43
+ [
44
+ 75,
45
+ 46
46
+ ],
47
+ [
48
+ 12,
49
+ 31
50
+ ],
51
+ [
52
+ 80,
53
+ 30
54
+ ],
55
+ [
56
+ 56,
57
+ 5
58
+ ],
59
+ [
60
+ 9,
61
+ 24
62
+ ],
63
+ [
64
+ 38,
65
+ 62
66
+ ],
67
+ [
68
+ 74,
69
+ 57
70
+ ],
71
+ [
72
+ 59,
73
+ 55
74
+ ],
75
+ [
76
+ 44,
77
+ 9
78
+ ],
79
+ [
80
+ 48,
81
+ 93
82
+ ],
83
+ [
84
+ 17,
85
+ 72
86
+ ],
87
+ [
88
+ 15,
89
+ 1
90
+ ],
91
+ [
92
+ 56,
93
+ 58
94
+ ],
95
+ [
96
+ 94,
97
+ 38
98
+ ],
99
+ [
100
+ 22,
101
+ 59
102
+ ],
103
+ [
104
+ 28,
105
+ 53
106
+ ],
107
+ [
108
+ 13,
109
+ 63
110
+ ],
111
+ [
112
+ 63,
113
+ 80
114
+ ],
115
+ [
116
+ 46,
117
+ 70
118
+ ],
119
+ [
120
+ 67,
121
+ 60
122
+ ],
123
+ [
124
+ 58,
125
+ 60
126
+ ],
127
+ [
128
+ 69,
129
+ 93
130
+ ],
131
+ [
132
+ 31,
133
+ 50
134
+ ],
135
+ [
136
+ 62,
137
+ 85
138
+ ],
139
+ [
140
+ 30,
141
+ 79
142
+ ],
143
+ [
144
+ 29,
145
+ 71
146
+ ],
147
+ [
148
+ 47,
149
+ 54
150
+ ],
151
+ [
152
+ 30,
153
+ 10
154
+ ],
155
+ [
156
+ 79,
157
+ 48
158
+ ],
159
+ [
160
+ 6,
161
+ 12
162
+ ],
163
+ [
164
+ 59,
165
+ 49
166
+ ],
167
+ [
168
+ 13,
169
+ 97
170
+ ],
171
+ [
172
+ 26,
173
+ 3
174
+ ],
175
+ [
176
+ 15,
177
+ 30
178
+ ],
179
+ [
180
+ 15,
181
+ 94
182
+ ],
183
+ [
184
+ 11,
185
+ 74
186
+ ],
187
+ [
188
+ 10,
189
+ 71
190
+ ],
191
+ [
192
+ 2,
193
+ 63
194
+ ],
195
+ [
196
+ 89,
197
+ 87
198
+ ],
199
+ [
200
+ 1,
201
+ 76
202
+ ],
203
+ [
204
+ 23,
205
+ 57
206
+ ],
207
+ [
208
+ 43,
209
+ 86
210
+ ],
211
+ [
212
+ 17,
213
+ 65
214
+ ],
215
+ [
216
+ 47,
217
+ 92
218
+ ],
219
+ [
220
+ 24,
221
+ 27
222
+ ],
223
+ [
224
+ 71,
225
+ 22
226
+ ],
227
+ [
228
+ 55,
229
+ 56
230
+ ],
231
+ [
232
+ 64,
233
+ 5
234
+ ],
235
+ [
236
+ 60,
237
+ 93
238
+ ],
239
+ [
240
+ 4,
241
+ 68
242
+ ],
243
+ [
244
+ 35,
245
+ 90
246
+ ],
247
+ [
248
+ 92,
249
+ 70
250
+ ],
251
+ [
252
+ 42,
253
+ 25
254
+ ],
255
+ [
256
+ 97,
257
+ 28
258
+ ],
259
+ [
260
+ 28,
261
+ 34
262
+ ],
263
+ [
264
+ 60,
265
+ 7
266
+ ],
267
+ [
268
+ 85,
269
+ 4
270
+ ],
271
+ [
272
+ 49,
273
+ 72
274
+ ],
275
+ [
276
+ 34,
277
+ 68
278
+ ],
279
+ [
280
+ 2,
281
+ 87
282
+ ],
283
+ [
284
+ 2,
285
+ 91
286
+ ],
287
+ [
288
+ 4,
289
+ 28
290
+ ],
291
+ [
292
+ 7,
293
+ 81
294
+ ],
295
+ [
296
+ 93,
297
+ 30
298
+ ],
299
+ [
300
+ 94,
301
+ 87
302
+ ],
303
+ [
304
+ 23,
305
+ 5
306
+ ],
307
+ [
308
+ 35,
309
+ 37
310
+ ],
311
+ [
312
+ 16,
313
+ 70
314
+ ],
315
+ [
316
+ 8,
317
+ 92
318
+ ],
319
+ [
320
+ 67,
321
+ 62
322
+ ],
323
+ [
324
+ 99,
325
+ 67
326
+ ]
327
+ ],
328
+ "output": 8178
329
+ },
330
+ {
331
+ "input": [
332
+ [
333
+ 29,
334
+ 68
335
+ ],
336
+ [
337
+ 26,
338
+ 9
339
+ ],
340
+ [
341
+ 97,
342
+ 3
343
+ ],
344
+ [
345
+ 87,
346
+ 29
347
+ ],
348
+ [
349
+ 37,
350
+ 80
351
+ ],
352
+ [
353
+ 40,
354
+ 81
355
+ ],
356
+ [
357
+ 97,
358
+ 73
359
+ ],
360
+ [
361
+ 18,
362
+ 96
363
+ ],
364
+ [
365
+ 4,
366
+ 26
367
+ ],
368
+ [
369
+ 100,
370
+ 73
371
+ ],
372
+ [
373
+ 37,
374
+ 41
375
+ ],
376
+ [
377
+ 68,
378
+ 21
379
+ ],
380
+ [
381
+ 8,
382
+ 34
383
+ ],
384
+ [
385
+ 16,
386
+ 27
387
+ ],
388
+ [
389
+ 21,
390
+ 43
391
+ ],
392
+ [
393
+ 60,
394
+ 94
395
+ ],
396
+ [
397
+ 51,
398
+ 28
399
+ ],
400
+ [
401
+ 63,
402
+ 24
403
+ ],
404
+ [
405
+ 98,
406
+ 8
407
+ ],
408
+ [
409
+ 65,
410
+ 47
411
+ ],
412
+ [
413
+ 71,
414
+ 56
415
+ ],
416
+ [
417
+ 2,
418
+ 20
419
+ ],
420
+ [
421
+ 21,
422
+ 9
423
+ ],
424
+ [
425
+ 72,
426
+ 82
427
+ ],
428
+ [
429
+ 50,
430
+ 3
431
+ ],
432
+ [
433
+ 11,
434
+ 34
435
+ ],
436
+ [
437
+ 12,
438
+ 31
439
+ ],
440
+ [
441
+ 56,
442
+ 54
443
+ ],
444
+ [
445
+ 83,
446
+ 49
447
+ ],
448
+ [
449
+ 1,
450
+ 84
451
+ ],
452
+ [
453
+ 45,
454
+ 73
455
+ ],
456
+ [
457
+ 76,
458
+ 11
459
+ ],
460
+ [
461
+ 20,
462
+ 20
463
+ ],
464
+ [
465
+ 38,
466
+ 82
467
+ ],
468
+ [
469
+ 24,
470
+ 70
471
+ ],
472
+ [
473
+ 17,
474
+ 21
475
+ ],
476
+ [
477
+ 82,
478
+ 54
479
+ ],
480
+ [
481
+ 3,
482
+ 86
483
+ ],
484
+ [
485
+ 38,
486
+ 59
487
+ ],
488
+ [
489
+ 62,
490
+ 49
491
+ ],
492
+ [
493
+ 49,
494
+ 65
495
+ ],
496
+ [
497
+ 16,
498
+ 94
499
+ ],
500
+ [
501
+ 89,
502
+ 59
503
+ ],
504
+ [
505
+ 88,
506
+ 70
507
+ ],
508
+ [
509
+ 60,
510
+ 44
511
+ ],
512
+ [
513
+ 18,
514
+ 5
515
+ ],
516
+ [
517
+ 11,
518
+ 7
519
+ ],
520
+ [
521
+ 58,
522
+ 78
523
+ ],
524
+ [
525
+ 86,
526
+ 39
527
+ ],
528
+ [
529
+ 89,
530
+ 40
531
+ ],
532
+ [
533
+ 67,
534
+ 80
535
+ ],
536
+ [
537
+ 35,
538
+ 11
539
+ ],
540
+ [
541
+ 30,
542
+ 7
543
+ ],
544
+ [
545
+ 43,
546
+ 64
547
+ ],
548
+ [
549
+ 52,
550
+ 96
551
+ ],
552
+ [
553
+ 96,
554
+ 88
555
+ ],
556
+ [
557
+ 21,
558
+ 67
559
+ ],
560
+ [
561
+ 38,
562
+ 56
563
+ ],
564
+ [
565
+ 85,
566
+ 42
567
+ ],
568
+ [
569
+ 46,
570
+ 9
571
+ ],
572
+ [
573
+ 52,
574
+ 66
575
+ ],
576
+ [
577
+ 19,
578
+ 73
579
+ ],
580
+ [
581
+ 45,
582
+ 84
583
+ ],
584
+ [
585
+ 74,
586
+ 28
587
+ ],
588
+ [
589
+ 77,
590
+ 91
591
+ ],
592
+ [
593
+ 28,
594
+ 8
595
+ ],
596
+ [
597
+ 48,
598
+ 42
599
+ ],
600
+ [
601
+ 27,
602
+ 13
603
+ ],
604
+ [
605
+ 1,
606
+ 6
607
+ ],
608
+ [
609
+ 14,
610
+ 92
611
+ ],
612
+ [
613
+ 38,
614
+ 71
615
+ ],
616
+ [
617
+ 7,
618
+ 57
619
+ ],
620
+ [
621
+ 98,
622
+ 36
623
+ ],
624
+ [
625
+ 96,
626
+ 72
627
+ ]
628
+ ],
629
+ "output": 8448
630
+ },
631
+ {
632
+ "input": [
633
+ [
634
+ 99,
635
+ 69
636
+ ],
637
+ [
638
+ 91,
639
+ 27
640
+ ],
641
+ [
642
+ 7,
643
+ 39
644
+ ],
645
+ [
646
+ 3,
647
+ 59
648
+ ],
649
+ [
650
+ 18,
651
+ 6
652
+ ],
653
+ [
654
+ 72,
655
+ 32
656
+ ],
657
+ [
658
+ 17,
659
+ 2
660
+ ],
661
+ [
662
+ 91,
663
+ 28
664
+ ],
665
+ [
666
+ 86,
667
+ 90
668
+ ],
669
+ [
670
+ 21,
671
+ 12
672
+ ],
673
+ [
674
+ 7,
675
+ 53
676
+ ],
677
+ [
678
+ 35,
679
+ 61
680
+ ],
681
+ [
682
+ 31,
683
+ 99
684
+ ],
685
+ [
686
+ 11,
687
+ 100
688
+ ],
689
+ [
690
+ 71,
691
+ 7
692
+ ],
693
+ [
694
+ 93,
695
+ 72
696
+ ],
697
+ [
698
+ 73,
699
+ 44
700
+ ],
701
+ [
702
+ 39,
703
+ 12
704
+ ],
705
+ [
706
+ 76,
707
+ 89
708
+ ],
709
+ [
710
+ 56,
711
+ 45
712
+ ],
713
+ [
714
+ 52,
715
+ 51
716
+ ],
717
+ [
718
+ 4,
719
+ 59
720
+ ],
721
+ [
722
+ 30,
723
+ 32
724
+ ],
725
+ [
726
+ 50,
727
+ 25
728
+ ],
729
+ [
730
+ 55,
731
+ 16
732
+ ],
733
+ [
734
+ 21,
735
+ 89
736
+ ],
737
+ [
738
+ 39,
739
+ 59
740
+ ],
741
+ [
742
+ 96,
743
+ 30
744
+ ],
745
+ [
746
+ 37,
747
+ 49
748
+ ],
749
+ [
750
+ 33,
751
+ 60
752
+ ],
753
+ [
754
+ 97,
755
+ 66
756
+ ],
757
+ [
758
+ 61,
759
+ 88
760
+ ],
761
+ [
762
+ 45,
763
+ 35
764
+ ],
765
+ [
766
+ 22,
767
+ 53
768
+ ],
769
+ [
770
+ 34,
771
+ 69
772
+ ],
773
+ [
774
+ 24,
775
+ 78
776
+ ],
777
+ [
778
+ 15,
779
+ 58
780
+ ],
781
+ [
782
+ 41,
783
+ 72
784
+ ],
785
+ [
786
+ 18,
787
+ 25
788
+ ],
789
+ [
790
+ 64,
791
+ 100
792
+ ],
793
+ [
794
+ 99,
795
+ 47
796
+ ],
797
+ [
798
+ 2,
799
+ 90
800
+ ],
801
+ [
802
+ 86,
803
+ 71
804
+ ],
805
+ [
806
+ 14,
807
+ 16
808
+ ],
809
+ [
810
+ 3,
811
+ 52
812
+ ],
813
+ [
814
+ 87,
815
+ 82
816
+ ],
817
+ [
818
+ 46,
819
+ 39
820
+ ],
821
+ [
822
+ 89,
823
+ 4
824
+ ],
825
+ [
826
+ 8,
827
+ 61
828
+ ],
829
+ [
830
+ 49,
831
+ 12
832
+ ],
833
+ [
834
+ 29,
835
+ 37
836
+ ],
837
+ [
838
+ 59,
839
+ 99
840
+ ],
841
+ [
842
+ 16,
843
+ 93
844
+ ],
845
+ [
846
+ 32,
847
+ 7
848
+ ],
849
+ [
850
+ 26,
851
+ 65
852
+ ],
853
+ [
854
+ 61,
855
+ 53
856
+ ],
857
+ [
858
+ 12,
859
+ 78
860
+ ],
861
+ [
862
+ 59,
863
+ 44
864
+ ],
865
+ [
866
+ 17,
867
+ 55
868
+ ],
869
+ [
870
+ 16,
871
+ 1
872
+ ],
873
+ [
874
+ 93,
875
+ 84
876
+ ],
877
+ [
878
+ 11,
879
+ 27
880
+ ],
881
+ [
882
+ 61,
883
+ 81
884
+ ],
885
+ [
886
+ 43,
887
+ 12
888
+ ],
889
+ [
890
+ 60,
891
+ 44
892
+ ],
893
+ [
894
+ 71,
895
+ 19
896
+ ],
897
+ [
898
+ 86,
899
+ 27
900
+ ],
901
+ [
902
+ 69,
903
+ 96
904
+ ],
905
+ [
906
+ 12,
907
+ 47
908
+ ],
909
+ [
910
+ 12,
911
+ 82
912
+ ],
913
+ [
914
+ 69,
915
+ 1
916
+ ],
917
+ [
918
+ 65,
919
+ 19
920
+ ],
921
+ [
922
+ 79,
923
+ 61
924
+ ],
925
+ [
926
+ 99,
927
+ 35
928
+ ],
929
+ [
930
+ 43,
931
+ 98
932
+ ],
933
+ [
934
+ 95,
935
+ 34
936
+ ]
937
+ ],
938
+ "output": 7812
939
+ },
940
+ {
941
+ "input": [
942
+ [
943
+ 86,
944
+ 75
945
+ ],
946
+ [
947
+ 71,
948
+ 72
949
+ ],
950
+ [
951
+ 35,
952
+ 60
953
+ ],
954
+ [
955
+ 25,
956
+ 82
957
+ ],
958
+ [
959
+ 6,
960
+ 54
961
+ ],
962
+ [
963
+ 38,
964
+ 8
965
+ ],
966
+ [
967
+ 97,
968
+ 15
969
+ ],
970
+ [
971
+ 31,
972
+ 75
973
+ ],
974
+ [
975
+ 4,
976
+ 14
977
+ ],
978
+ [
979
+ 10,
980
+ 1
981
+ ],
982
+ [
983
+ 78,
984
+ 6
985
+ ],
986
+ [
987
+ 5,
988
+ 45
989
+ ],
990
+ [
991
+ 92,
992
+ 28
993
+ ],
994
+ [
995
+ 37,
996
+ 41
997
+ ],
998
+ [
999
+ 93,
1000
+ 78
1001
+ ],
1002
+ [
1003
+ 90,
1004
+ 23
1005
+ ],
1006
+ [
1007
+ 25,
1008
+ 20
1009
+ ],
1010
+ [
1011
+ 41,
1012
+ 82
1013
+ ],
1014
+ [
1015
+ 35,
1016
+ 5
1017
+ ],
1018
+ [
1019
+ 66,
1020
+ 97
1021
+ ],
1022
+ [
1023
+ 49,
1024
+ 48
1025
+ ],
1026
+ [
1027
+ 76,
1028
+ 83
1029
+ ],
1030
+ [
1031
+ 82,
1032
+ 38
1033
+ ],
1034
+ [
1035
+ 42,
1036
+ 99
1037
+ ],
1038
+ [
1039
+ 79,
1040
+ 57
1041
+ ],
1042
+ [
1043
+ 100,
1044
+ 74
1045
+ ],
1046
+ [
1047
+ 17,
1048
+ 96
1049
+ ],
1050
+ [
1051
+ 71,
1052
+ 97
1053
+ ],
1054
+ [
1055
+ 24,
1056
+ 32
1057
+ ],
1058
+ [
1059
+ 24,
1060
+ 99
1061
+ ],
1062
+ [
1063
+ 53,
1064
+ 84
1065
+ ],
1066
+ [
1067
+ 47,
1068
+ 8
1069
+ ],
1070
+ [
1071
+ 47,
1072
+ 96
1073
+ ],
1074
+ [
1075
+ 86,
1076
+ 6
1077
+ ],
1078
+ [
1079
+ 87,
1080
+ 61
1081
+ ],
1082
+ [
1083
+ 6,
1084
+ 82
1085
+ ],
1086
+ [
1087
+ 9,
1088
+ 48
1089
+ ],
1090
+ [
1091
+ 60,
1092
+ 91
1093
+ ],
1094
+ [
1095
+ 68,
1096
+ 5
1097
+ ],
1098
+ [
1099
+ 88,
1100
+ 23
1101
+ ],
1102
+ [
1103
+ 59,
1104
+ 22
1105
+ ],
1106
+ [
1107
+ 24,
1108
+ 11
1109
+ ],
1110
+ [
1111
+ 56,
1112
+ 92
1113
+ ],
1114
+ [
1115
+ 31,
1116
+ 81
1117
+ ],
1118
+ [
1119
+ 41,
1120
+ 73
1121
+ ],
1122
+ [
1123
+ 25,
1124
+ 83
1125
+ ],
1126
+ [
1127
+ 83,
1128
+ 27
1129
+ ],
1130
+ [
1131
+ 51,
1132
+ 81
1133
+ ],
1134
+ [
1135
+ 28,
1136
+ 37
1137
+ ],
1138
+ [
1139
+ 65,
1140
+ 88
1141
+ ],
1142
+ [
1143
+ 25,
1144
+ 18
1145
+ ],
1146
+ [
1147
+ 100,
1148
+ 7
1149
+ ],
1150
+ [
1151
+ 7,
1152
+ 25
1153
+ ],
1154
+ [
1155
+ 11,
1156
+ 80
1157
+ ],
1158
+ [
1159
+ 52,
1160
+ 56
1161
+ ],
1162
+ [
1163
+ 2,
1164
+ 75
1165
+ ],
1166
+ [
1167
+ 38,
1168
+ 6
1169
+ ],
1170
+ [
1171
+ 99,
1172
+ 59
1173
+ ],
1174
+ [
1175
+ 11,
1176
+ 96
1177
+ ],
1178
+ [
1179
+ 79,
1180
+ 40
1181
+ ],
1182
+ [
1183
+ 30,
1184
+ 20
1185
+ ],
1186
+ [
1187
+ 45,
1188
+ 56
1189
+ ],
1190
+ [
1191
+ 74,
1192
+ 55
1193
+ ],
1194
+ [
1195
+ 86,
1196
+ 90
1197
+ ],
1198
+ [
1199
+ 3,
1200
+ 16
1201
+ ],
1202
+ [
1203
+ 93,
1204
+ 37
1205
+ ],
1206
+ [
1207
+ 38,
1208
+ 11
1209
+ ],
1210
+ [
1211
+ 42,
1212
+ 68
1213
+ ],
1214
+ [
1215
+ 97,
1216
+ 90
1217
+ ],
1218
+ [
1219
+ 8,
1220
+ 1
1221
+ ],
1222
+ [
1223
+ 18,
1224
+ 87
1225
+ ],
1226
+ [
1227
+ 39,
1228
+ 81
1229
+ ],
1230
+ [
1231
+ 49,
1232
+ 86
1233
+ ],
1234
+ [
1235
+ 33,
1236
+ 90
1237
+ ],
1238
+ [
1239
+ 72,
1240
+ 31
1241
+ ],
1242
+ [
1243
+ 69,
1244
+ 1
1245
+ ],
1246
+ [
1247
+ 3,
1248
+ 55
1249
+ ],
1250
+ [
1251
+ 8,
1252
+ 97
1253
+ ],
1254
+ [
1255
+ 41,
1256
+ 99
1257
+ ],
1258
+ [
1259
+ 17,
1260
+ 44
1261
+ ],
1262
+ [
1263
+ 47,
1264
+ 57
1265
+ ],
1266
+ [
1267
+ 49,
1268
+ 54
1269
+ ],
1270
+ [
1271
+ 84,
1272
+ 27
1273
+ ],
1274
+ [
1275
+ 55,
1276
+ 60
1277
+ ]
1278
+ ],
1279
+ "output": 8730
1280
+ },
1281
+ {
1282
+ "input": [
1283
+ [
1284
+ 61,
1285
+ 83
1286
+ ],
1287
+ [
1288
+ 51,
1289
+ 14
1290
+ ],
1291
+ [
1292
+ 73,
1293
+ 9
1294
+ ],
1295
+ [
1296
+ 55,
1297
+ 57
1298
+ ],
1299
+ [
1300
+ 53,
1301
+ 43
1302
+ ],
1303
+ [
1304
+ 59,
1305
+ 24
1306
+ ],
1307
+ [
1308
+ 83,
1309
+ 22
1310
+ ],
1311
+ [
1312
+ 16,
1313
+ 70
1314
+ ],
1315
+ [
1316
+ 27,
1317
+ 30
1318
+ ],
1319
+ [
1320
+ 32,
1321
+ 16
1322
+ ],
1323
+ [
1324
+ 100,
1325
+ 99
1326
+ ],
1327
+ [
1328
+ 52,
1329
+ 61
1330
+ ],
1331
+ [
1332
+ 29,
1333
+ 4
1334
+ ],
1335
+ [
1336
+ 25,
1337
+ 39
1338
+ ],
1339
+ [
1340
+ 18,
1341
+ 97
1342
+ ],
1343
+ [
1344
+ 23,
1345
+ 55
1346
+ ],
1347
+ [
1348
+ 11,
1349
+ 53
1350
+ ],
1351
+ [
1352
+ 4,
1353
+ 5
1354
+ ],
1355
+ [
1356
+ 87,
1357
+ 35
1358
+ ],
1359
+ [
1360
+ 96,
1361
+ 89
1362
+ ],
1363
+ [
1364
+ 82,
1365
+ 98
1366
+ ],
1367
+ [
1368
+ 85,
1369
+ 11
1370
+ ],
1371
+ [
1372
+ 65,
1373
+ 2
1374
+ ],
1375
+ [
1376
+ 25,
1377
+ 72
1378
+ ],
1379
+ [
1380
+ 86,
1381
+ 86
1382
+ ],
1383
+ [
1384
+ 83,
1385
+ 100
1386
+ ],
1387
+ [
1388
+ 46,
1389
+ 76
1390
+ ],
1391
+ [
1392
+ 39,
1393
+ 71
1394
+ ],
1395
+ [
1396
+ 34,
1397
+ 41
1398
+ ],
1399
+ [
1400
+ 90,
1401
+ 8
1402
+ ],
1403
+ [
1404
+ 51,
1405
+ 42
1406
+ ],
1407
+ [
1408
+ 4,
1409
+ 64
1410
+ ],
1411
+ [
1412
+ 23,
1413
+ 87
1414
+ ],
1415
+ [
1416
+ 9,
1417
+ 52
1418
+ ],
1419
+ [
1420
+ 14,
1421
+ 26
1422
+ ],
1423
+ [
1424
+ 11,
1425
+ 17
1426
+ ],
1427
+ [
1428
+ 52,
1429
+ 28
1430
+ ],
1431
+ [
1432
+ 20,
1433
+ 18
1434
+ ],
1435
+ [
1436
+ 77,
1437
+ 50
1438
+ ],
1439
+ [
1440
+ 41,
1441
+ 54
1442
+ ],
1443
+ [
1444
+ 54,
1445
+ 46
1446
+ ],
1447
+ [
1448
+ 33,
1449
+ 57
1450
+ ],
1451
+ [
1452
+ 55,
1453
+ 97
1454
+ ],
1455
+ [
1456
+ 81,
1457
+ 54
1458
+ ],
1459
+ [
1460
+ 53,
1461
+ 35
1462
+ ],
1463
+ [
1464
+ 22,
1465
+ 52
1466
+ ],
1467
+ [
1468
+ 6,
1469
+ 15
1470
+ ],
1471
+ [
1472
+ 11,
1473
+ 64
1474
+ ],
1475
+ [
1476
+ 65,
1477
+ 48
1478
+ ],
1479
+ [
1480
+ 75,
1481
+ 32
1482
+ ],
1483
+ [
1484
+ 71,
1485
+ 80
1486
+ ],
1487
+ [
1488
+ 69,
1489
+ 39
1490
+ ],
1491
+ [
1492
+ 79,
1493
+ 100
1494
+ ],
1495
+ [
1496
+ 94,
1497
+ 53
1498
+ ]
1499
+ ],
1500
+ "output": 9900
1501
+ },
1502
+ {
1503
+ "input": [
1504
+ [
1505
+ 3,
1506
+ 28
1507
+ ],
1508
+ [
1509
+ 22,
1510
+ 39
1511
+ ],
1512
+ [
1513
+ 56,
1514
+ 6
1515
+ ],
1516
+ [
1517
+ 62,
1518
+ 49
1519
+ ],
1520
+ [
1521
+ 30,
1522
+ 29
1523
+ ],
1524
+ [
1525
+ 17,
1526
+ 41
1527
+ ],
1528
+ [
1529
+ 81,
1530
+ 47
1531
+ ],
1532
+ [
1533
+ 94,
1534
+ 16
1535
+ ],
1536
+ [
1537
+ 50,
1538
+ 8
1539
+ ],
1540
+ [
1541
+ 23,
1542
+ 42
1543
+ ],
1544
+ [
1545
+ 56,
1546
+ 82
1547
+ ],
1548
+ [
1549
+ 40,
1550
+ 89
1551
+ ],
1552
+ [
1553
+ 64,
1554
+ 93
1555
+ ],
1556
+ [
1557
+ 13,
1558
+ 55
1559
+ ],
1560
+ [
1561
+ 80,
1562
+ 39
1563
+ ],
1564
+ [
1565
+ 59,
1566
+ 69
1567
+ ],
1568
+ [
1569
+ 2,
1570
+ 22
1571
+ ],
1572
+ [
1573
+ 57,
1574
+ 52
1575
+ ],
1576
+ [
1577
+ 65,
1578
+ 30
1579
+ ],
1580
+ [
1581
+ 38,
1582
+ 70
1583
+ ],
1584
+ [
1585
+ 76,
1586
+ 38
1587
+ ],
1588
+ [
1589
+ 26,
1590
+ 28
1591
+ ],
1592
+ [
1593
+ 83,
1594
+ 37
1595
+ ],
1596
+ [
1597
+ 7,
1598
+ 73
1599
+ ],
1600
+ [
1601
+ 79,
1602
+ 17
1603
+ ],
1604
+ [
1605
+ 62,
1606
+ 70
1607
+ ],
1608
+ [
1609
+ 66,
1610
+ 84
1611
+ ],
1612
+ [
1613
+ 30,
1614
+ 36
1615
+ ],
1616
+ [
1617
+ 99,
1618
+ 90
1619
+ ]
1620
+ ],
1621
+ "output": 8910
1622
+ },
1623
+ {
1624
+ "input": [
1625
+ [
1626
+ 40,
1627
+ 47
1628
+ ],
1629
+ [
1630
+ 58,
1631
+ 90
1632
+ ],
1633
+ [
1634
+ 10,
1635
+ 3
1636
+ ],
1637
+ [
1638
+ 70,
1639
+ 81
1640
+ ],
1641
+ [
1642
+ 95,
1643
+ 87
1644
+ ],
1645
+ [
1646
+ 52,
1647
+ 29
1648
+ ],
1649
+ [
1650
+ 12,
1651
+ 31
1652
+ ],
1653
+ [
1654
+ 46,
1655
+ 77
1656
+ ],
1657
+ [
1658
+ 62,
1659
+ 63
1660
+ ],
1661
+ [
1662
+ 8,
1663
+ 28
1664
+ ],
1665
+ [
1666
+ 1,
1667
+ 71
1668
+ ],
1669
+ [
1670
+ 52,
1671
+ 47
1672
+ ],
1673
+ [
1674
+ 51,
1675
+ 87
1676
+ ],
1677
+ [
1678
+ 48,
1679
+ 47
1680
+ ],
1681
+ [
1682
+ 91,
1683
+ 48
1684
+ ],
1685
+ [
1686
+ 45,
1687
+ 37
1688
+ ],
1689
+ [
1690
+ 73,
1691
+ 23
1692
+ ],
1693
+ [
1694
+ 83,
1695
+ 52
1696
+ ],
1697
+ [
1698
+ 47,
1699
+ 42
1700
+ ],
1701
+ [
1702
+ 75,
1703
+ 81
1704
+ ],
1705
+ [
1706
+ 83,
1707
+ 72
1708
+ ],
1709
+ [
1710
+ 75,
1711
+ 77
1712
+ ],
1713
+ [
1714
+ 11,
1715
+ 31
1716
+ ],
1717
+ [
1718
+ 94,
1719
+ 8
1720
+ ],
1721
+ [
1722
+ 23,
1723
+ 32
1724
+ ],
1725
+ [
1726
+ 98,
1727
+ 82
1728
+ ],
1729
+ [
1730
+ 37,
1731
+ 39
1732
+ ],
1733
+ [
1734
+ 61,
1735
+ 77
1736
+ ],
1737
+ [
1738
+ 14,
1739
+ 22
1740
+ ],
1741
+ [
1742
+ 58,
1743
+ 92
1744
+ ],
1745
+ [
1746
+ 60,
1747
+ 13
1748
+ ],
1749
+ [
1750
+ 67,
1751
+ 43
1752
+ ],
1753
+ [
1754
+ 80,
1755
+ 13
1756
+ ],
1757
+ [
1758
+ 68,
1759
+ 40
1760
+ ],
1761
+ [
1762
+ 42,
1763
+ 26
1764
+ ],
1765
+ [
1766
+ 35,
1767
+ 39
1768
+ ],
1769
+ [
1770
+ 81,
1771
+ 28
1772
+ ],
1773
+ [
1774
+ 83,
1775
+ 61
1776
+ ],
1777
+ [
1778
+ 37,
1779
+ 15
1780
+ ],
1781
+ [
1782
+ 23,
1783
+ 83
1784
+ ],
1785
+ [
1786
+ 51,
1787
+ 77
1788
+ ],
1789
+ [
1790
+ 13,
1791
+ 39
1792
+ ],
1793
+ [
1794
+ 99,
1795
+ 66
1796
+ ],
1797
+ [
1798
+ 97,
1799
+ 96
1800
+ ],
1801
+ [
1802
+ 32,
1803
+ 91
1804
+ ],
1805
+ [
1806
+ 41,
1807
+ 71
1808
+ ],
1809
+ [
1810
+ 16,
1811
+ 59
1812
+ ],
1813
+ [
1814
+ 42,
1815
+ 42
1816
+ ],
1817
+ [
1818
+ 4,
1819
+ 75
1820
+ ],
1821
+ [
1822
+ 88,
1823
+ 8
1824
+ ],
1825
+ [
1826
+ 54,
1827
+ 28
1828
+ ],
1829
+ [
1830
+ 20,
1831
+ 43
1832
+ ],
1833
+ [
1834
+ 30,
1835
+ 23
1836
+ ],
1837
+ [
1838
+ 31,
1839
+ 76
1840
+ ],
1841
+ [
1842
+ 79,
1843
+ 91
1844
+ ],
1845
+ [
1846
+ 30,
1847
+ 23
1848
+ ],
1849
+ [
1850
+ 95,
1851
+ 39
1852
+ ],
1853
+ [
1854
+ 16,
1855
+ 75
1856
+ ],
1857
+ [
1858
+ 25,
1859
+ 61
1860
+ ],
1861
+ [
1862
+ 27,
1863
+ 8
1864
+ ],
1865
+ [
1866
+ 69,
1867
+ 9
1868
+ ],
1869
+ [
1870
+ 10,
1871
+ 89
1872
+ ],
1873
+ [
1874
+ 39,
1875
+ 19
1876
+ ],
1877
+ [
1878
+ 39,
1879
+ 34
1880
+ ],
1881
+ [
1882
+ 27,
1883
+ 24
1884
+ ],
1885
+ [
1886
+ 26,
1887
+ 75
1888
+ ],
1889
+ [
1890
+ 75,
1891
+ 24
1892
+ ],
1893
+ [
1894
+ 28,
1895
+ 97
1896
+ ],
1897
+ [
1898
+ 80,
1899
+ 36
1900
+ ],
1901
+ [
1902
+ 32,
1903
+ 40
1904
+ ],
1905
+ [
1906
+ 61,
1907
+ 36
1908
+ ],
1909
+ [
1910
+ 22,
1911
+ 57
1912
+ ],
1913
+ [
1914
+ 76,
1915
+ 53
1916
+ ],
1917
+ [
1918
+ 82,
1919
+ 39
1920
+ ],
1921
+ [
1922
+ 54,
1923
+ 19
1924
+ ],
1925
+ [
1926
+ 39,
1927
+ 43
1928
+ ],
1929
+ [
1930
+ 33,
1931
+ 53
1932
+ ],
1933
+ [
1934
+ 29,
1935
+ 78
1936
+ ],
1937
+ [
1938
+ 69,
1939
+ 77
1940
+ ],
1941
+ [
1942
+ 71,
1943
+ 57
1944
+ ],
1945
+ [
1946
+ 54,
1947
+ 78
1948
+ ],
1949
+ [
1950
+ 52,
1951
+ 75
1952
+ ],
1953
+ [
1954
+ 31,
1955
+ 26
1956
+ ],
1957
+ [
1958
+ 78,
1959
+ 91
1960
+ ],
1961
+ [
1962
+ 36,
1963
+ 18
1964
+ ],
1965
+ [
1966
+ 68,
1967
+ 65
1968
+ ],
1969
+ [
1970
+ 99,
1971
+ 38
1972
+ ],
1973
+ [
1974
+ 45,
1975
+ 76
1976
+ ],
1977
+ [
1978
+ 92,
1979
+ 7
1980
+ ]
1981
+ ],
1982
+ "output": 9312
1983
+ },
1984
+ {
1985
+ "input": [
1986
+ [
1987
+ 27,
1988
+ 44
1989
+ ],
1990
+ [
1991
+ 24,
1992
+ 70
1993
+ ],
1994
+ [
1995
+ 20,
1996
+ 89
1997
+ ],
1998
+ [
1999
+ 49,
2000
+ 91
2001
+ ],
2002
+ [
2003
+ 52,
2004
+ 4
2005
+ ],
2006
+ [
2007
+ 96,
2008
+ 74
2009
+ ],
2010
+ [
2011
+ 44,
2012
+ 67
2013
+ ],
2014
+ [
2015
+ 65,
2016
+ 72
2017
+ ],
2018
+ [
2019
+ 18,
2020
+ 13
2021
+ ],
2022
+ [
2023
+ 43,
2024
+ 70
2025
+ ],
2026
+ [
2027
+ 66,
2028
+ 32
2029
+ ],
2030
+ [
2031
+ 14,
2032
+ 56
2033
+ ],
2034
+ [
2035
+ 23,
2036
+ 1
2037
+ ],
2038
+ [
2039
+ 29,
2040
+ 20
2041
+ ],
2042
+ [
2043
+ 61,
2044
+ 76
2045
+ ],
2046
+ [
2047
+ 82,
2048
+ 40
2049
+ ],
2050
+ [
2051
+ 9,
2052
+ 30
2053
+ ],
2054
+ [
2055
+ 22,
2056
+ 62
2057
+ ],
2058
+ [
2059
+ 46,
2060
+ 95
2061
+ ],
2062
+ [
2063
+ 84,
2064
+ 52
2065
+ ],
2066
+ [
2067
+ 33,
2068
+ 7
2069
+ ],
2070
+ [
2071
+ 95,
2072
+ 48
2073
+ ],
2074
+ [
2075
+ 27,
2076
+ 43
2077
+ ],
2078
+ [
2079
+ 7,
2080
+ 64
2081
+ ]
2082
+ ],
2083
+ "output": 7104
2084
+ },
2085
+ {
2086
+ "input": [
2087
+ [
2088
+ 4,
2089
+ 31
2090
+ ],
2091
+ [
2092
+ 7,
2093
+ 43
2094
+ ],
2095
+ [
2096
+ 96,
2097
+ 76
2098
+ ],
2099
+ [
2100
+ 60,
2101
+ 27
2102
+ ],
2103
+ [
2104
+ 13,
2105
+ 35
2106
+ ],
2107
+ [
2108
+ 94,
2109
+ 8
2110
+ ],
2111
+ [
2112
+ 67,
2113
+ 84
2114
+ ],
2115
+ [
2116
+ 50,
2117
+ 91
2118
+ ],
2119
+ [
2120
+ 75,
2121
+ 38
2122
+ ],
2123
+ [
2124
+ 94,
2125
+ 41
2126
+ ],
2127
+ [
2128
+ 73,
2129
+ 23
2130
+ ],
2131
+ [
2132
+ 2,
2133
+ 31
2134
+ ],
2135
+ [
2136
+ 29,
2137
+ 30
2138
+ ],
2139
+ [
2140
+ 23,
2141
+ 47
2142
+ ],
2143
+ [
2144
+ 4,
2145
+ 11
2146
+ ],
2147
+ [
2148
+ 58,
2149
+ 42
2150
+ ],
2151
+ [
2152
+ 88,
2153
+ 37
2154
+ ],
2155
+ [
2156
+ 36,
2157
+ 38
2158
+ ],
2159
+ [
2160
+ 50,
2161
+ 19
2162
+ ],
2163
+ [
2164
+ 1,
2165
+ 96
2166
+ ],
2167
+ [
2168
+ 43,
2169
+ 29
2170
+ ],
2171
+ [
2172
+ 14,
2173
+ 69
2174
+ ],
2175
+ [
2176
+ 9,
2177
+ 10
2178
+ ],
2179
+ [
2180
+ 81,
2181
+ 14
2182
+ ],
2183
+ [
2184
+ 73,
2185
+ 41
2186
+ ],
2187
+ [
2188
+ 20,
2189
+ 96
2190
+ ],
2191
+ [
2192
+ 97,
2193
+ 53
2194
+ ],
2195
+ [
2196
+ 59,
2197
+ 89
2198
+ ],
2199
+ [
2200
+ 50,
2201
+ 16
2202
+ ],
2203
+ [
2204
+ 23,
2205
+ 91
2206
+ ],
2207
+ [
2208
+ 39,
2209
+ 92
2210
+ ],
2211
+ [
2212
+ 55,
2213
+ 96
2214
+ ],
2215
+ [
2216
+ 41,
2217
+ 17
2218
+ ],
2219
+ [
2220
+ 25,
2221
+ 85
2222
+ ],
2223
+ [
2224
+ 4,
2225
+ 90
2226
+ ],
2227
+ [
2228
+ 7,
2229
+ 28
2230
+ ],
2231
+ [
2232
+ 54,
2233
+ 35
2234
+ ],
2235
+ [
2236
+ 72,
2237
+ 20
2238
+ ],
2239
+ [
2240
+ 47,
2241
+ 71
2242
+ ],
2243
+ [
2244
+ 90,
2245
+ 84
2246
+ ],
2247
+ [
2248
+ 21,
2249
+ 55
2250
+ ],
2251
+ [
2252
+ 29,
2253
+ 98
2254
+ ],
2255
+ [
2256
+ 96,
2257
+ 85
2258
+ ],
2259
+ [
2260
+ 100,
2261
+ 55
2262
+ ],
2263
+ [
2264
+ 75,
2265
+ 49
2266
+ ],
2267
+ [
2268
+ 62,
2269
+ 50
2270
+ ],
2271
+ [
2272
+ 95,
2273
+ 84
2274
+ ],
2275
+ [
2276
+ 90,
2277
+ 95
2278
+ ],
2279
+ [
2280
+ 17,
2281
+ 11
2282
+ ],
2283
+ [
2284
+ 73,
2285
+ 95
2286
+ ],
2287
+ [
2288
+ 68,
2289
+ 64
2290
+ ],
2291
+ [
2292
+ 4,
2293
+ 93
2294
+ ],
2295
+ [
2296
+ 75,
2297
+ 15
2298
+ ],
2299
+ [
2300
+ 50,
2301
+ 63
2302
+ ],
2303
+ [
2304
+ 88,
2305
+ 31
2306
+ ],
2307
+ [
2308
+ 69,
2309
+ 84
2310
+ ],
2311
+ [
2312
+ 92,
2313
+ 39
2314
+ ],
2315
+ [
2316
+ 22,
2317
+ 75
2318
+ ],
2319
+ [
2320
+ 67,
2321
+ 50
2322
+ ],
2323
+ [
2324
+ 58,
2325
+ 25
2326
+ ],
2327
+ [
2328
+ 27,
2329
+ 72
2330
+ ],
2331
+ [
2332
+ 97,
2333
+ 100
2334
+ ],
2335
+ [
2336
+ 14,
2337
+ 30
2338
+ ],
2339
+ [
2340
+ 81,
2341
+ 36
2342
+ ],
2343
+ [
2344
+ 72,
2345
+ 81
2346
+ ],
2347
+ [
2348
+ 71,
2349
+ 67
2350
+ ],
2351
+ [
2352
+ 90,
2353
+ 88
2354
+ ],
2355
+ [
2356
+ 88,
2357
+ 68
2358
+ ],
2359
+ [
2360
+ 34,
2361
+ 16
2362
+ ],
2363
+ [
2364
+ 50,
2365
+ 94
2366
+ ],
2367
+ [
2368
+ 12,
2369
+ 6
2370
+ ],
2371
+ [
2372
+ 17,
2373
+ 24
2374
+ ],
2375
+ [
2376
+ 32,
2377
+ 96
2378
+ ],
2379
+ [
2380
+ 26,
2381
+ 98
2382
+ ],
2383
+ [
2384
+ 54,
2385
+ 76
2386
+ ],
2387
+ [
2388
+ 86,
2389
+ 89
2390
+ ],
2391
+ [
2392
+ 100,
2393
+ 20
2394
+ ],
2395
+ [
2396
+ 2,
2397
+ 15
2398
+ ],
2399
+ [
2400
+ 63,
2401
+ 8
2402
+ ],
2403
+ [
2404
+ 3,
2405
+ 56
2406
+ ],
2407
+ [
2408
+ 52,
2409
+ 24
2410
+ ],
2411
+ [
2412
+ 9,
2413
+ 40
2414
+ ],
2415
+ [
2416
+ 57,
2417
+ 16
2418
+ ],
2419
+ [
2420
+ 45,
2421
+ 88
2422
+ ]
2423
+ ],
2424
+ "output": 9700
2425
+ },
2426
+ {
2427
+ "input": [
2428
+ [
2429
+ 45,
2430
+ 66
2431
+ ],
2432
+ [
2433
+ 54,
2434
+ 63
2435
+ ],
2436
+ [
2437
+ 73,
2438
+ 62
2439
+ ],
2440
+ [
2441
+ 39,
2442
+ 59
2443
+ ],
2444
+ [
2445
+ 68,
2446
+ 5
2447
+ ],
2448
+ [
2449
+ 77,
2450
+ 98
2451
+ ],
2452
+ [
2453
+ 29,
2454
+ 17
2455
+ ],
2456
+ [
2457
+ 63,
2458
+ 63
2459
+ ],
2460
+ [
2461
+ 42,
2462
+ 12
2463
+ ],
2464
+ [
2465
+ 70,
2466
+ 28
2467
+ ],
2468
+ [
2469
+ 98,
2470
+ 57
2471
+ ],
2472
+ [
2473
+ 12,
2474
+ 16
2475
+ ],
2476
+ [
2477
+ 9,
2478
+ 37
2479
+ ],
2480
+ [
2481
+ 70,
2482
+ 49
2483
+ ],
2484
+ [
2485
+ 53,
2486
+ 19
2487
+ ]
2488
+ ],
2489
+ "output": 7546
2490
+ }
2491
+ ],
2492
+ "haskell_template": "areaOfMaxDiagonal :: [[Int]] -> Int\nareaOfMaxDiagonal dimensions ",
2493
+ "ocaml_template": "let areaOfMaxDiagonal (dimensions: int list list) : int = ",
2494
+ "scala_template": "def areaOfMaxDiagonal(dimensions: List[List[Int]]): Int = { \n \n}",
2495
+ "java_template": "class Solution {\n public int areaOfMaxDiagonal(int[][] dimensions) {\n \n }\n}",
2496
+ "python_template": "class Solution(object):\n def areaOfMaxDiagonal(self, dimensions):\n \"\"\"\n :type dimensions: List[List[int]]\n :rtype: int\n \"\"\"\n "
2497
+ }
maximum_area_of_longest_diagonal_rectangle/ocaml_tests/main.ml ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ module Main = struct
3
+ open OUnit2
4
+
5
+ (* Program start *)
6
+ let areaOfMaxDiagonal (dimensions: int list list) : int = failwith "Not implemented"
7
+
8
+ (* Program end *)
9
+
10
+ (* Test cases *)
11
+
12
+ let test1 _ = assert_equal 48 (areaOfMaxDiagonal [[9;3];[8;6]])
13
+
14
+ let test2 _ = assert_equal 12 (areaOfMaxDiagonal [[3;4];[4;3]])
15
+
16
+ let test3 _ = assert_equal 12 (areaOfMaxDiagonal [[53; 90]; [36; 93]; [72; 97]; [24; 85]; [22; 27]; [75; 46]; [12; 31]; [80; 30]; [56; 5]; [9; 24]; [38; 62]; [74; 57]; [59; 55]; [44; 9]; [48; 93]; [17; 72]; [15; 1]; [56; 58]; [94; 38]; [22; 59]; [28; 53]; [13; 63]; [63; 80]; [46; 70]; [67; 60]; [58; 60]; [69; 93]; [31; 50]; [62; 85]; [30; 79]; [29; 71]; [47; 54]; [30; 10]; [79; 48]; [6; 12]; [59; 49]; [13; 97]; [26; 3]; [15; 30]; [15; 94]; [11; 74]; [10; 71]; [2; 63]; [89; 87]; [1; 76]; [23; 57]; [43; 86]; [17; 65]; [47; 92]; [24; 27]; [71; 22]; [55; 56]; [64; 5]; [60; 93]; [4; 68]; [35; 90]; [92; 70]; [42; 25]; [97; 28]; [28; 34]; [60; 7]; [85; 4]; [49; 72]; [34; 68]; [2; 87]; [2; 91]; [4; 28]; [7; 81]; [93; 30]; [94; 87]; [23; 5]; [35; 37]; [16; 70]; [8; 92]; [67; 62]; [99; 67]])
17
+
18
+ let test4 _ = assert_equal 12 (areaOfMaxDiagonal [[29; 68]; [26; 9]; [97; 3]; [87; 29]; [37; 80]; [40; 81]; [97; 73]; [18; 96]; [4; 26]; [100; 73]; [37; 41]; [68; 21]; [8; 34]; [16; 27]; [21; 43]; [60; 94]; [51; 28]; [63; 24]; [98; 8]; [65; 47]; [71; 56]; [2; 20]; [21; 9]; [72; 82]; [50; 3]; [11; 34]; [12; 31]; [56; 54]; [83; 49]; [1; 84]; [45; 73]; [76; 11]; [20; 20]; [38; 82]; [24; 70]; [17; 21]; [82; 54]; [3; 86]; [38; 59]; [62; 49]; [49; 65]; [16; 94]; [89; 59]; [88; 70]; [60; 44]; [18; 5]; [11; 7]; [58; 78]; [86; 39]; [89; 40]; [67; 80]; [35; 11]; [30; 7]; [43; 64]; [52; 96]; [96; 88]; [21; 67]; [38; 56]; [85; 42]; [46; 9]; [52; 66]; [19; 73]; [45; 84]; [74; 28]; [77; 91]; [28; 8]; [48; 42]; [27; 13]; [1; 6]; [14; 92]; [38; 71]; [7; 57]; [98; 36]; [96; 72]])
19
+
20
+ let test5 _ = assert_equal 12 (areaOfMaxDiagonal [[99; 69]; [91; 27]; [7; 39]; [3; 59]; [18; 6]; [72; 32]; [17; 2]; [91; 28]; [86; 90]; [21; 12]; [7; 53]; [35; 61]; [31; 99]; [11; 100]; [71; 7]; [93; 72]; [73; 44]; [39; 12]; [76; 89]; [56; 45]; [52; 51]; [4; 59]; [30; 32]; [50; 25]; [55; 16]; [21; 89]; [39; 59]; [96; 30]; [37; 49]; [33; 60]; [97; 66]; [61; 88]; [45; 35]; [22; 53]; [34; 69]; [24; 78]; [15; 58]; [41; 72]; [18; 25]; [64; 100]; [99; 47]; [2; 90]; [86; 71]; [14; 16]; [3; 52]; [87; 82]; [46; 39]; [89; 4]; [8; 61]; [49; 12]; [29; 37]; [59; 99]; [16; 93]; [32; 7]; [26; 65]; [61; 53]; [12; 78]; [59; 44]; [17; 55]; [16; 1]; [93; 84]; [11; 27]; [61; 81]; [43; 12]; [60; 44]; [71; 19]; [86; 27]; [69; 96]; [12; 47]; [12; 82]; [69; 1]; [65; 19]; [79; 61]; [99; 35]; [43; 98]; [95; 34]])
21
+
22
+ let test6 _ = assert_equal 12 (areaOfMaxDiagonal [[86; 75]; [71; 72]; [35; 60]; [25; 82]; [6; 54]; [38; 8]; [97; 15]; [31; 75]; [4; 14]; [10; 1]; [78; 6]; [5; 45]; [92; 28]; [37; 41]; [93; 78]; [90; 23]; [25; 20]; [41; 82]; [35; 5]; [66; 97]; [49; 48]; [76; 83]; [82; 38]; [42; 99]; [79; 57]; [100; 74]; [17; 96]; [71; 97]; [24; 32]; [24; 99]; [53; 84]; [47; 8]; [47; 96]; [86; 6]; [87; 61]; [6; 82]; [9; 48]; [60; 91]; [68; 5]; [88; 23]; [59; 22]; [24; 11]; [56; 92]; [31; 81]; [41; 73]; [25; 83]; [83; 27]; [51; 81]; [28; 37]; [65; 88]; [25; 18]; [100; 7]; [7; 25]; [11; 80]; [52; 56]; [2; 75]; [38; 6]; [99; 59]; [11; 96]; [79; 40]; [30; 20]; [45; 56]; [74; 55]; [86; 90]; [3; 16]; [93; 37]; [38; 11]; [42; 68]; [97; 90]; [8; 1]; [18; 87]; [39; 81]; [49; 86]; [33; 90]; [72; 31]; [69; 1]; [3; 55]; [8; 97]; [41; 99]; [17; 44]; [47; 57]; [49; 54]; [84; 27]; [55; 60]])
23
+
24
+ let test7 _ = assert_equal 12 (areaOfMaxDiagonal [[61; 83]; [51; 14]; [73; 9]; [55; 57]; [53; 43]; [59; 24]; [83; 22]; [16; 70]; [27; 30]; [32; 16]; [100; 99]; [52; 61]; [29; 4]; [25; 39]; [18; 97]; [23; 55]; [11; 53]; [4; 5]; [87; 35]; [96; 89]; [82; 98]; [85; 11]; [65; 2]; [25; 72]; [86; 86]; [83; 100]; [46; 76]; [39; 71]; [34; 41]; [90; 8]; [51; 42]; [4; 64]; [23; 87]; [9; 52]; [14; 26]; [11; 17]; [52; 28]; [20; 18]; [77; 50]; [41; 54]; [54; 46]; [33; 57]; [55; 97]; [81; 54]; [53; 35]; [22; 52]; [6; 15]; [11; 64]; [65; 48]; [75; 32]; [71; 80]; [69; 39]; [79; 100]; [94; 53]])
25
+
26
+ let test8 _ = assert_equal 12 (areaOfMaxDiagonal [[3; 28]; [22; 39]; [56; 6]; [62; 49]; [30; 29]; [17; 41]; [81; 47]; [94; 16]; [50; 8]; [23; 42]; [56; 82]; [40; 89]; [64; 93]; [13; 55]; [80; 39]; [59; 69]; [2; 22]; [57; 52]; [65; 30]; [38; 70]; [76; 38]; [26; 28]; [83; 37]; [7; 73]; [79; 17]; [62; 70]; [66; 84]; [30; 36]; [99; 90]])
27
+
28
+ let test9 _ = assert_equal 12 (areaOfMaxDiagonal [[40; 47]; [58; 90]; [10; 3]; [70; 81]; [95; 87]; [52; 29]; [12; 31]; [46; 77]; [62; 63]; [8; 28]; [1; 71]; [52; 47]; [51; 87]; [48; 47]; [91; 48]; [45; 37]; [73; 23]; [83; 52]; [47; 42]; [75; 81]; [83; 72]; [75; 77]; [11; 31]; [94; 8]; [23; 32]; [98; 82]; [37; 39]; [61; 77]; [14; 22]; [58; 92]; [60; 13]; [67; 43]; [80; 13]; [68; 40]; [42; 26]; [35; 39]; [81; 28]; [83; 61]; [37; 15]; [23; 83]; [51; 77]; [13; 39]; [99; 66]; [97; 96]; [32; 91]; [41; 71]; [16; 59]; [42; 42]; [4; 75]; [88; 8]; [54; 28]; [20; 43]; [30; 23]; [31; 76]; [79; 91]; [30; 23]; [95; 39]; [16; 75]; [25; 61]; [27; 8]; [69; 9]; [10; 89]; [39; 19]; [39; 34]; [27; 24]; [26; 75]; [75; 24]; [28; 97]; [80; 36]; [32; 40]; [61; 36]; [22; 57]; [76; 53]; [82; 39]; [54; 19]; [39; 43]; [33; 53]; [29; 78]; [69; 77]; [71; 57]; [54; 78]; [52; 75]; [31; 26]; [78; 91]; [36; 18]; [68; 65]; [99; 38]; [45; 76]; [92; 7]])
29
+
30
+ let test10 _ = assert_equal 12 (areaOfMaxDiagonal [[27; 44]; [24; 70]; [20; 89]; [49; 91]; [52; 4]; [96; 74]; [44; 67]; [65; 72]; [18; 13]; [43; 70]; [66; 32]; [14; 56]; [23; 1]; [29; 20]; [61; 76]; [82; 40]; [9; 30]; [22; 62]; [46; 95]; [84; 52]; [33; 7]; [95; 48]; [27; 43]; [7; 64]])
31
+
32
+
33
+ (* Grouping test cases *)
34
+ let suite = "Test Suite for areaOfMaxDiagonal" >::: [
35
+
36
+ "test1" >:: test1;
37
+ "test2" >:: test2;
38
+ "test3" >:: test3;
39
+ "test4" >:: test4;
40
+ "test5" >:: test5;
41
+ "test6" >:: test6;
42
+ "test7" >:: test7;
43
+ "test8" >:: test8;
44
+ "test9" >:: test9;
45
+ "test10" >:: test10;
46
+ ]
47
+
48
+
49
+ (* Running the tests *)
50
+ let () = run_test_tt_main suite
51
+ end
maximum_area_of_longest_diagonal_rectangle/scala_tests/MySuite.scala ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ class MySuite extends munit.FunSuite {
3
+
4
+ test("test1") {
5
+ assertEquals(Main.areaOfMaxDiagonal(List(List(9,3),List(8,6))), 48)
6
+ }
7
+
8
+ test("test2") {
9
+ assertEquals(Main.areaOfMaxDiagonal(List(List(3,4),List(4,3))), 12)
10
+ }
11
+
12
+ test("test3") {
13
+ assertEquals(Main.areaOfMaxDiagonal(List(53, 90),List(36, 93),List(72, 97),List(24, 85),List(22, 27),List(75, 46),List(12, 31),List(80, 30),List(56, 5),List(9, 24),List(38, 62),List(74, 57),List(59, 55),List(44, 9),List(48, 93),List(17, 72),List(15, 1),List(56, 58),List(94, 38),List(22, 59),List(28, 53),List(13, 63),List(63, 80),List(46, 70),List(67, 60),List(58, 60),List(69, 93),List(31, 50),List(62, 85),List(30, 79),List(29, 71),List(47, 54),List(30, 10),List(79, 48),List(6, 12),List(59, 49),List(13, 97),List(26, 3),List(15, 30),List(15, 94),List(11, 74),List(10, 71),List(2, 63),List(89, 87),List(1, 76),List(23, 57),List(43, 86),List(17, 65),List(47, 92),List(24, 27),List(71, 22),List(55, 56),List(64, 5),List(60, 93),List(4, 68),List(35, 90),List(92, 70),List(42, 25),List(97, 28),List(28, 34),List(60, 7),List(85, 4),List(49, 72),List(34, 68),List(2, 87),List(2, 91),List(4, 28),List(7, 81),List(93, 30),List(94, 87),List(23, 5),List(35, 37),List(16, 70),List(8, 92),List(67, 62),List(99, 67)), 8178)
14
+ }
15
+
16
+ test("test4") {
17
+ assertEquals(Main.areaOfMaxDiagonal(List(29, 68),List(26, 9),List(97, 3),List(87, 29),List(37, 80),List(40, 81),List(97, 73),List(18, 96),List(4, 26),List(100, 73),List(37, 41),List(68, 21),List(8, 34),List(16, 27),List(21, 43),List(60, 94),List(51, 28),List(63, 24),List(98, 8),List(65, 47),List(71, 56),List(2, 20),List(21, 9),List(72, 82),List(50, 3),List(11, 34),List(12, 31),List(56, 54),List(83, 49),List(1, 84),List(45, 73),List(76, 11),List(20, 20),List(38, 82),List(24, 70),List(17, 21),List(82, 54),List(3, 86),List(38, 59),List(62, 49),List(49, 65),List(16, 94),List(89, 59),List(88, 70),List(60, 44),List(18, 5),List(11, 7),List(58, 78),List(86, 39),List(89, 40),List(67, 80),List(35, 11),List(30, 7),List(43, 64),List(52, 96),List(96, 88),List(21, 67),List(38, 56),List(85, 42),List(46, 9),List(52, 66),List(19, 73),List(45, 84),List(74, 28),List(77, 91),List(28, 8),List(48, 42),List(27, 13),List(1, 6),List(14, 92),List(38, 71),List(7, 57),List(98, 36),List(96, 72)), 8448)
18
+ }
19
+
20
+ test("test5") {
21
+ assertEquals(Main.areaOfMaxDiagonal(List(99, 69),List(91, 27),List(7, 39),List(3, 59),List(18, 6),List(72, 32),List(17, 2),List(91, 28),List(86, 90),List(21, 12),List(7, 53),List(35, 61),List(31, 99),List(11, 100),List(71, 7),List(93, 72),List(73, 44),List(39, 12),List(76, 89),List(56, 45),List(52, 51),List(4, 59),List(30, 32),List(50, 25),List(55, 16),List(21, 89),List(39, 59),List(96, 30),List(37, 49),List(33, 60),List(97, 66),List(61, 88),List(45, 35),List(22, 53),List(34, 69),List(24, 78),List(15, 58),List(41, 72),List(18, 25),List(64, 100),List(99, 47),List(2, 90),List(86, 71),List(14, 16),List(3, 52),List(87, 82),List(46, 39),List(89, 4),List(8, 61),List(49, 12),List(29, 37),List(59, 99),List(16, 93),List(32, 7),List(26, 65),List(61, 53),List(12, 78),List(59, 44),List(17, 55),List(16, 1),List(93, 84),List(11, 27),List(61, 81),List(43, 12),List(60, 44),List(71, 19),List(86, 27),List(69, 96),List(12, 47),List(12, 82),List(69, 1),List(65, 19),List(79, 61),List(99, 35),List(43, 98),List(95, 34)), 7812)
22
+ }
23
+
24
+ test("test6") {
25
+ assertEquals(Main.areaOfMaxDiagonal(List(86, 75),List(71, 72),List(35, 60),List(25, 82),List(6, 54),List(38, 8),List(97, 15),List(31, 75),List(4, 14),List(10, 1),List(78, 6),List(5, 45),List(92, 28),List(37, 41),List(93, 78),List(90, 23),List(25, 20),List(41, 82),List(35, 5),List(66, 97),List(49, 48),List(76, 83),List(82, 38),List(42, 99),List(79, 57),List(100, 74),List(17, 96),List(71, 97),List(24, 32),List(24, 99),List(53, 84),List(47, 8),List(47, 96),List(86, 6),List(87, 61),List(6, 82),List(9, 48),List(60, 91),List(68, 5),List(88, 23),List(59, 22),List(24, 11),List(56, 92),List(31, 81),List(41, 73),List(25, 83),List(83, 27),List(51, 81),List(28, 37),List(65, 88),List(25, 18),List(100, 7),List(7, 25),List(11, 80),List(52, 56),List(2, 75),List(38, 6),List(99, 59),List(11, 96),List(79, 40),List(30, 20),List(45, 56),List(74, 55),List(86, 90),List(3, 16),List(93, 37),List(38, 11),List(42, 68),List(97, 90),List(8, 1),List(18, 87),List(39, 81),List(49, 86),List(33, 90),List(72, 31),List(69, 1),List(3, 55),List(8, 97),List(41, 99),List(17, 44),List(47, 57),List(49, 54),List(84, 27),List(55, 60)), 8730)
26
+ }
27
+
28
+ test("test7") {
29
+ assertEquals(Main.areaOfMaxDiagonal(List(61, 83),List(51, 14),List(73, 9),List(55, 57),List(53, 43),List(59, 24),List(83, 22),List(16, 70),List(27, 30),List(32, 16),List(100, 99),List(52, 61),List(29, 4),List(25, 39),List(18, 97),List(23, 55),List(11, 53),List(4, 5),List(87, 35),List(96, 89),List(82, 98),List(85, 11),List(65, 2),List(25, 72),List(86, 86),List(83, 100),List(46, 76),List(39, 71),List(34, 41),List(90, 8),List(51, 42),List(4, 64),List(23, 87),List(9, 52),List(14, 26),List(11, 17),List(52, 28),List(20, 18),List(77, 50),List(41, 54),List(54, 46),List(33, 57),List(55, 97),List(81, 54),List(53, 35),List(22, 52),List(6, 15),List(11, 64),List(65, 48),List(75, 32),List(71, 80),List(69, 39),List(79, 100),List(94, 53)), 9900)
30
+ }
31
+
32
+ test("test8") {
33
+ assertEquals(Main.areaOfMaxDiagonal(List(3, 28),List(22, 39),List(56, 6),List(62, 49),List(30, 29),List(17, 41),List(81, 47),List(94, 16),List(50, 8),List(23, 42),List(56, 82),List(40, 89),List(64, 93),List(13, 55),List(80, 39),List(59, 69),List(2, 22),List(57, 52),List(65, 30),List(38, 70),List(76, 38),List(26, 28),List(83, 37),List(7, 73),List(79, 17),List(62, 70),List(66, 84),List(30, 36),List(99, 90)), 8910)
34
+ }
35
+
36
+ test("test9") {
37
+ assertEquals(Main.areaOfMaxDiagonal(List(40, 47),List(58, 90),List(10, 3),List(70, 81),List(95, 87),List(52, 29),List(12, 31),List(46, 77),List(62, 63),List(8, 28),List(1, 71),List(52, 47),List(51, 87),List(48, 47),List(91, 48),List(45, 37),List(73, 23),List(83, 52),List(47, 42),List(75, 81),List(83, 72),List(75, 77),List(11, 31),List(94, 8),List(23, 32),List(98, 82),List(37, 39),List(61, 77),List(14, 22),List(58, 92),List(60, 13),List(67, 43),List(80, 13),List(68, 40),List(42, 26),List(35, 39),List(81, 28),List(83, 61),List(37, 15),List(23, 83),List(51, 77),List(13, 39),List(99, 66),List(97, 96),List(32, 91),List(41, 71),List(16, 59),List(42, 42),List(4, 75),List(88, 8),List(54, 28),List(20, 43),List(30, 23),List(31, 76),List(79, 91),List(30, 23),List(95, 39),List(16, 75),List(25, 61),List(27, 8),List(69, 9),List(10, 89),List(39, 19),List(39, 34),List(27, 24),List(26, 75),List(75, 24),List(28, 97),List(80, 36),List(32, 40),List(61, 36),List(22, 57),List(76, 53),List(82, 39),List(54, 19),List(39, 43),List(33, 53),List(29, 78),List(69, 77),List(71, 57),List(54, 78),List(52, 75),List(31, 26),List(78, 91),List(36, 18),List(68, 65),List(99, 38),List(45, 76),List(92, 7)), 9312)
38
+ }
39
+
40
+ test("test10") {
41
+ assertEquals(Main.areaOfMaxDiagonal(List(27, 44),List(24, 70),List(20, 89),List(49, 91),List(52, 4),List(96, 74),List(44, 67),List(65, 72),List(18, 13),List(43, 70),List(66, 32),List(14, 56),List(23, 1),List(29, 20),List(61, 76),List(82, 40),List(9, 30),List(22, 62),List(46, 95),List(84, 52),List(33, 7),List(95, 48),List(27, 43),List(7, 64)), 7104)
42
+ }
43
+
44
+ }
maximum_area_rectangle_with_point_constraints_i/haskell_tests/Main.hs ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ module Main where
3
+ import Test.HUnit
4
+
5
+ --Program start
6
+ maxRectangleArea :: [[Int]] -> Int
7
+ maxRectangleArea points = undefined
8
+
9
+ --Program end
10
+
11
+ -- Test cases
12
+
13
+ test1 :: Test
14
+ test1 = TestCase (assertEqual "for (maxRectangleArea [[1,1],[1,3],[3,1],[3,3]])," 4 (maxRectangleArea [[1,1],[1,3],[3,1],[3,3]]))
15
+
16
+ test2 :: Test
17
+ test2 = TestCase (assertEqual "for (maxRectangleArea [[1,1],[1,3],[3,1],[3,3],[2,2]])," (-1) (maxRectangleArea [[1,1],[1,3],[3,1],[3,3],[2,2]]))
18
+
19
+ test3 :: Test
20
+ test3 = TestCase (assertEqual "for (maxRectangleArea [[1,1],[1,3],[3,1],[3,3],[1,2],[3,2]])," 2 (maxRectangleArea [[1,1],[1,3],[3,1],[3,3],[1,2],[3,2]]))
21
+
22
+ test4 :: Test
23
+ test4 = TestCase (assertEqual "for (maxRectangleArea [[24, 99], [72, 39], [89, 85], [93, 42], [93, 47]])," (-1) (maxRectangleArea [[24, 99], [72, 39], [89, 85], [93, 42], [93, 47]]))
24
+
25
+ test5 :: Test
26
+ test5 = TestCase (assertEqual "for (maxRectangleArea [[0, 61], [14, 23], [15, 71], [32, 85], [34, 16], [57, 75], [63, 41]])," (-1) (maxRectangleArea [[0, 61], [14, 23], [15, 71], [32, 85], [34, 16], [57, 75], [63, 41]]))
27
+
28
+ test6 :: Test
29
+ test6 = TestCase (assertEqual "for (maxRectangleArea [[36, 56], [36, 64], [36, 68], [48, 55], [50, 100]])," (-1) (maxRectangleArea [[36, 56], [36, 64], [36, 68], [48, 55], [50, 100]]))
30
+
31
+ test7 :: Test
32
+ test7 = TestCase (assertEqual "for (maxRectangleArea [[42, 21], [52, 92], [54, 79], [55, 69], [55, 73], [80, 21]])," (-1) (maxRectangleArea [[42, 21], [52, 92], [54, 79], [55, 69], [55, 73], [80, 21]]))
33
+
34
+ test8 :: Test
35
+ test8 = TestCase (assertEqual "for (maxRectangleArea [[2, 93], [4, 54], [14, 13], [28, 22], [64, 39], [78, 22], [81, 33], [86, 60], [95, 71]])," (-1) (maxRectangleArea [[2, 93], [4, 54], [14, 13], [28, 22], [64, 39], [78, 22], [81, 33], [86, 60], [95, 71]]))
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
maximum_area_rectangle_with_point_constraints_i/java_tests/Main.java ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import static org.junit.jupiter.api.Assertions.*;
3
+ import org.junit.jupiter.api.Test;
4
+ import java.util.List;
5
+ import java.util.Arrays;
6
+ public class Main {
7
+ //Program start
8
+
9
+ //Program end
10
+
11
+ @Test
12
+ public void test1() {
13
+ assertEquals(4, maxRectangleArea(Arrays.asList(Arrays.asList(1,1),Arrays.asList(1,3),Arrays.asList(3,1),Arrays.asList(3,3))));
14
+ }
15
+ @Test
16
+ public void test2() {
17
+ assertEquals(-1, maxRectangleArea(Arrays.asList(Arrays.asList(1,1),Arrays.asList(1,3),Arrays.asList(3,1),Arrays.asList(3,3),Arrays.asList(2,2))));
18
+ }
19
+ @Test
20
+ public void test3() {
21
+ assertEquals(2, maxRectangleArea(Arrays.asList(Arrays.asList(1,1),Arrays.asList(1,3),Arrays.asList(3,1),Arrays.asList(3,3),Arrays.asList(1,2),Arrays.asList(3,2))));
22
+ }
23
+
24
+ }
maximum_area_rectangle_with_point_constraints_i/meta.json ADDED
@@ -0,0 +1,185 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "id": 3681,
3
+ "name": "maximum_area_rectangle_with_point_constraints_i",
4
+ "difficulty": "Medium",
5
+ "link": "https://leetcode.com/problems/maximum-area-rectangle-with-point-constraints-i/",
6
+ "date": "2024-12-01 00:00:00",
7
+ "task_description": "You are given an array `points` where `points[i] = [xi, yi]` represents the coordinates of a point on an infinite plane. Your task is to find the **maximum **area of a rectangle that: Can be formed using **four** of these points as its corners. Does **not** contain any other point inside or on its border. Has its edges **parallel** to the axes. Return the **maximum area** that you can obtain or -1 if no such rectangle is possible. **Example 1:** **Input:** points = [[1,1],[1,3],[3,1],[3,3]] **Output: **4 **Explanation:** **** We can make a rectangle with these 4 points as corners and there is no other point that lies inside or on the border. Hence, the maximum possible area would be 4. **Example 2:** **Input:** points = [[1,1],[1,3],[3,1],[3,3],[2,2]] **Output:** -1 **Explanation:** **** There is only one rectangle possible is with points `[1,1], [1,3], [3,1]` and `[3,3]` but `[2,2]` will always lie inside it. Hence, returning -1. **Example 3:** **Input:** points = [[1,1],[1,3],[3,1],[3,3],[1,2],[3,2]] **Output: **2 **Explanation:** **** The maximum area rectangle is formed by the points `[1,3], [1,2], [3,2], [3,3]`, which has an area of 2. Additionally, the points `[1,1], [1,2], [3,1], [3,2]` also form a valid rectangle with the same area. **Constraints:** `1 <= points.length <= 10` `points[i].length == 2` `0 <= xi, yi <= 100` All the given points are **unique**.",
8
+ "public_test_cases": [
9
+ {
10
+ "label": "Example 1",
11
+ "input": "points = [[1,1],[1,3],[3,1],[3,3]]",
12
+ "output": "4 "
13
+ },
14
+ {
15
+ "label": "Example 2",
16
+ "input": "points = [[1,1],[1,3],[3,1],[3,3],[2,2]]",
17
+ "output": "-1 "
18
+ },
19
+ {
20
+ "label": "Example 3",
21
+ "input": "points = [[1,1],[1,3],[3,1],[3,3],[1,2],[3,2]]",
22
+ "output": "2 "
23
+ }
24
+ ],
25
+ "private_test_cases": [
26
+ {
27
+ "input": [
28
+ [
29
+ 24,
30
+ 99
31
+ ],
32
+ [
33
+ 72,
34
+ 39
35
+ ],
36
+ [
37
+ 89,
38
+ 85
39
+ ],
40
+ [
41
+ 93,
42
+ 42
43
+ ],
44
+ [
45
+ 93,
46
+ 47
47
+ ]
48
+ ],
49
+ "output": -1
50
+ },
51
+ {
52
+ "input": [
53
+ [
54
+ 0,
55
+ 61
56
+ ],
57
+ [
58
+ 14,
59
+ 23
60
+ ],
61
+ [
62
+ 15,
63
+ 71
64
+ ],
65
+ [
66
+ 32,
67
+ 85
68
+ ],
69
+ [
70
+ 34,
71
+ 16
72
+ ],
73
+ [
74
+ 57,
75
+ 75
76
+ ],
77
+ [
78
+ 63,
79
+ 41
80
+ ]
81
+ ],
82
+ "output": -1
83
+ },
84
+ {
85
+ "input": [
86
+ [
87
+ 36,
88
+ 56
89
+ ],
90
+ [
91
+ 36,
92
+ 64
93
+ ],
94
+ [
95
+ 36,
96
+ 68
97
+ ],
98
+ [
99
+ 48,
100
+ 55
101
+ ],
102
+ [
103
+ 50,
104
+ 100
105
+ ]
106
+ ],
107
+ "output": -1
108
+ },
109
+ {
110
+ "input": [
111
+ [
112
+ 42,
113
+ 21
114
+ ],
115
+ [
116
+ 52,
117
+ 92
118
+ ],
119
+ [
120
+ 54,
121
+ 79
122
+ ],
123
+ [
124
+ 55,
125
+ 69
126
+ ],
127
+ [
128
+ 55,
129
+ 73
130
+ ],
131
+ [
132
+ 80,
133
+ 21
134
+ ]
135
+ ],
136
+ "output": -1
137
+ },
138
+ {
139
+ "input": [
140
+ [
141
+ 2,
142
+ 93
143
+ ],
144
+ [
145
+ 4,
146
+ 54
147
+ ],
148
+ [
149
+ 14,
150
+ 13
151
+ ],
152
+ [
153
+ 28,
154
+ 22
155
+ ],
156
+ [
157
+ 64,
158
+ 39
159
+ ],
160
+ [
161
+ 78,
162
+ 22
163
+ ],
164
+ [
165
+ 81,
166
+ 33
167
+ ],
168
+ [
169
+ 86,
170
+ 60
171
+ ],
172
+ [
173
+ 95,
174
+ 71
175
+ ]
176
+ ],
177
+ "output": -1
178
+ }
179
+ ],
180
+ "haskell_template": "maxRectangleArea :: [[Int]] -> Int\nmaxRectangleArea points ",
181
+ "ocaml_template": "let maxRectangleArea (points: int list list) : int = ",
182
+ "scala_template": "def maxRectangleArea(points: List[List[Int]]): Int = { \n \n}",
183
+ "java_template": "class Solution {\n public int maxRectangleArea(int[][] points) {\n \n }\n}",
184
+ "python_template": "class Solution(object):\n def maxRectangleArea(self, points):\n \"\"\"\n :type points: List[List[int]]\n :rtype: int\n \"\"\"\n "
185
+ }
maximum_area_rectangle_with_point_constraints_i/ocaml_tests/main.ml ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ module Main = struct
3
+ open OUnit2
4
+
5
+ (* Program start *)
6
+ let maxRectangleArea (points: int list list) : int = failwith "Not implemented"
7
+
8
+ (* Program end *)
9
+
10
+ (* Test cases *)
11
+
12
+ let test1 _ = assert_equal 4 (maxRectangleArea [[1;1];[1;3];[3;1];[3;3]])
13
+
14
+ let test2 _ = assert_equal (-1) (maxRectangleArea [[1;1];[1;3];[3;1];[3;3];[2;2]])
15
+
16
+ let test3 _ = assert_equal 2 (maxRectangleArea [[1;1];[1;3];[3;1];[3;3];[1;2];[3;2]])
17
+
18
+ let test4 _ = assert_equal 2 (maxRectangleArea [[24; 99]; [72; 39]; [89; 85]; [93; 42]; [93; 47]])
19
+
20
+ let test5 _ = assert_equal 2 (maxRectangleArea [[0; 61]; [14; 23]; [15; 71]; [32; 85]; [34; 16]; [57; 75]; [63; 41]])
21
+
22
+ let test6 _ = assert_equal 2 (maxRectangleArea [[36; 56]; [36; 64]; [36; 68]; [48; 55]; [50; 100]])
23
+
24
+ let test7 _ = assert_equal 2 (maxRectangleArea [[42; 21]; [52; 92]; [54; 79]; [55; 69]; [55; 73]; [80; 21]])
25
+
26
+ let test8 _ = assert_equal 2 (maxRectangleArea [[2; 93]; [4; 54]; [14; 13]; [28; 22]; [64; 39]; [78; 22]; [81; 33]; [86; 60]; [95; 71]])
27
+
28
+
29
+ (* Grouping test cases *)
30
+ let suite = "Test Suite for maxRectangleArea" >::: [
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
maximum_area_rectangle_with_point_constraints_i/scala_tests/MySuite.scala ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ class MySuite extends munit.FunSuite {
3
+
4
+ test("test1") {
5
+ assertEquals(Main.maxRectangleArea(List(List(1,1),List(1,3),List(3,1),List(3,3))), 4)
6
+ }
7
+
8
+ test("test2") {
9
+ assertEquals(Main.maxRectangleArea(List(List(1,1),List(1,3),List(3,1),List(3,3),List(2,2))), -1)
10
+ }
11
+
12
+ test("test3") {
13
+ assertEquals(Main.maxRectangleArea(List(List(1,1),List(1,3),List(3,1),List(3,3),List(1,2),List(3,2))), 2)
14
+ }
15
+
16
+ test("test4") {
17
+ assertEquals(Main.maxRectangleArea(List(24, 99),List(72, 39),List(89, 85),List(93, 42),List(93, 47)), -1)
18
+ }
19
+
20
+ test("test5") {
21
+ assertEquals(Main.maxRectangleArea(List(0, 61),List(14, 23),List(15, 71),List(32, 85),List(34, 16),List(57, 75),List(63, 41)), -1)
22
+ }
23
+
24
+ test("test6") {
25
+ assertEquals(Main.maxRectangleArea(List(36, 56),List(36, 64),List(36, 68),List(48, 55),List(50, 100)), -1)
26
+ }
27
+
28
+ test("test7") {
29
+ assertEquals(Main.maxRectangleArea(List(42, 21),List(52, 92),List(54, 79),List(55, 69),List(55, 73),List(80, 21)), -1)
30
+ }
31
+
32
+ test("test8") {
33
+ assertEquals(Main.maxRectangleArea(List(2, 93),List(4, 54),List(14, 13),List(28, 22),List(64, 39),List(78, 22),List(81, 33),List(86, 60),List(95, 71)), -1)
34
+ }
35
+
36
+ }
maximum_area_rectangle_with_point_constraints_ii/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 (maxRectangleArea [1,1,3,3] [1,3,1,3])," 4 (maxRectangleArea [1,1,3,3] [1,3,1,3]))
13
+
14
+ test2 :: Test
15
+ test2 = TestCase (assertEqual "for (maxRectangleArea [1,1,3,3,2] [1,3,1,3,2])," (-1) (maxRectangleArea [1,1,3,3,2] [1,3,1,3,2]))
16
+
17
+ test3 :: Test
18
+ test3 = TestCase (assertEqual "for (maxRectangleArea [1,1,3,3,1,3] [1,3,1,3,2,2])," 2 (maxRectangleArea [1,1,3,3,1,3] [1,3,1,3,2,2]))
19
+
20
+ test4 :: Test
21
+ test4 = TestCase (assertEqual "for (maxRectangleArea [2775251, 15465771, 60248552, 69068054, 32307832, 7289130, 67773578, 1124002, 11417286, 6704738, 1380807, 30883793, 20945649, 63312606, 18304738, 65470199, 55088899, 73863090, 77583553, 48633582] [40521121, 1057342, 20051701, 30111767, 18586971, 60680139, 22003205, 44664399, 20391669, 75651066, 63102693, 79751859, 18798845, 58278059, 58841902, 6691528, 531455, 62613577, 60875989, 28502724])," (-1) (maxRectangleArea [2775251, 15465771, 60248552, 69068054, 32307832, 7289130, 67773578, 1124002, 11417286, 6704738, 1380807, 30883793, 20945649, 63312606, 18304738, 65470199, 55088899, 73863090, 77583553, 48633582] [40521121, 1057342, 20051701, 30111767, 18586971, 60680139, 22003205, 44664399, 20391669, 75651066, 63102693, 79751859, 18798845, 58278059, 58841902, 6691528, 531455, 62613577, 60875989, 28502724]))
22
+
23
+ test5 :: Test
24
+ test5 = TestCase (assertEqual "for (maxRectangleArea [66855275, 6962965, 28634554, 59810953, 50174999, 42177349, 43467511] [61597978, 46030985, 13770457, 58796632, 55931557, 20634821, 74943633])," (-1) (maxRectangleArea [66855275, 6962965, 28634554, 59810953, 50174999, 42177349, 43467511] [61597978, 46030985, 13770457, 58796632, 55931557, 20634821, 74943633]))
25
+
26
+ test6 :: Test
27
+ test6 = TestCase (assertEqual "for (maxRectangleArea [64253447, 15053746, 19526565, 67831574, 51589979, 1860955, 32910477, 40867020, 66120655, 70054786, 31620358, 7293109, 52066018, 58015992, 1833864, 12805908, 46615227] [32476072, 20370323, 67086099, 15060351, 31988721, 74520276, 46892114, 61753766, 57172834, 413078, 23426343, 10477631, 14881860, 8413999, 58663421, 78183694, 55172445])," (-1) (maxRectangleArea [64253447, 15053746, 19526565, 67831574, 51589979, 1860955, 32910477, 40867020, 66120655, 70054786, 31620358, 7293109, 52066018, 58015992, 1833864, 12805908, 46615227] [32476072, 20370323, 67086099, 15060351, 31988721, 74520276, 46892114, 61753766, 57172834, 413078, 23426343, 10477631, 14881860, 8413999, 58663421, 78183694, 55172445]))
28
+
29
+ test7 :: Test
30
+ test7 = TestCase (assertEqual "for (maxRectangleArea [2769856, 75818483, 60495239, 52271952, 63104275, 33513444, 6785827, 8698135, 68962930, 9418269, 22271347, 53639861, 61415095, 78259445, 8069568, 63831048, 14798944, 72354537, 5481814, 64856913] [75261275, 51789647, 64948925, 34231638, 74260490, 40389897, 18397434, 56577341, 60494367, 27658509, 28552918, 6719631, 23466735, 21740725, 1658710, 73396429, 7101200, 44729905, 42935521, 45272530])," (-1) (maxRectangleArea [2769856, 75818483, 60495239, 52271952, 63104275, 33513444, 6785827, 8698135, 68962930, 9418269, 22271347, 53639861, 61415095, 78259445, 8069568, 63831048, 14798944, 72354537, 5481814, 64856913] [75261275, 51789647, 64948925, 34231638, 74260490, 40389897, 18397434, 56577341, 60494367, 27658509, 28552918, 6719631, 23466735, 21740725, 1658710, 73396429, 7101200, 44729905, 42935521, 45272530]))
31
+
32
+ test8 :: Test
33
+ test8 = TestCase (assertEqual "for (maxRectangleArea [57540235, 25624178, 37650923, 22689188, 34866098] [11699477, 29964064, 20796260, 27595145, 17369442])," (-1) (maxRectangleArea [57540235, 25624178, 37650923, 22689188, 34866098] [11699477, 29964064, 20796260, 27595145, 17369442]))
34
+
35
+ test9 :: Test
36
+ test9 = TestCase (assertEqual "for (maxRectangleArea [67709643, 33227524, 8400082, 25517272, 45209563, 8382362, 59702895, 1439596, 45481743, 76457924, 20003754, 10775140, 35316104, 56312025, 43969792, 16568428, 54481026] [32345727, 35370525, 74631338, 8336085, 40460069, 77067617, 50206426, 78434814, 45479448, 78884383, 39432878, 20884003, 70295330, 30627688, 7844266, 44804534, 69949212])," (-1) (maxRectangleArea [67709643, 33227524, 8400082, 25517272, 45209563, 8382362, 59702895, 1439596, 45481743, 76457924, 20003754, 10775140, 35316104, 56312025, 43969792, 16568428, 54481026] [32345727, 35370525, 74631338, 8336085, 40460069, 77067617, 50206426, 78434814, 45479448, 78884383, 39432878, 20884003, 70295330, 30627688, 7844266, 44804534, 69949212]))
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
maximum_area_rectangle_with_point_constraints_ii/java_tests/Main.java ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import static org.junit.jupiter.api.Assertions.*;
3
+ import org.junit.jupiter.api.Test;
4
+ import java.util.List;
5
+ import java.util.Arrays;
6
+ import java.util.ArrayList;
7
+ public class Main {
8
+ //Program start
9
+
10
+ //Program end
11
+
12
+ @Test
13
+ public void test1() {
14
+ assertEquals(4, maxRectangleArea(new ArrayList<>(Arrays.asList(1,1,3,3)), new ArrayList<>(Arrays.asList(1,3,1,3))));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals(-1, maxRectangleArea(new ArrayList<>(Arrays.asList(1,1,3,3,2)), new ArrayList<>(Arrays.asList(1,3,1,3,2))));
19
+ }
20
+ @Test
21
+ public void test3() {
22
+ assertEquals(2, maxRectangleArea(new ArrayList<>(Arrays.asList(1,1,3,3,1,3)), new ArrayList<>(Arrays.asList(1,3,1,3,2,2))));
23
+ }
24
+
25
+ }
maximum_area_rectangle_with_point_constraints_ii/meta.json ADDED
@@ -0,0 +1,362 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "id": 3689,
3
+ "name": "maximum_area_rectangle_with_point_constraints_ii",
4
+ "difficulty": "Hard",
5
+ "link": "https://leetcode.com/problems/maximum-area-rectangle-with-point-constraints-ii/",
6
+ "date": "2024-12-01 00:00:00",
7
+ "task_description": "There are n points on an infinite plane. You are given two integer arrays `xCoord` and `yCoord` where `(xCoord[i], yCoord[i])` represents the coordinates of the `ith` point. Your task is to find the **maximum **area of a rectangle that: Can be formed using **four** of these points as its corners. Does **not** contain any other point inside or on its border. Has its edges **parallel** to the axes. Return the **maximum area** that you can obtain or -1 if no such rectangle is possible. **Example 1:** **Input:** xCoord = [1,1,3,3], yCoord = [1,3,1,3] **Output:** 4 **Explanation:** **** We can make a rectangle with these 4 points as corners and there is no other point that lies inside or on the border. Hence, the maximum possible area would be 4. **Example 2:** **Input:** xCoord = [1,1,3,3,2], yCoord = [1,3,1,3,2] **Output:** -1 **Explanation:** **** There is only one rectangle possible is with points `[1,1], [1,3], [3,1]` and `[3,3]` but `[2,2]` will always lie inside it. Hence, returning -1. **Example 3:** **Input:** xCoord = [1,1,3,3,1,3], yCoord = [1,3,1,3,2,2] **Output:** 2 **Explanation:** **** The maximum area rectangle is formed by the points `[1,3], [1,2], [3,2], [3,3]`, which has an area of 2. Additionally, the points `[1,1], [1,2], [3,1], [3,2]` also form a valid rectangle with the same area. **Constraints:** `1 <= xCoord.length == yCoord.length <= 2 * 105` `0 <= xCoord[i], yCoord[i] <= 8 * 107` All the given points are **unique**.",
8
+ "public_test_cases": [
9
+ {
10
+ "label": "Example 1",
11
+ "input": "xCoord = [1,1,3,3], yCoord = [1,3,1,3]",
12
+ "output": "4 "
13
+ },
14
+ {
15
+ "label": "Example 2",
16
+ "input": "xCoord = [1,1,3,3,2], yCoord = [1,3,1,3,2]",
17
+ "output": "-1 "
18
+ },
19
+ {
20
+ "label": "Example 3",
21
+ "input": "xCoord = [1,1,3,3,1,3], yCoord = [1,3,1,3,2,2]",
22
+ "output": "2 "
23
+ }
24
+ ],
25
+ "private_test_cases": [
26
+ {
27
+ "input": [
28
+ [
29
+ 2775251,
30
+ 15465771,
31
+ 60248552,
32
+ 69068054,
33
+ 32307832,
34
+ 7289130,
35
+ 67773578,
36
+ 1124002,
37
+ 11417286,
38
+ 6704738,
39
+ 1380807,
40
+ 30883793,
41
+ 20945649,
42
+ 63312606,
43
+ 18304738,
44
+ 65470199,
45
+ 55088899,
46
+ 73863090,
47
+ 77583553,
48
+ 48633582
49
+ ],
50
+ [
51
+ 40521121,
52
+ 1057342,
53
+ 20051701,
54
+ 30111767,
55
+ 18586971,
56
+ 60680139,
57
+ 22003205,
58
+ 44664399,
59
+ 20391669,
60
+ 75651066,
61
+ 63102693,
62
+ 79751859,
63
+ 18798845,
64
+ 58278059,
65
+ 58841902,
66
+ 6691528,
67
+ 531455,
68
+ 62613577,
69
+ 60875989,
70
+ 28502724
71
+ ]
72
+ ],
73
+ "output": -1
74
+ },
75
+ {
76
+ "input": [
77
+ [
78
+ 66855275,
79
+ 6962965,
80
+ 28634554,
81
+ 59810953,
82
+ 50174999,
83
+ 42177349,
84
+ 43467511
85
+ ],
86
+ [
87
+ 61597978,
88
+ 46030985,
89
+ 13770457,
90
+ 58796632,
91
+ 55931557,
92
+ 20634821,
93
+ 74943633
94
+ ]
95
+ ],
96
+ "output": -1
97
+ },
98
+ {
99
+ "input": [
100
+ [
101
+ 64253447,
102
+ 15053746,
103
+ 19526565,
104
+ 67831574,
105
+ 51589979,
106
+ 1860955,
107
+ 32910477,
108
+ 40867020,
109
+ 66120655,
110
+ 70054786,
111
+ 31620358,
112
+ 7293109,
113
+ 52066018,
114
+ 58015992,
115
+ 1833864,
116
+ 12805908,
117
+ 46615227
118
+ ],
119
+ [
120
+ 32476072,
121
+ 20370323,
122
+ 67086099,
123
+ 15060351,
124
+ 31988721,
125
+ 74520276,
126
+ 46892114,
127
+ 61753766,
128
+ 57172834,
129
+ 413078,
130
+ 23426343,
131
+ 10477631,
132
+ 14881860,
133
+ 8413999,
134
+ 58663421,
135
+ 78183694,
136
+ 55172445
137
+ ]
138
+ ],
139
+ "output": -1
140
+ },
141
+ {
142
+ "input": [
143
+ [
144
+ 2769856,
145
+ 75818483,
146
+ 60495239,
147
+ 52271952,
148
+ 63104275,
149
+ 33513444,
150
+ 6785827,
151
+ 8698135,
152
+ 68962930,
153
+ 9418269,
154
+ 22271347,
155
+ 53639861,
156
+ 61415095,
157
+ 78259445,
158
+ 8069568,
159
+ 63831048,
160
+ 14798944,
161
+ 72354537,
162
+ 5481814,
163
+ 64856913
164
+ ],
165
+ [
166
+ 75261275,
167
+ 51789647,
168
+ 64948925,
169
+ 34231638,
170
+ 74260490,
171
+ 40389897,
172
+ 18397434,
173
+ 56577341,
174
+ 60494367,
175
+ 27658509,
176
+ 28552918,
177
+ 6719631,
178
+ 23466735,
179
+ 21740725,
180
+ 1658710,
181
+ 73396429,
182
+ 7101200,
183
+ 44729905,
184
+ 42935521,
185
+ 45272530
186
+ ]
187
+ ],
188
+ "output": -1
189
+ },
190
+ {
191
+ "input": [
192
+ [
193
+ 57540235,
194
+ 25624178,
195
+ 37650923,
196
+ 22689188,
197
+ 34866098
198
+ ],
199
+ [
200
+ 11699477,
201
+ 29964064,
202
+ 20796260,
203
+ 27595145,
204
+ 17369442
205
+ ]
206
+ ],
207
+ "output": -1
208
+ },
209
+ {
210
+ "input": [
211
+ [
212
+ 67709643,
213
+ 33227524,
214
+ 8400082,
215
+ 25517272,
216
+ 45209563,
217
+ 8382362,
218
+ 59702895,
219
+ 1439596,
220
+ 45481743,
221
+ 76457924,
222
+ 20003754,
223
+ 10775140,
224
+ 35316104,
225
+ 56312025,
226
+ 43969792,
227
+ 16568428,
228
+ 54481026
229
+ ],
230
+ [
231
+ 32345727,
232
+ 35370525,
233
+ 74631338,
234
+ 8336085,
235
+ 40460069,
236
+ 77067617,
237
+ 50206426,
238
+ 78434814,
239
+ 45479448,
240
+ 78884383,
241
+ 39432878,
242
+ 20884003,
243
+ 70295330,
244
+ 30627688,
245
+ 7844266,
246
+ 44804534,
247
+ 69949212
248
+ ]
249
+ ],
250
+ "output": -1
251
+ },
252
+ {
253
+ "input": [
254
+ [
255
+ 3217501,
256
+ 9228867,
257
+ 779878,
258
+ 51453884,
259
+ 77962327,
260
+ 46387231,
261
+ 41661806,
262
+ 67152638,
263
+ 54678293,
264
+ 61414039
265
+ ],
266
+ [
267
+ 66294494,
268
+ 56034905,
269
+ 3660104,
270
+ 53454188,
271
+ 60436385,
272
+ 38774804,
273
+ 43968974,
274
+ 79585007,
275
+ 46126661,
276
+ 28578865
277
+ ]
278
+ ],
279
+ "output": -1
280
+ },
281
+ {
282
+ "input": [
283
+ [
284
+ 38014061,
285
+ 41298651,
286
+ 56292287,
287
+ 765897,
288
+ 112508,
289
+ 70947775
290
+ ],
291
+ [
292
+ 74725954,
293
+ 16609219,
294
+ 8649059,
295
+ 5471288,
296
+ 16023054,
297
+ 59381748
298
+ ]
299
+ ],
300
+ "output": -1
301
+ },
302
+ {
303
+ "input": [
304
+ [
305
+ 72285809,
306
+ 66493609,
307
+ 37445465,
308
+ 65099696,
309
+ 55315733,
310
+ 35631867,
311
+ 74830170,
312
+ 63550575,
313
+ 36507954
314
+ ],
315
+ [
316
+ 69427131,
317
+ 2426842,
318
+ 22680401,
319
+ 24500184,
320
+ 43444331,
321
+ 27951053,
322
+ 45988813,
323
+ 46664674,
324
+ 73743477
325
+ ]
326
+ ],
327
+ "output": -1
328
+ },
329
+ {
330
+ "input": [
331
+ [
332
+ 74366639,
333
+ 71182844,
334
+ 76885797,
335
+ 32415964,
336
+ 13327512,
337
+ 40094436,
338
+ 26342512,
339
+ 57732981,
340
+ 37349482
341
+ ],
342
+ [
343
+ 37390960,
344
+ 67341138,
345
+ 52533890,
346
+ 53366100,
347
+ 42662995,
348
+ 49214596,
349
+ 31565623,
350
+ 36988983,
351
+ 56581855
352
+ ]
353
+ ],
354
+ "output": -1
355
+ }
356
+ ],
357
+ "haskell_template": "maxRectangleArea :: [Int] -> [Int] -> Int\nmaxRectangleArea xCoord yCoord ",
358
+ "ocaml_template": "let maxRectangleArea (xCoord: int list) (yCoord: int list) : int = ",
359
+ "scala_template": "def maxRectangleArea(xCoord: List[Int],yCoord: List[Int]): Int = { \n \n}",
360
+ "java_template": "class Solution {\n public long maxRectangleArea(int[] xCoord, int[] yCoord) {\n \n }\n}",
361
+ "python_template": "class Solution(object):\n def maxRectangleArea(self, xCoord, yCoord):\n \"\"\"\n :type xCoord: List[int]\n :type yCoord: List[int]\n :rtype: int\n \"\"\"\n "
362
+ }
maximum_area_rectangle_with_point_constraints_ii/ocaml_tests/main.ml ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ module Main = struct
3
+ open OUnit2
4
+
5
+ (* Program start *)
6
+
7
+ (* Program end *)
8
+
9
+ (* Test cases *)
10
+
11
+ let test1 _ = assert_equal 4 (maxRectangleArea [1;1;3;3] [1;3;1;3])
12
+
13
+ let test2 _ = assert_equal (-1) (maxRectangleArea [1;1;3;3;2] [1;3;1;3;2])
14
+
15
+ let test3 _ = assert_equal 2 (maxRectangleArea [1;1;3;3;1;3] [1;3;1;3;2;2])
16
+
17
+ let test4 _ = assert_equal (-1) (maxRectangleArea [2775251; 15465771; 60248552; 69068054; 32307832; 7289130; 67773578; 1124002; 11417286; 6704738; 1380807; 30883793; 20945649; 63312606; 18304738; 65470199; 55088899; 73863090; 77583553; 48633582] [40521121; 1057342; 20051701; 30111767; 18586971; 60680139; 22003205; 44664399; 20391669; 75651066; 63102693; 79751859; 18798845; 58278059; 58841902; 6691528; 531455; 62613577; 60875989; 28502724])
18
+
19
+ let test5 _ = assert_equal (-1) (maxRectangleArea [66855275; 6962965; 28634554; 59810953; 50174999; 42177349; 43467511] [61597978; 46030985; 13770457; 58796632; 55931557; 20634821; 74943633])
20
+
21
+ let test6 _ = assert_equal (-1) (maxRectangleArea [64253447; 15053746; 19526565; 67831574; 51589979; 1860955; 32910477; 40867020; 66120655; 70054786; 31620358; 7293109; 52066018; 58015992; 1833864; 12805908; 46615227] [32476072; 20370323; 67086099; 15060351; 31988721; 74520276; 46892114; 61753766; 57172834; 413078; 23426343; 10477631; 14881860; 8413999; 58663421; 78183694; 55172445])
22
+
23
+ let test7 _ = assert_equal (-1) (maxRectangleArea [2769856; 75818483; 60495239; 52271952; 63104275; 33513444; 6785827; 8698135; 68962930; 9418269; 22271347; 53639861; 61415095; 78259445; 8069568; 63831048; 14798944; 72354537; 5481814; 64856913] [75261275; 51789647; 64948925; 34231638; 74260490; 40389897; 18397434; 56577341; 60494367; 27658509; 28552918; 6719631; 23466735; 21740725; 1658710; 73396429; 7101200; 44729905; 42935521; 45272530])
24
+
25
+ let test8 _ = assert_equal (-1) (maxRectangleArea [57540235; 25624178; 37650923; 22689188; 34866098] [11699477; 29964064; 20796260; 27595145; 17369442])
26
+
27
+ let test9 _ = assert_equal (-1) (maxRectangleArea [67709643; 33227524; 8400082; 25517272; 45209563; 8382362; 59702895; 1439596; 45481743; 76457924; 20003754; 10775140; 35316104; 56312025; 43969792; 16568428; 54481026] [32345727; 35370525; 74631338; 8336085; 40460069; 77067617; 50206426; 78434814; 45479448; 78884383; 39432878; 20884003; 70295330; 30627688; 7844266; 44804534; 69949212])
28
+
29
+ let test10 _ = assert_equal (-1) (maxRectangleArea [3217501; 9228867; 779878; 51453884; 77962327; 46387231; 41661806; 67152638; 54678293; 61414039] [66294494; 56034905; 3660104; 53454188; 60436385; 38774804; 43968974; 79585007; 46126661; 28578865])
30
+
31
+
32
+ (* Grouping test cases *)
33
+ let suite = "Test Suite for maxRectangleArea" >::: [
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
maximum_area_rectangle_with_point_constraints_ii/scala_tests/MySuite.scala ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ class MySuite extends munit.FunSuite {
3
+
4
+ test("test1") {
5
+ assertEquals(Main.maxRectangleArea(List(1,1,3,3),List(1,3,1,3)), 4)
6
+ }
7
+
8
+ test("test2") {
9
+ assertEquals(Main.maxRectangleArea(List(1,1,3,3,2),List(1,3,1,3,2)), -1)
10
+ }
11
+
12
+ test("test3") {
13
+ assertEquals(Main.maxRectangleArea(List(1,1,3,3,1,3),List(1,3,1,3,2,2)), 2)
14
+ }
15
+
16
+ test("test4") {
17
+ assertEquals(Main.maxRectangleArea(List(2775251, 15465771, 60248552, 69068054, 32307832, 7289130, 67773578, 1124002, 11417286, 6704738, 1380807, 30883793, 20945649, 63312606, 18304738, 65470199, 55088899, 73863090, 77583553, 48633582),List(40521121, 1057342, 20051701, 30111767, 18586971, 60680139, 22003205, 44664399, 20391669, 75651066, 63102693, 79751859, 18798845, 58278059, 58841902, 6691528, 531455, 62613577, 60875989, 28502724)), -1)
18
+ }
19
+
20
+ test("test5") {
21
+ assertEquals(Main.maxRectangleArea(List(66855275, 6962965, 28634554, 59810953, 50174999, 42177349, 43467511),List(61597978, 46030985, 13770457, 58796632, 55931557, 20634821, 74943633)), -1)
22
+ }
23
+
24
+ test("test6") {
25
+ assertEquals(Main.maxRectangleArea(List(64253447, 15053746, 19526565, 67831574, 51589979, 1860955, 32910477, 40867020, 66120655, 70054786, 31620358, 7293109, 52066018, 58015992, 1833864, 12805908, 46615227),List(32476072, 20370323, 67086099, 15060351, 31988721, 74520276, 46892114, 61753766, 57172834, 413078, 23426343, 10477631, 14881860, 8413999, 58663421, 78183694, 55172445)), -1)
26
+ }
27
+
28
+ test("test7") {
29
+ assertEquals(Main.maxRectangleArea(List(2769856, 75818483, 60495239, 52271952, 63104275, 33513444, 6785827, 8698135, 68962930, 9418269, 22271347, 53639861, 61415095, 78259445, 8069568, 63831048, 14798944, 72354537, 5481814, 64856913),List(75261275, 51789647, 64948925, 34231638, 74260490, 40389897, 18397434, 56577341, 60494367, 27658509, 28552918, 6719631, 23466735, 21740725, 1658710, 73396429, 7101200, 44729905, 42935521, 45272530)), -1)
30
+ }
31
+
32
+ test("test8") {
33
+ assertEquals(Main.maxRectangleArea(List(57540235, 25624178, 37650923, 22689188, 34866098),List(11699477, 29964064, 20796260, 27595145, 17369442)), -1)
34
+ }
35
+
36
+ test("test9") {
37
+ assertEquals(Main.maxRectangleArea(List(67709643, 33227524, 8400082, 25517272, 45209563, 8382362, 59702895, 1439596, 45481743, 76457924, 20003754, 10775140, 35316104, 56312025, 43969792, 16568428, 54481026),List(32345727, 35370525, 74631338, 8336085, 40460069, 77067617, 50206426, 78434814, 45479448, 78884383, 39432878, 20884003, 70295330, 30627688, 7844266, 44804534, 69949212)), -1)
38
+ }
39
+
40
+ test("test10") {
41
+ assertEquals(Main.maxRectangleArea(List(3217501, 9228867, 779878, 51453884, 77962327, 46387231, 41661806, 67152638, 54678293, 61414039),List(66294494, 56034905, 3660104, 53454188, 60436385, 38774804, 43968974, 79585007, 46126661, 28578865)), -1)
42
+ }
43
+
44
+ }
maximum_bags_with_full_capacity_of_rocks/haskell_tests/Main.hs ADDED
The diff for this file is too large to render. See raw diff
 
maximum_bags_with_full_capacity_of_rocks/java_tests/Main.java ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import static org.junit.jupiter.api.Assertions.*;
3
+ import org.junit.jupiter.api.Test;
4
+ import java.util.List;
5
+ import java.util.Arrays;
6
+ import java.util.ArrayList;
7
+ public class Main {
8
+ //Program start
9
+
10
+ //Program end
11
+
12
+ @Test
13
+ public void test1() {
14
+ assertEquals(3, maximumBags(new ArrayList<>(Arrays.asList(2,3,4,5)), new ArrayList<>(Arrays.asList(1,2,4,4)), 2));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals(3, maximumBags(new ArrayList<>(Arrays.asList(10,2,2)), new ArrayList<>(Arrays.asList(2,2,0)), 100));
19
+ }
20
+
21
+ }
maximum_bags_with_full_capacity_of_rocks/meta.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4e95bf81c03989a76c3c3641d278749a6a1d45eb4ead0ed53e58bfb6a606b87c
3
+ size 14837039
maximum_bags_with_full_capacity_of_rocks/ocaml_tests/main.ml ADDED
The diff for this file is too large to render. See raw diff
 
maximum_bags_with_full_capacity_of_rocks/scala_tests/MySuite.scala ADDED
The diff for this file is too large to render. See raw diff
 
maximum_balanced_subsequence_sum/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(14, maxBalancedSubsequenceSum(Arrays.asList(3,3,5,6)));
14
+ }
15
+ @Test
16
+ public void test2() {
17
+ assertEquals(13, maxBalancedSubsequenceSum(Arrays.asList(5,-1,-3,8)));
18
+ }
19
+ @Test
20
+ public void test3() {
21
+ assertEquals(-1, maxBalancedSubsequenceSum(Arrays.asList(-2,-1)));
22
+ }
23
+
24
+ }
maximum_beauty_of_an_array_after_applying_operation/.DS_Store ADDED
Binary file (6.15 kB). View file
 
maximum_beauty_of_an_array_after_applying_operation/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 (maximumBeauty [4,6,1,2] 2)," 3 (maximumBeauty [4,6,1,2] 2))
13
+
14
+ test2 :: Test
15
+ test2 = TestCase (assertEqual "for (maximumBeauty [1,1,1,1] 10)," 4 (maximumBeauty [1,1,1,1] 10))
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
maximum_beauty_of_an_array_after_applying_operation/java_tests/Main.java ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import static org.junit.jupiter.api.Assertions.*;
3
+ import org.junit.jupiter.api.Test;
4
+ import java.util.List;
5
+ import java.util.Arrays;
6
+ import java.util.ArrayList;
7
+ public class Main {
8
+ //Program start
9
+
10
+ //Program end
11
+
12
+ @Test
13
+ public void test1() {
14
+ assertEquals(3, maximumBeauty(new ArrayList<>(Arrays.asList(4,6,1,2)), 2));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals(4, maximumBeauty(new ArrayList<>(Arrays.asList(1,1,1,1)), 10));
19
+ }
20
+
21
+ }
maximum_beauty_of_an_array_after_applying_operation/meta.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5e1e0c158bd64f0ca0882558523d08ef0121abd90f4fa55e2e4ea428c08ae6eb
3
+ size 10849573
maximum_beauty_of_an_array_after_applying_operation/ocaml_tests/main.ml ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ module Main = struct
3
+ open OUnit2
4
+
5
+ (* Program start *)
6
+
7
+ (* Program end *)
8
+
9
+ (* Test cases *)
10
+
11
+ let test1 _ = assert_equal 3 (maximumBeauty [4;6;1;2] 2)
12
+
13
+ let test2 _ = assert_equal 4 (maximumBeauty [1;1;1;1] 10)
14
+
15
+
16
+ (* Grouping test cases *)
17
+ let suite = "Test Suite for maximumBeauty" >::: [
18
+
19
+ "test1" >:: test1;
20
+ "test2" >:: test2;
21
+ ]
22
+
23
+
24
+ (* Running the tests *)
25
+ let () = run_test_tt_main suite
26
+ end
maximum_beauty_of_an_array_after_applying_operation/scala_tests/MySuite.scala ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ class MySuite extends munit.FunSuite {
3
+
4
+ test("test1") {
5
+ assertEquals(Main.maximumBeauty(List(4,6,1,2),2), 3)
6
+ }
7
+
8
+ test("test2") {
9
+ assertEquals(Main.maximumBeauty(List(1,1,1,1),10), 4)
10
+ }
11
+
12
+ }
maximum_coins_from_k_consecutive_bags/haskell_tests/Main.hs ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:74f980d00ff0b706d8d0bd62fe0c31d4d27a87dcaf58a68d911afb4fc34b4de2
3
+ size 17223296
maximum_coins_from_k_consecutive_bags/java_tests/Main.java ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import static org.junit.jupiter.api.Assertions.*;
3
+ import org.junit.jupiter.api.Test;
4
+ import java.util.List;
5
+ import java.util.Arrays;
6
+ import java.util.ArrayList;
7
+ public class Main {
8
+ //Program start
9
+
10
+ //Program end
11
+
12
+ @Test
13
+ public void test1() {
14
+ assertEquals(10, maximumCoins(new ArrayList<>(Arrays.asList(new ArrayList<>(Arrays.asList(8,10,1)),new ArrayList<>(Arrays.asList(1,3,2)),new ArrayList<>(Arrays.asList(5,6,4)))), 4));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals(6, maximumCoins(new ArrayList<>(Arrays.asList(new ArrayList<>(Arrays.asList(1,10,3)))), 2));
19
+ }
20
+
21
+ }
maximum_coins_from_k_consecutive_bags/meta.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5227d593b2cfef088e59d18d6f27aab09582dcc80cf199bc3bef160b7a80a1b3
3
+ size 38726881
maximum_coins_from_k_consecutive_bags/ocaml_tests/main.ml ADDED
The diff for this file is too large to render. See raw diff
 
maximum_coins_from_k_consecutive_bags/scala_tests/MySuite.scala ADDED
The diff for this file is too large to render. See raw diff
 
maximum_consecutive_floors_without_special_floors/.DS_Store ADDED
Binary file (6.15 kB). View file
 
maximum_consecutive_floors_without_special_floors/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 (maxConsecutive 2 9 [4,6])," 3 (maxConsecutive 2 9 [4,6]))
13
+
14
+ test2 :: Test
15
+ test2 = TestCase (assertEqual "for (maxConsecutive 6 8 [7,6,8])," 0 (maxConsecutive 6 8 [7,6,8]))
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
maximum_consecutive_floors_without_special_floors/java_tests/Main.java ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import static org.junit.jupiter.api.Assertions.*;
3
+ import org.junit.jupiter.api.Test;
4
+ import java.util.List;
5
+ import java.util.Arrays;
6
+ import java.util.ArrayList;
7
+ public class Main {
8
+ //Program start
9
+
10
+ //Program end
11
+
12
+ @Test
13
+ public void test1() {
14
+ assertEquals(3, maxConsecutive(2, 9, new ArrayList<>(Arrays.asList(4,6))));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals(0, maxConsecutive(6, 8, new ArrayList<>(Arrays.asList(7,6,8))));
19
+ }
20
+
21
+ }
maximum_consecutive_floors_without_special_floors/meta.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3a3dcb27e4ce8724319b8a2d3d86047b43468195ecf01ff2148ad3ded07ec531
3
+ size 22741595
maximum_consecutive_floors_without_special_floors/ocaml_tests/main.ml ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ module Main = struct
3
+ open OUnit2
4
+
5
+ (* Program start *)
6
+
7
+ (* Program end *)
8
+
9
+ (* Test cases *)
10
+
11
+ let test1 _ = assert_equal 3 (maxConsecutive 2 9 [4;6])
12
+
13
+ let test2 _ = assert_equal 0 (maxConsecutive 6 8 [7;6;8])
14
+
15
+
16
+ (* Grouping test cases *)
17
+ let suite = "Test Suite for maxConsecutive" >::: [
18
+
19
+ "test1" >:: test1;
20
+ "test2" >:: test2;
21
+ ]
22
+
23
+
24
+ (* Running the tests *)
25
+ let () = run_test_tt_main suite
26
+ end
maximum_consecutive_floors_without_special_floors/scala_tests/MySuite.scala ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ class MySuite extends munit.FunSuite {
3
+
4
+ test("test1") {
5
+ assertEquals(Main.maxConsecutive(2,9,List(4,6)), 3)
6
+ }
7
+
8
+ test("test2") {
9
+ assertEquals(Main.maxConsecutive(6,8,List(7,6,8)), 0)
10
+ }
11
+
12
+ }
maximum_containers_on_a_ship/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 (maxContainers 2 3 15)," 4 (maxContainers 2 3 15))
13
+
14
+ test2 :: Test
15
+ test2 = TestCase (assertEqual "for (maxContainers 3 5 20)," 4 (maxContainers 3 5 20))
16
+
17
+ test3 :: Test
18
+ test3 = TestCase (assertEqual "for (maxContainers 241 562 399586224)," 58081 (maxContainers 241 562 399586224))
19
+
20
+ test4 :: Test
21
+ test4 = TestCase (assertEqual "for (maxContainers 820 468 511432531)," 672400 (maxContainers 820 468 511432531))
22
+
23
+ test5 :: Test
24
+ test5 = TestCase (assertEqual "for (maxContainers 89 699 447942896)," 7921 (maxContainers 89 699 447942896))
25
+
26
+ test6 :: Test
27
+ test6 = TestCase (assertEqual "for (maxContainers 556 382 950949763)," 309136 (maxContainers 556 382 950949763))
28
+
29
+ test7 :: Test
30
+ test7 = TestCase (assertEqual "for (maxContainers 812 150 808876004)," 659344 (maxContainers 812 150 808876004))
31
+
32
+ test8 :: Test
33
+ test8 = TestCase (assertEqual "for (maxContainers 382 351 885534365)," 145924 (maxContainers 382 351 885534365))
34
+
35
+ test9 :: Test
36
+ test9 = TestCase (assertEqual "for (maxContainers 817 372 8601285)," 23121 (maxContainers 817 372 8601285))
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
maximum_containers_on_a_ship/java_tests/Main.java ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import static org.junit.jupiter.api.Assertions.*;
3
+ import org.junit.jupiter.api.Test;
4
+ import java.util.List;
5
+ import java.util.Arrays;
6
+ import java.util.ArrayList;
7
+ public class Main {
8
+ //Program start
9
+
10
+ //Program end
11
+
12
+ @Test
13
+ public void test1() {
14
+ assertEquals(4, maxContainers(2, 3, 15));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals(4, maxContainers(3, 5, 20));
19
+ }
20
+
21
+ }
maximum_containers_on_a_ship/meta.json ADDED
@@ -0,0 +1,107 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "id": 3817,
3
+ "name": "maximum_containers_on_a_ship",
4
+ "difficulty": "Easy",
5
+ "link": "https://leetcode.com/problems/maximum-containers-on-a-ship/",
6
+ "date": "2025-03-16 00:00:00",
7
+ "task_description": "You are given a positive integer `n` representing an `n x n` cargo deck on a ship. Each cell on the deck can hold one container with a weight of **exactly** `w`. However, the total weight of all containers, if loaded onto the deck, must not exceed the ship's maximum weight capacity, `maxWeight`. Return the **maximum** number of containers that can be loaded onto the ship. **Example 1:** **Input:** n = 2, w = 3, maxWeight = 15 **Output:** 4 **Explanation: ** The deck has 4 cells, and each container weighs 3. The total weight of loading all containers is 12, which does not exceed `maxWeight`. **Example 2:** **Input:** n = 3, w = 5, maxWeight = 20 **Output:** 4 **Explanation: ** The deck has 9 cells, and each container weighs 5. The maximum number of containers that can be loaded without exceeding `maxWeight` is 4. **Constraints:** `1 <= n <= 1000` `1 <= w <= 1000` `1 <= maxWeight <= 109`",
8
+ "public_test_cases": [
9
+ {
10
+ "label": "Example 1",
11
+ "input": "n = 2, w = 3, maxWeight = 15",
12
+ "output": "4 "
13
+ },
14
+ {
15
+ "label": "Example 2",
16
+ "input": "n = 3, w = 5, maxWeight = 20",
17
+ "output": "4 "
18
+ }
19
+ ],
20
+ "private_test_cases": [
21
+ {
22
+ "input": [
23
+ 241,
24
+ 562,
25
+ 399586224
26
+ ],
27
+ "output": 58081
28
+ },
29
+ {
30
+ "input": [
31
+ 820,
32
+ 468,
33
+ 511432531
34
+ ],
35
+ "output": 672400
36
+ },
37
+ {
38
+ "input": [
39
+ 89,
40
+ 699,
41
+ 447942896
42
+ ],
43
+ "output": 7921
44
+ },
45
+ {
46
+ "input": [
47
+ 556,
48
+ 382,
49
+ 950949763
50
+ ],
51
+ "output": 309136
52
+ },
53
+ {
54
+ "input": [
55
+ 812,
56
+ 150,
57
+ 808876004
58
+ ],
59
+ "output": 659344
60
+ },
61
+ {
62
+ "input": [
63
+ 382,
64
+ 351,
65
+ 885534365
66
+ ],
67
+ "output": 145924
68
+ },
69
+ {
70
+ "input": [
71
+ 817,
72
+ 372,
73
+ 8601285
74
+ ],
75
+ "output": 23121
76
+ },
77
+ {
78
+ "input": [
79
+ 447,
80
+ 405,
81
+ 374785210
82
+ ],
83
+ "output": 199809
84
+ },
85
+ {
86
+ "input": [
87
+ 190,
88
+ 107,
89
+ 537875366
90
+ ],
91
+ "output": 36100
92
+ },
93
+ {
94
+ "input": [
95
+ 11,
96
+ 562,
97
+ 1914102
98
+ ],
99
+ "output": 121
100
+ }
101
+ ],
102
+ "haskell_template": "maxContainers :: Int -> Int -> Int -> Int\nmaxContainers n w maxWeight ",
103
+ "ocaml_template": "let maxContainers (n: int) (w: int) (maxWeight: int) : int = ",
104
+ "scala_template": "def maxContainers(n: Int,w: Int,maxWeight: Int): Int = { \n \n}",
105
+ "java_template": "class Solution {\n public int maxContainers(int n, int w, int maxWeight) {\n \n }\n}",
106
+ "python_template": "class Solution(object):\n def maxContainers(self, n, w, maxWeight):\n \"\"\"\n :type n: int\n :type w: int\n :type maxWeight: int\n :rtype: int\n \"\"\"\n "
107
+ }
maximum_containers_on_a_ship/ocaml_tests/main.ml ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ module Main = struct
3
+ open OUnit2
4
+
5
+ (* Program start *)
6
+
7
+ (* Program end *)
8
+
9
+ (* Test cases *)
10
+
11
+ let test1 _ = assert_equal 4 (maxContainers 2 3 15)
12
+
13
+ let test2 _ = assert_equal 4 (maxContainers 3 5 20)
14
+
15
+ let test3 _ = assert_equal 58081 (maxContainers 241 562 399586224)
16
+
17
+ let test4 _ = assert_equal 672400 (maxContainers 820 468 511432531)
18
+
19
+ let test5 _ = assert_equal 7921 (maxContainers 89 699 447942896)
20
+
21
+ let test6 _ = assert_equal 309136 (maxContainers 556 382 950949763)
22
+
23
+ let test7 _ = assert_equal 659344 (maxContainers 812 150 808876004)
24
+
25
+ let test8 _ = assert_equal 145924 (maxContainers 382 351 885534365)
26
+
27
+ let test9 _ = assert_equal 23121 (maxContainers 817 372 8601285)
28
+
29
+ let test10 _ = assert_equal 199809 (maxContainers 447 405 374785210)
30
+
31
+
32
+ (* Grouping test cases *)
33
+ let suite = "Test Suite for maxContainers" >::: [
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
maximum_containers_on_a_ship/scala_tests/MySuite.scala ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ class MySuite extends munit.FunSuite {
3
+
4
+ test("test1") {
5
+ assertEquals(Main.maxContainers(2,3,15), 4)
6
+ }
7
+
8
+ test("test2") {
9
+ assertEquals(Main.maxContainers(3,5,20), 4)
10
+ }
11
+
12
+ test("test3") {
13
+ assertEquals(Main.maxContainers(241,562,399586224), 58081)
14
+ }
15
+
16
+ test("test4") {
17
+ assertEquals(Main.maxContainers(820,468,511432531), 672400)
18
+ }
19
+
20
+ test("test5") {
21
+ assertEquals(Main.maxContainers(89,699,447942896), 7921)
22
+ }
23
+
24
+ test("test6") {
25
+ assertEquals(Main.maxContainers(556,382,950949763), 309136)
26
+ }
27
+
28
+ test("test7") {
29
+ assertEquals(Main.maxContainers(812,150,808876004), 659344)
30
+ }
31
+
32
+ test("test8") {
33
+ assertEquals(Main.maxContainers(382,351,885534365), 145924)
34
+ }
35
+
36
+ test("test9") {
37
+ assertEquals(Main.maxContainers(817,372,8601285), 23121)
38
+ }
39
+
40
+ test("test10") {
41
+ assertEquals(Main.maxContainers(447,405,374785210), 199809)
42
+ }
43
+
44
+ }
maximum_count_of_positive_integer_and_negative_integer/.DS_Store ADDED
Binary file (6.15 kB). View file
 
maximum_count_of_positive_integer_and_negative_integer/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 (maximumCount [-2,-1,-1,1,2,3])," 3 (maximumCount [-2,-1,-1,1,2,3]))
13
+
14
+ test2 :: Test
15
+ test2 = TestCase (assertEqual "for (maximumCount [-3,-2,-1,0,0,1,2])," 3 (maximumCount [-3,-2,-1,0,0,1,2]))
16
+
17
+ test3 :: Test
18
+ test3 = TestCase (assertEqual "for (maximumCount [5,20,66,1314])," 4 (maximumCount [5,20,66,1314]))
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