DatasetRepo commited on
Commit
6e4e317
·
verified ·
1 Parent(s): 43d9f7d

d3ec4bc329ab8e77c7f120993a0cac0ae097c2241e063ea6b785f2383e7bc4f5

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +1 -0
  2. minimum_moves_to_pick_k_ones/java_tests/Main.java +21 -0
  3. minimum_moves_to_pick_k_ones/meta.json +0 -0
  4. minimum_moves_to_pick_k_ones/ocaml_tests/main.ml +0 -0
  5. minimum_moves_to_pick_k_ones/scala_tests/MySuite.scala +0 -0
  6. minimum_moves_to_spread_stones_over_grid/java_tests/Main.java +20 -0
  7. minimum_number_game/haskell_tests/Main.hs +41 -0
  8. minimum_number_game/java_tests/Main.java +20 -0
  9. minimum_number_game/meta.json +445 -0
  10. minimum_number_game/ocaml_tests/main.ml +42 -0
  11. minimum_number_game/scala_tests/MySuite.scala +32 -0
  12. minimum_number_of_chairs_in_a_waiting_room/haskell_tests/Main.hs +44 -0
  13. minimum_number_of_chairs_in_a_waiting_room/java_tests/Main.java +24 -0
  14. minimum_number_of_chairs_in_a_waiting_room/meta.json +52 -0
  15. minimum_number_of_chairs_in_a_waiting_room/ocaml_tests/main.ml +45 -0
  16. minimum_number_of_chairs_in_a_waiting_room/scala_tests/MySuite.scala +36 -0
  17. minimum_number_of_changes_to_make_binary_string_beautiful/haskell_tests/Main.hs +29 -0
  18. minimum_number_of_changes_to_make_binary_string_beautiful/java_tests/Main.java +24 -0
  19. minimum_number_of_changes_to_make_binary_string_beautiful/meta.json +31 -0
  20. minimum_number_of_changes_to_make_binary_string_beautiful/ocaml_tests/main.ml +30 -0
  21. minimum_number_of_changes_to_make_binary_string_beautiful/scala_tests/MySuite.scala +16 -0
  22. minimum_number_of_coins_for_fruits/haskell_tests/Main.hs +44 -0
  23. minimum_number_of_coins_for_fruits/java_tests/Main.java +24 -0
  24. minimum_number_of_coins_for_fruits/meta.json +2327 -0
  25. minimum_number_of_coins_for_fruits/ocaml_tests/main.ml +45 -0
  26. minimum_number_of_coins_for_fruits/scala_tests/MySuite.scala +36 -0
  27. minimum_number_of_coins_to_be_added/haskell_tests/Main.hs +0 -0
  28. minimum_number_of_coins_to_be_added/java_tests/Main.java +25 -0
  29. minimum_number_of_coins_to_be_added/meta.json +3 -0
  30. minimum_number_of_coins_to_be_added/ocaml_tests/main.ml +0 -0
  31. minimum_number_of_coins_to_be_added/scala_tests/MySuite.scala +0 -0
  32. minimum_number_of_groups_to_create_a_valid_assignment/haskell_tests/Main.hs +0 -0
  33. minimum_number_of_groups_to_create_a_valid_assignment/java_tests/Main.java +20 -0
  34. minimum_number_of_groups_to_create_a_valid_assignment/meta.json +0 -0
  35. minimum_number_of_groups_to_create_a_valid_assignment/ocaml_tests/main.ml +0 -0
  36. minimum_number_of_groups_to_create_a_valid_assignment/scala_tests/MySuite.scala +0 -0
  37. minimum_number_of_operations_to_convert_time/.DS_Store +0 -0
  38. minimum_number_of_operations_to_convert_time/haskell_tests/Main.hs +24 -0
  39. minimum_number_of_operations_to_convert_time/java_tests/Main.java +21 -0
  40. minimum_number_of_operations_to_convert_time/meta.json +97 -0
  41. minimum_number_of_operations_to_convert_time/ocaml_tests/main.ml +26 -0
  42. minimum_number_of_operations_to_convert_time/scala_tests/MySuite.scala +12 -0
  43. minimum_number_of_operations_to_make_all_array_elements_equal_to_1/.DS_Store +0 -0
  44. minimum_number_of_operations_to_make_all_array_elements_equal_to_1/haskell_tests/Main.hs +24 -0
  45. minimum_number_of_operations_to_make_all_array_elements_equal_to_1/java_tests/Main.java +21 -0
  46. minimum_number_of_operations_to_make_all_array_elements_equal_to_1/meta.json +338 -0
  47. minimum_number_of_operations_to_make_all_array_elements_equal_to_1/ocaml_tests/main.ml +26 -0
  48. minimum_number_of_operations_to_make_all_array_elements_equal_to_1/scala_tests/MySuite.scala +12 -0
  49. minimum_number_of_operations_to_make_array_empty/haskell_tests/Main.hs +0 -0
  50. minimum_number_of_operations_to_make_array_empty/java_tests/Main.java +20 -0
.gitattributes CHANGED
@@ -220,3 +220,4 @@ minimum_fuel_cost_to_report_to_the_capital/meta.json filter=lfs diff=lfs merge=l
220
  minimum_impossible_or/meta.json filter=lfs diff=lfs merge=lfs -text
221
  minimum_lines_to_represent_a_line_chart/meta.json filter=lfs diff=lfs merge=lfs -text
222
  minimum_money_required_before_transactions/meta.json filter=lfs diff=lfs merge=lfs -text
 
 
220
  minimum_impossible_or/meta.json filter=lfs diff=lfs merge=lfs -text
221
  minimum_lines_to_represent_a_line_chart/meta.json filter=lfs diff=lfs merge=lfs -text
222
  minimum_money_required_before_transactions/meta.json filter=lfs diff=lfs merge=lfs -text
223
+ minimum_number_of_coins_to_be_added/meta.json filter=lfs diff=lfs merge=lfs -text
minimum_moves_to_pick_k_ones/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, minimumMoves(new ArrayList<>(Arrays.asList(1,1,0,0,0,1,1,0,0,1)), 3, 1));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals(4, minimumMoves(new ArrayList<>(Arrays.asList(0,0,0,0)), 2, 3));
19
+ }
20
+
21
+ }
minimum_moves_to_pick_k_ones/meta.json ADDED
The diff for this file is too large to render. See raw diff
 
minimum_moves_to_pick_k_ones/ocaml_tests/main.ml ADDED
The diff for this file is too large to render. See raw diff
 
minimum_moves_to_pick_k_ones/scala_tests/MySuite.scala ADDED
The diff for this file is too large to render. See raw diff
 
minimum_moves_to_spread_stones_over_grid/java_tests/Main.java ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import static org.junit.jupiter.api.Assertions.*;
3
+ import org.junit.jupiter.api.Test;
4
+ import java.util.List;
5
+ import java.util.Arrays;
6
+ public class Main {
7
+ //Program start
8
+
9
+ //Program end
10
+
11
+ @Test
12
+ public void test1() {
13
+ assertEquals(3, minimumMoves(Arrays.asList(Arrays.asList(1,1,0),Arrays.asList(1,1,1),Arrays.asList(1,2,1))));
14
+ }
15
+ @Test
16
+ public void test2() {
17
+ assertEquals(4, minimumMoves(Arrays.asList(Arrays.asList(1,3,0),Arrays.asList(1,0,0),Arrays.asList(1,0,3))));
18
+ }
19
+
20
+ }
minimum_number_game/haskell_tests/Main.hs ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ module Main where
3
+ import Test.HUnit
4
+
5
+ --Program start
6
+ numberGame :: [Int] -> [Int]
7
+ numberGame nums = undefined
8
+
9
+ --Program end
10
+
11
+ -- Test cases
12
+
13
+ test1 :: Test
14
+ test1 = TestCase (assertEqual "for (numberGame [5,4,2,3])," [3,2,5,4] (numberGame [5,4,2,3]))
15
+
16
+ test2 :: Test
17
+ test2 = TestCase (assertEqual "for (numberGame [2,5])," [5,2] (numberGame [2,5]))
18
+
19
+ test3 :: Test
20
+ test3 = TestCase (assertEqual "for (numberGame [23, 20, 50, 50, 96, 59])," [23,20,50,50,96,59] (numberGame [23, 20, 50, 50, 96, 59]))
21
+
22
+ test4 :: Test
23
+ test4 = TestCase (assertEqual "for (numberGame [1, 1, 2, 2, 8, 5, 12, 9, 15, 13, 15, 15, 19, 18, 22, 22, 25, 24, 28, 28, 31, 29, 32, 31, 43, 40, 46, 44, 51, 48, 54, 51, 63, 58, 65, 64, 65, 65, 68, 68, 75, 72, 78, 76, 79, 79, 82, 80, 86, 84, 91, 90, 93, 91, 94, 94, 97, 95, 98, 97])," [1,1,2,2,8,5,12,9,15,13,15,15,19,18,22,22,25,24,28,28,31,29,32,31,43,40,46,44,51,48,54,51,63,58,65,64,65,65,68,68,75,72,78,76,79,79,82,80,86,84,91,90,93,91,94,94,97,95,98,97] (numberGame [1, 1, 2, 2, 8, 5, 12, 9, 15, 13, 15, 15, 19, 18, 22, 22, 25, 24, 28, 28, 31, 29, 32, 31, 43, 40, 46, 44, 51, 48, 54, 51, 63, 58, 65, 64, 65, 65, 68, 68, 75, 72, 78, 76, 79, 79, 82, 80, 86, 84, 91, 90, 93, 91, 94, 94, 97, 95, 98, 97]))
24
+
25
+ test5 :: Test
26
+ test5 = TestCase (assertEqual "for (numberGame [2, 1, 10, 5, 11, 11, 22, 13, 29, 28, 43, 29, 47, 46, 55, 51, 59, 59, 64, 62, 72, 66, 73, 72, 75, 74, 85, 81, 86, 86, 91, 91, 94, 91])," [2,1,10,5,11,11,22,13,29,28,43,29,47,46,55,51,59,59,64,62,72,66,73,72,75,74,85,81,86,86,91,91,94,91] (numberGame [2, 1, 10, 5, 11, 11, 22, 13, 29, 28, 43, 29, 47, 46, 55, 51, 59, 59, 64, 62, 72, 66, 73, 72, 75, 74, 85, 81, 86, 86, 91, 91, 94, 91]))
27
+
28
+ test6 :: Test
29
+ test6 = TestCase (assertEqual "for (numberGame [3, 1, 3, 3, 11, 10, 12, 12, 15, 14, 25, 17, 31, 27, 34, 33, 37, 36, 41, 40, 44, 42, 47, 44, 49, 48, 50, 49, 50, 50, 52, 52, 58, 57, 60, 58, 67, 65, 68, 67, 69, 69, 81, 78, 84, 83, 93, 90, 94, 94])," [3,1,3,3,11,10,12,12,15,14,25,17,31,27,34,33,37,36,41,40,44,42,47,44,49,48,50,49,50,50,52,52,58,57,60,58,67,65,68,67,69,69,81,78,84,83,93,90,94,94] (numberGame [3, 1, 3, 3, 11, 10, 12, 12, 15, 14, 25, 17, 31, 27, 34, 33, 37, 36, 41, 40, 44, 42, 47, 44, 49, 48, 50, 49, 50, 50, 52, 52, 58, 57, 60, 58, 67, 65, 68, 67, 69, 69, 81, 78, 84, 83, 93, 90, 94, 94]))
30
+
31
+ test7 :: Test
32
+ test7 = TestCase (assertEqual "for (numberGame [7, 6, 16, 15, 20, 19, 24, 21, 26, 25, 27, 26, 30, 27, 39, 33, 44, 41, 46, 46, 52, 49, 55, 52, 58, 58, 61, 59, 61, 61, 66, 66, 68, 68, 69, 69, 80, 78, 85, 83, 90, 89, 97, 90])," [7,6,16,15,20,19,24,21,26,25,27,26,30,27,39,33,44,41,46,46,52,49,55,52,58,58,61,59,61,61,66,66,68,68,69,69,80,78,85,83,90,89,97,90] (numberGame [7, 6, 16, 15, 20, 19, 24, 21, 26, 25, 27, 26, 30, 27, 39, 33, 44, 41, 46, 46, 52, 49, 55, 52, 58, 58, 61, 59, 61, 61, 66, 66, 68, 68, 69, 69, 80, 78, 85, 83, 90, 89, 97, 90]))
33
+
34
+
35
+ -- Grouping test cases
36
+ tests :: Test
37
+ tests = TestList [TestLabel "Test1" test1, TestLabel "Test2" test2, TestLabel "Test3" test3, TestLabel "Test4" test4, TestLabel "Test5" test5, TestLabel "Test6" test6]
38
+
39
+ -- Running the tests
40
+ main :: IO Counts
41
+ main = runTestTT tests
minimum_number_game/java_tests/Main.java ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import static org.junit.jupiter.api.Assertions.*;
3
+ import org.junit.jupiter.api.Test;
4
+ import java.util.List;
5
+ import java.util.Arrays;
6
+ public class Main {
7
+ //Program start
8
+
9
+ //Program end
10
+
11
+ @Test
12
+ public void test1() {
13
+ assertEquals(Arrays.asList(3,2,5,4), numberGame(Arrays.asList(5,4,2,3)));
14
+ }
15
+ @Test
16
+ public void test2() {
17
+ assertEquals(Arrays.asList(5,2), numberGame(Arrays.asList(2,5)));
18
+ }
19
+
20
+ }
minimum_number_game/meta.json ADDED
@@ -0,0 +1,445 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "id": 3226,
3
+ "name": "minimum_number_game",
4
+ "difficulty": "Easy",
5
+ "link": "https://leetcode.com/problems/minimum-number-game/",
6
+ "date": "2023-12-17 00:00:00",
7
+ "task_description": "You are given a **0-indexed** integer array `nums` of **even** length and there is also an empty array `arr`. Alice and Bob decided to play a game where in every round Alice and Bob will do one move. The rules of the game are as follows: Every round, first Alice will remove the **minimum** element from `nums`, and then Bob does the same. Now, first Bob will append the removed element in the array `arr`, and then Alice does the same. The game continues until `nums` becomes empty. Return _the resulting array _`arr`. **Example 1:** ``` **Input:** nums = [5,4,2,3] **Output:** [3,2,5,4] **Explanation:** In round one, first Alice removes 2 and then Bob removes 3. Then in arr firstly Bob appends 3 and then Alice appends 2. So arr = [3,2]. At the begining of round two, nums = [5,4]. Now, first Alice removes 4 and then Bob removes 5. Then both append in arr which becomes [3,2,5,4]. ``` **Example 2:** ``` **Input:** nums = [2,5] **Output:** [5,2] **Explanation:** In round one, first Alice removes 2 and then Bob removes 5. Then in arr firstly Bob appends and then Alice appends. So arr = [5,2]. ``` **Constraints:** `2 <= nums.length <= 100` `1 <= nums[i] <= 100` `nums.length % 2 == 0`",
8
+ "public_test_cases": [
9
+ {
10
+ "label": "Example 1",
11
+ "input": "nums = [5,4,2,3]",
12
+ "output": "[3,2,5,4] "
13
+ },
14
+ {
15
+ "label": "Example 2",
16
+ "input": "nums = [2,5]",
17
+ "output": "[5,2] "
18
+ }
19
+ ],
20
+ "private_test_cases": [
21
+ {
22
+ "input": [
23
+ 23,
24
+ 20,
25
+ 50,
26
+ 50,
27
+ 96,
28
+ 59
29
+ ],
30
+ "output": [
31
+ 23,
32
+ 20,
33
+ 50,
34
+ 50,
35
+ 96,
36
+ 59
37
+ ]
38
+ },
39
+ {
40
+ "input": [
41
+ 1,
42
+ 1,
43
+ 2,
44
+ 2,
45
+ 8,
46
+ 5,
47
+ 12,
48
+ 9,
49
+ 15,
50
+ 13,
51
+ 15,
52
+ 15,
53
+ 19,
54
+ 18,
55
+ 22,
56
+ 22,
57
+ 25,
58
+ 24,
59
+ 28,
60
+ 28,
61
+ 31,
62
+ 29,
63
+ 32,
64
+ 31,
65
+ 43,
66
+ 40,
67
+ 46,
68
+ 44,
69
+ 51,
70
+ 48,
71
+ 54,
72
+ 51,
73
+ 63,
74
+ 58,
75
+ 65,
76
+ 64,
77
+ 65,
78
+ 65,
79
+ 68,
80
+ 68,
81
+ 75,
82
+ 72,
83
+ 78,
84
+ 76,
85
+ 79,
86
+ 79,
87
+ 82,
88
+ 80,
89
+ 86,
90
+ 84,
91
+ 91,
92
+ 90,
93
+ 93,
94
+ 91,
95
+ 94,
96
+ 94,
97
+ 97,
98
+ 95,
99
+ 98,
100
+ 97
101
+ ],
102
+ "output": [
103
+ 1,
104
+ 1,
105
+ 2,
106
+ 2,
107
+ 8,
108
+ 5,
109
+ 12,
110
+ 9,
111
+ 15,
112
+ 13,
113
+ 15,
114
+ 15,
115
+ 19,
116
+ 18,
117
+ 22,
118
+ 22,
119
+ 25,
120
+ 24,
121
+ 28,
122
+ 28,
123
+ 31,
124
+ 29,
125
+ 32,
126
+ 31,
127
+ 43,
128
+ 40,
129
+ 46,
130
+ 44,
131
+ 51,
132
+ 48,
133
+ 54,
134
+ 51,
135
+ 63,
136
+ 58,
137
+ 65,
138
+ 64,
139
+ 65,
140
+ 65,
141
+ 68,
142
+ 68,
143
+ 75,
144
+ 72,
145
+ 78,
146
+ 76,
147
+ 79,
148
+ 79,
149
+ 82,
150
+ 80,
151
+ 86,
152
+ 84,
153
+ 91,
154
+ 90,
155
+ 93,
156
+ 91,
157
+ 94,
158
+ 94,
159
+ 97,
160
+ 95,
161
+ 98,
162
+ 97
163
+ ]
164
+ },
165
+ {
166
+ "input": [
167
+ 2,
168
+ 1,
169
+ 10,
170
+ 5,
171
+ 11,
172
+ 11,
173
+ 22,
174
+ 13,
175
+ 29,
176
+ 28,
177
+ 43,
178
+ 29,
179
+ 47,
180
+ 46,
181
+ 55,
182
+ 51,
183
+ 59,
184
+ 59,
185
+ 64,
186
+ 62,
187
+ 72,
188
+ 66,
189
+ 73,
190
+ 72,
191
+ 75,
192
+ 74,
193
+ 85,
194
+ 81,
195
+ 86,
196
+ 86,
197
+ 91,
198
+ 91,
199
+ 94,
200
+ 91
201
+ ],
202
+ "output": [
203
+ 2,
204
+ 1,
205
+ 10,
206
+ 5,
207
+ 11,
208
+ 11,
209
+ 22,
210
+ 13,
211
+ 29,
212
+ 28,
213
+ 43,
214
+ 29,
215
+ 47,
216
+ 46,
217
+ 55,
218
+ 51,
219
+ 59,
220
+ 59,
221
+ 64,
222
+ 62,
223
+ 72,
224
+ 66,
225
+ 73,
226
+ 72,
227
+ 75,
228
+ 74,
229
+ 85,
230
+ 81,
231
+ 86,
232
+ 86,
233
+ 91,
234
+ 91,
235
+ 94,
236
+ 91
237
+ ]
238
+ },
239
+ {
240
+ "input": [
241
+ 3,
242
+ 1,
243
+ 3,
244
+ 3,
245
+ 11,
246
+ 10,
247
+ 12,
248
+ 12,
249
+ 15,
250
+ 14,
251
+ 25,
252
+ 17,
253
+ 31,
254
+ 27,
255
+ 34,
256
+ 33,
257
+ 37,
258
+ 36,
259
+ 41,
260
+ 40,
261
+ 44,
262
+ 42,
263
+ 47,
264
+ 44,
265
+ 49,
266
+ 48,
267
+ 50,
268
+ 49,
269
+ 50,
270
+ 50,
271
+ 52,
272
+ 52,
273
+ 58,
274
+ 57,
275
+ 60,
276
+ 58,
277
+ 67,
278
+ 65,
279
+ 68,
280
+ 67,
281
+ 69,
282
+ 69,
283
+ 81,
284
+ 78,
285
+ 84,
286
+ 83,
287
+ 93,
288
+ 90,
289
+ 94,
290
+ 94
291
+ ],
292
+ "output": [
293
+ 3,
294
+ 1,
295
+ 3,
296
+ 3,
297
+ 11,
298
+ 10,
299
+ 12,
300
+ 12,
301
+ 15,
302
+ 14,
303
+ 25,
304
+ 17,
305
+ 31,
306
+ 27,
307
+ 34,
308
+ 33,
309
+ 37,
310
+ 36,
311
+ 41,
312
+ 40,
313
+ 44,
314
+ 42,
315
+ 47,
316
+ 44,
317
+ 49,
318
+ 48,
319
+ 50,
320
+ 49,
321
+ 50,
322
+ 50,
323
+ 52,
324
+ 52,
325
+ 58,
326
+ 57,
327
+ 60,
328
+ 58,
329
+ 67,
330
+ 65,
331
+ 68,
332
+ 67,
333
+ 69,
334
+ 69,
335
+ 81,
336
+ 78,
337
+ 84,
338
+ 83,
339
+ 93,
340
+ 90,
341
+ 94,
342
+ 94
343
+ ]
344
+ },
345
+ {
346
+ "input": [
347
+ 7,
348
+ 6,
349
+ 16,
350
+ 15,
351
+ 20,
352
+ 19,
353
+ 24,
354
+ 21,
355
+ 26,
356
+ 25,
357
+ 27,
358
+ 26,
359
+ 30,
360
+ 27,
361
+ 39,
362
+ 33,
363
+ 44,
364
+ 41,
365
+ 46,
366
+ 46,
367
+ 52,
368
+ 49,
369
+ 55,
370
+ 52,
371
+ 58,
372
+ 58,
373
+ 61,
374
+ 59,
375
+ 61,
376
+ 61,
377
+ 66,
378
+ 66,
379
+ 68,
380
+ 68,
381
+ 69,
382
+ 69,
383
+ 80,
384
+ 78,
385
+ 85,
386
+ 83,
387
+ 90,
388
+ 89,
389
+ 97,
390
+ 90
391
+ ],
392
+ "output": [
393
+ 7,
394
+ 6,
395
+ 16,
396
+ 15,
397
+ 20,
398
+ 19,
399
+ 24,
400
+ 21,
401
+ 26,
402
+ 25,
403
+ 27,
404
+ 26,
405
+ 30,
406
+ 27,
407
+ 39,
408
+ 33,
409
+ 44,
410
+ 41,
411
+ 46,
412
+ 46,
413
+ 52,
414
+ 49,
415
+ 55,
416
+ 52,
417
+ 58,
418
+ 58,
419
+ 61,
420
+ 59,
421
+ 61,
422
+ 61,
423
+ 66,
424
+ 66,
425
+ 68,
426
+ 68,
427
+ 69,
428
+ 69,
429
+ 80,
430
+ 78,
431
+ 85,
432
+ 83,
433
+ 90,
434
+ 89,
435
+ 97,
436
+ 90
437
+ ]
438
+ }
439
+ ],
440
+ "haskell_template": "numberGame :: [Int] -> [Int]\nnumberGame nums ",
441
+ "ocaml_template": "let numberGame (nums: int list) : int list = ",
442
+ "scala_template": "def numberGame(nums: List[Int]): List[Int] = { \n \n}",
443
+ "java_template": "class Solution {\n public int[] numberGame(int[] nums) {\n \n }\n}",
444
+ "python_template": "class Solution(object):\n def numberGame(self, nums):\n \"\"\"\n :type nums: List[int]\n :rtype: List[int]\n \"\"\"\n "
445
+ }
minimum_number_game/ocaml_tests/main.ml ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ module Main = struct
3
+ open OUnit2
4
+
5
+ (* Program start *)
6
+ let numberGame (nums: int list) : int list = failwith "Not implemented"
7
+
8
+ (* Program end *)
9
+
10
+ (* Test cases *)
11
+
12
+ let test1 _ = assert_equal [3;2;5;4] (numberGame [5;4;2;3])
13
+
14
+ let test2 _ = assert_equal [5;2] (numberGame [2;5])
15
+
16
+ let test3 _ = assert_equal [5;2] (numberGame [23; 20; 50; 50; 96; 59])
17
+
18
+ let test4 _ = assert_equal [5;2] (numberGame [1; 1; 2; 2; 8; 5; 12; 9; 15; 13; 15; 15; 19; 18; 22; 22; 25; 24; 28; 28; 31; 29; 32; 31; 43; 40; 46; 44; 51; 48; 54; 51; 63; 58; 65; 64; 65; 65; 68; 68; 75; 72; 78; 76; 79; 79; 82; 80; 86; 84; 91; 90; 93; 91; 94; 94; 97; 95; 98; 97])
19
+
20
+ let test5 _ = assert_equal [5;2] (numberGame [2; 1; 10; 5; 11; 11; 22; 13; 29; 28; 43; 29; 47; 46; 55; 51; 59; 59; 64; 62; 72; 66; 73; 72; 75; 74; 85; 81; 86; 86; 91; 91; 94; 91])
21
+
22
+ let test6 _ = assert_equal [5;2] (numberGame [3; 1; 3; 3; 11; 10; 12; 12; 15; 14; 25; 17; 31; 27; 34; 33; 37; 36; 41; 40; 44; 42; 47; 44; 49; 48; 50; 49; 50; 50; 52; 52; 58; 57; 60; 58; 67; 65; 68; 67; 69; 69; 81; 78; 84; 83; 93; 90; 94; 94])
23
+
24
+ let test7 _ = assert_equal [5;2] (numberGame [7; 6; 16; 15; 20; 19; 24; 21; 26; 25; 27; 26; 30; 27; 39; 33; 44; 41; 46; 46; 52; 49; 55; 52; 58; 58; 61; 59; 61; 61; 66; 66; 68; 68; 69; 69; 80; 78; 85; 83; 90; 89; 97; 90])
25
+
26
+
27
+ (* Grouping test cases *)
28
+ let suite = "Test Suite for numberGame" >::: [
29
+
30
+ "test1" >:: test1;
31
+ "test2" >:: test2;
32
+ "test3" >:: test3;
33
+ "test4" >:: test4;
34
+ "test5" >:: test5;
35
+ "test6" >:: test6;
36
+ "test7" >:: test7;
37
+ ]
38
+
39
+
40
+ (* Running the tests *)
41
+ let () = run_test_tt_main suite
42
+ end
minimum_number_game/scala_tests/MySuite.scala ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ class MySuite extends munit.FunSuite {
3
+
4
+ test("test1") {
5
+ assertEquals(Main.numberGame(List(5,4,2,3)), List(3,2,5,4))
6
+ }
7
+
8
+ test("test2") {
9
+ assertEquals(Main.numberGame(List(2,5)), List(5,2))
10
+ }
11
+
12
+ test("test3") {
13
+ assertEquals(Main.numberGame(23,20,50,50,96,59), List(23,20,50,50,96,59))
14
+ }
15
+
16
+ test("test4") {
17
+ assertEquals(Main.numberGame(1,1,2,2,8,5,12,9,15,13,15,15,19,18,22,22,25,24,28,28,31,29,32,31,43,40,46,44,51,48,54,51,63,58,65,64,65,65,68,68,75,72,78,76,79,79,82,80,86,84,91,90,93,91,94,94,97,95,98,97), List(1,1,2,2,8,5,12,9,15,13,15,15,19,18,22,22,25,24,28,28,31,29,32,31,43,40,46,44,51,48,54,51,63,58,65,64,65,65,68,68,75,72,78,76,79,79,82,80,86,84,91,90,93,91,94,94,97,95,98,97))
18
+ }
19
+
20
+ test("test5") {
21
+ assertEquals(Main.numberGame(2,1,10,5,11,11,22,13,29,28,43,29,47,46,55,51,59,59,64,62,72,66,73,72,75,74,85,81,86,86,91,91,94,91), List(2,1,10,5,11,11,22,13,29,28,43,29,47,46,55,51,59,59,64,62,72,66,73,72,75,74,85,81,86,86,91,91,94,91))
22
+ }
23
+
24
+ test("test6") {
25
+ assertEquals(Main.numberGame(3,1,3,3,11,10,12,12,15,14,25,17,31,27,34,33,37,36,41,40,44,42,47,44,49,48,50,49,50,50,52,52,58,57,60,58,67,65,68,67,69,69,81,78,84,83,93,90,94,94), List(3,1,3,3,11,10,12,12,15,14,25,17,31,27,34,33,37,36,41,40,44,42,47,44,49,48,50,49,50,50,52,52,58,57,60,58,67,65,68,67,69,69,81,78,84,83,93,90,94,94))
26
+ }
27
+
28
+ test("test7") {
29
+ assertEquals(Main.numberGame(7,6,16,15,20,19,24,21,26,25,27,26,30,27,39,33,44,41,46,46,52,49,55,52,58,58,61,59,61,61,66,66,68,68,69,69,80,78,85,83,90,89,97,90), List(7,6,16,15,20,19,24,21,26,25,27,26,30,27,39,33,44,41,46,46,52,49,55,52,58,58,61,59,61,61,66,66,68,68,69,69,80,78,85,83,90,89,97,90))
30
+ }
31
+
32
+ }
minimum_number_of_chairs_in_a_waiting_room/haskell_tests/Main.hs ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ module Main where
3
+ import Test.HUnit
4
+
5
+ --Program start
6
+ minimumChairs :: String -> Int
7
+ minimumChairs s = undefined
8
+
9
+ --Program end
10
+
11
+ -- Test cases
12
+
13
+ test1 :: Test
14
+ test1 = TestCase (assertEqual "for (minimumChairs \"EEEEEEE \")," 7 (minimumChairs "EEEEEEE"))
15
+
16
+ test2 :: Test
17
+ test2 = TestCase (assertEqual "for (minimumChairs \"ELELEEL \")," 2 (minimumChairs "ELELEEL"))
18
+
19
+ test3 :: Test
20
+ test3 = TestCase (assertEqual "for (minimumChairs \"ELEELEELLL \")," 3 (minimumChairs "ELEELEELLL"))
21
+
22
+ test4 :: Test
23
+ test4 = TestCase (assertEqual "for (minimumChairs \"LLLELEEELLELELELELEEE \")," 1 (minimumChairs "LLLELEEELLELELELELEEE"))
24
+
25
+ test5 :: Test
26
+ test5 = TestCase (assertEqual "for (minimumChairs \"LEEEEELLEELLEELLLLLLEEEELLLLLELLEEELLEELE \")," 4 (minimumChairs "LEEEEELLEELLEELLLLLLEEEELLLLLELLEEELLEELE"))
27
+
28
+ test6 :: Test
29
+ test6 = TestCase (assertEqual "for (minimumChairs \"LELLLELLELEELELELEELLLLLELEELELEEEELL \")," 0 (minimumChairs "LELLLELLELEELELELEELLLLLELEELELEEEELL"))
30
+
31
+ test7 :: Test
32
+ test7 = TestCase (assertEqual "for (minimumChairs \"ELELLLEEEELLELELEEELELEEEELELLLEELLELEELEELLLL \")," 6 (minimumChairs "ELELLLEEEELLELELEEELELEEEELELLLEELLELEELEELLLL"))
33
+
34
+ test8 :: Test
35
+ test8 = TestCase (assertEqual "for (minimumChairs \"LLLEELELEELEELELLELLEEELLEELLELELLLEELEELLEEELLL \")," 1 (minimumChairs "LLLEELELEELEELELLELLEEELLEELLELELLLEELEELLEEELLL"))
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
minimum_number_of_chairs_in_a_waiting_room/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(7, minimumChairs("EEEEEEE"));
14
+ }
15
+ @Test
16
+ public void test2() {
17
+ assertEquals(2, minimumChairs("ELELEEL"));
18
+ }
19
+ @Test
20
+ public void test3() {
21
+ assertEquals(3, minimumChairs("ELEELEELLL"));
22
+ }
23
+
24
+ }
minimum_number_of_chairs_in_a_waiting_room/meta.json ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "id": 3426,
3
+ "name": "minimum_number_of_chairs_in_a_waiting_room",
4
+ "difficulty": "Easy",
5
+ "link": "https://leetcode.com/problems/minimum-number-of-chairs-in-a-waiting-room/",
6
+ "date": "2024-05-26 00:00:00",
7
+ "task_description": "You are given a string `s`. Simulate events at each second `i`: If `s[i] == 'E'`, a person enters the waiting room and takes one of the chairs in it. If `s[i] == 'L'`, a person leaves the waiting room, freeing up a chair. Return the **minimum **number of chairs needed so that a chair is available for every person who enters the waiting room given that it is initially **empty**. **Example 1:** **Input:** s = \"EEEEEEE\" **Output:** 7 **Explanation:** After each second, a person enters the waiting room and no person leaves it. Therefore, a minimum of 7 chairs is needed. **Example 2:** **Input:** s = \"ELELEEL\" **Output:** 2 **Explanation:** Let's consider that there are 2 chairs in the waiting room. The table below shows the state of the waiting room at each second. Second Event People in the Waiting Room Available Chairs 0 Enter 1 1 1 Leave 0 2 2 Enter 1 1 3 Leave 0 2 4 Enter 1 1 5 Enter 2 0 6 Leave 1 1 **Example 3:** **Input:** s = \"ELEELEELLL\" **Output:** 3 **Explanation:** Let's consider that there are 3 chairs in the waiting room. The table below shows the state of the waiting room at each second. Second Event People in the Waiting Room Available Chairs 0 Enter 1 2 1 Leave 0 3 2 Enter 1 2 3 Enter 2 1 4 Leave 1 2 5 Enter 2 1 6 Enter 3 0 7 Leave 2 1 8 Leave 1 2 9 Leave 0 3 **Constraints:** `1 <= s.length <= 50` `s` consists only of the letters `'E'` and `'L'`. `s` represents a valid sequence of entries and exits.",
8
+ "public_test_cases": [
9
+ {
10
+ "label": "Example 1",
11
+ "input": "s = \"EEEEEEE\"",
12
+ "output": "7 "
13
+ },
14
+ {
15
+ "label": "Example 2",
16
+ "input": "s = \"ELELEEL\"",
17
+ "output": "2 "
18
+ },
19
+ {
20
+ "label": "Example 3",
21
+ "input": "s = \"ELEELEELLL\"",
22
+ "output": "3 "
23
+ }
24
+ ],
25
+ "private_test_cases": [
26
+ {
27
+ "input": "LLLELEEELLELELELELEEE",
28
+ "output": 1
29
+ },
30
+ {
31
+ "input": "LEEEEELLEELLEELLLLLLEEEELLLLLELLEEELLEELE",
32
+ "output": 4
33
+ },
34
+ {
35
+ "input": "LELLLELLELEELELELEELLLLLELEELELEEEELL",
36
+ "output": 0
37
+ },
38
+ {
39
+ "input": "ELELLLEEEELLELELEEELELEEEELELLLEELLELEELEELLLL",
40
+ "output": 6
41
+ },
42
+ {
43
+ "input": "LLLEELELEELEELELLELLEEELLEELLELELLLEELEELLEEELLL",
44
+ "output": 1
45
+ }
46
+ ],
47
+ "haskell_template": "minimumChairs :: String -> Int\nminimumChairs s ",
48
+ "ocaml_template": "let minimumChairs (s: string) : int = ",
49
+ "scala_template": "def minimumChairs(s: String): Int = { \n \n}",
50
+ "java_template": "class Solution {\n public int minimumChairs(String s) {\n \n }\n}",
51
+ "python_template": "class Solution(object):\n def minimumChairs(self, s):\n \"\"\"\n :type s: str\n :rtype: int\n \"\"\"\n "
52
+ }
minimum_number_of_chairs_in_a_waiting_room/ocaml_tests/main.ml ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ module Main = struct
3
+ open OUnit2
4
+
5
+ (* Program start *)
6
+ let minimumChairs (s: string) : int = failwith "Not implemented"
7
+
8
+ (* Program end *)
9
+
10
+ (* Test cases *)
11
+
12
+ let test1 _ = assert_equal 7 (minimumChairs "EEEEEEE")
13
+
14
+ let test2 _ = assert_equal 2 (minimumChairs "ELELEEL")
15
+
16
+ let test3 _ = assert_equal 3 (minimumChairs "ELEELEELLL")
17
+
18
+ let test4 _ = assert_equal 3 (minimumChairs "LLLELEEELLELELELELEEE")
19
+
20
+ let test5 _ = assert_equal 3 (minimumChairs "LEEEEELLEELLEELLLLLLEEEELLLLLELLEEELLEELE")
21
+
22
+ let test6 _ = assert_equal 3 (minimumChairs "LELLLELLELEELELELEELLLLLELEELELEEEELL")
23
+
24
+ let test7 _ = assert_equal 3 (minimumChairs "ELELLLEEEELLELELEEELELEEEELELLLEELLELEELEELLLL")
25
+
26
+ let test8 _ = assert_equal 3 (minimumChairs "LLLEELELEELEELELLELLEEELLEELLELELLLEELEELLEEELLL")
27
+
28
+
29
+ (* Grouping test cases *)
30
+ let suite = "Test Suite for minimumChairs" >::: [
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
minimum_number_of_chairs_in_a_waiting_room/scala_tests/MySuite.scala ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ class MySuite extends munit.FunSuite {
3
+
4
+ test("test1") {
5
+ assertEquals(Main.minimumChairs("EEEEEEE"), 7)
6
+ }
7
+
8
+ test("test2") {
9
+ assertEquals(Main.minimumChairs("ELELEEL"), 2)
10
+ }
11
+
12
+ test("test3") {
13
+ assertEquals(Main.minimumChairs("ELEELEELLL"), 3)
14
+ }
15
+
16
+ test("test4") {
17
+ assertEquals(Main.minimumChairs(",L,L,L,E,L,E,E,E,L,L,E,L,E,L,E,L,E,L,E,E,E,"), 1)
18
+ }
19
+
20
+ test("test5") {
21
+ assertEquals(Main.minimumChairs(",L,E,E,E,E,E,L,L,E,E,L,L,E,E,L,L,L,L,L,L,E,E,E,E,L,L,L,L,L,E,L,L,E,E,E,L,L,E,E,L,E,"), 4)
22
+ }
23
+
24
+ test("test6") {
25
+ assertEquals(Main.minimumChairs(",L,E,L,L,L,E,L,L,E,L,E,E,L,E,L,E,L,E,E,L,L,L,L,L,E,L,E,E,L,E,L,E,E,E,E,L,L,"), 0)
26
+ }
27
+
28
+ test("test7") {
29
+ assertEquals(Main.minimumChairs(",E,L,E,L,L,L,E,E,E,E,L,L,E,L,E,L,E,E,E,L,E,L,E,E,E,E,L,E,L,L,L,E,E,L,L,E,L,E,E,L,E,E,L,L,L,L,"), 6)
30
+ }
31
+
32
+ test("test8") {
33
+ assertEquals(Main.minimumChairs(",L,L,L,E,E,L,E,L,E,E,L,E,E,L,E,L,L,E,L,L,E,E,E,L,L,E,E,L,L,E,L,E,L,L,L,E,E,L,E,E,L,L,E,E,E,L,L,L,"), 1)
34
+ }
35
+
36
+ }
minimum_number_of_changes_to_make_binary_string_beautiful/haskell_tests/Main.hs ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ module Main where
3
+ import Test.HUnit
4
+
5
+ --Program start
6
+ minChanges :: String -> Int
7
+ minChanges s = undefined
8
+
9
+ --Program end
10
+
11
+ -- Test cases
12
+
13
+ test1 :: Test
14
+ test1 = TestCase (assertEqual "for (minChanges \"1001 \")," 2 (minChanges "1001"))
15
+
16
+ test2 :: Test
17
+ test2 = TestCase (assertEqual "for (minChanges \"10 \")," 1 (minChanges "10"))
18
+
19
+ test3 :: Test
20
+ test3 = TestCase (assertEqual "for (minChanges \"0000 \")," 0 (minChanges "0000"))
21
+
22
+
23
+ -- Grouping test cases
24
+ tests :: Test
25
+ tests = TestList [TestLabel "Test1" test1, TestLabel "Test2" test2]
26
+
27
+ -- Running the tests
28
+ main :: IO Counts
29
+ main = runTestTT tests
minimum_number_of_changes_to_make_binary_string_beautiful/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(2, minChanges("1001"));
14
+ }
15
+ @Test
16
+ public void test2() {
17
+ assertEquals(1, minChanges("10"));
18
+ }
19
+ @Test
20
+ public void test3() {
21
+ assertEquals(0, minChanges("0000"));
22
+ }
23
+
24
+ }
minimum_number_of_changes_to_make_binary_string_beautiful/meta.json ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "id": 3174,
3
+ "name": "minimum_number_of_changes_to_make_binary_string_beautiful",
4
+ "difficulty": "Medium",
5
+ "link": "https://leetcode.com/problems/minimum-number-of-changes-to-make-binary-string-beautiful/",
6
+ "date": "2023-10-14 00:00:00",
7
+ "task_description": "You are given a **0-indexed** binary string `s` having an even length. A string is **beautiful** if it's possible to partition it into one or more substrings such that: Each substring has an **even length**. Each substring contains **only** `1`'s or **only** `0`'s. You can change any character in `s` to `0` or `1`. Return _the **minimum** number of changes required to make the string _`s` _beautiful_. **Example 1:** ``` **Input:** s = \"1001\" **Output:** 2 **Explanation:** We change s[1] to 1 and s[3] to 0 to get string \"1100\". It can be seen that the string \"1100\" is beautiful because we can partition it into \"11|00\". It can be proven that 2 is the minimum number of changes needed to make the string beautiful. ``` **Example 2:** ``` **Input:** s = \"10\" **Output:** 1 **Explanation:** We change s[1] to 1 to get string \"11\". It can be seen that the string \"11\" is beautiful because we can partition it into \"11\". It can be proven that 1 is the minimum number of changes needed to make the string beautiful. ``` **Example 3:** ``` **Input:** s = \"0000\" **Output:** 0 **Explanation:** We don't need to make any changes as the string \"0000\" is beautiful already. ``` **Constraints:** `2 <= s.length <= 105` `s` has an even length. `s[i]` is either `'0'` or `'1'`.",
8
+ "public_test_cases": [
9
+ {
10
+ "label": "Example 1",
11
+ "input": "s = \"1001\"",
12
+ "output": "2 "
13
+ },
14
+ {
15
+ "label": "Example 2",
16
+ "input": "s = \"10\"",
17
+ "output": "1 "
18
+ },
19
+ {
20
+ "label": "Example 3",
21
+ "input": "s = \"0000\"",
22
+ "output": "0 "
23
+ }
24
+ ],
25
+ "private_test_cases": [],
26
+ "haskell_template": "minChanges :: String -> Int\nminChanges s ",
27
+ "ocaml_template": "let minChanges (s: string) : int = ",
28
+ "scala_template": "def minChanges(s: String): Int = { \n \n}",
29
+ "java_template": "class Solution {\n public int minChanges(String s) {\n \n }\n}",
30
+ "python_template": "class Solution(object):\n def minChanges(self, s):\n \"\"\"\n :type s: str\n :rtype: int\n \"\"\"\n "
31
+ }
minimum_number_of_changes_to_make_binary_string_beautiful/ocaml_tests/main.ml ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ module Main = struct
3
+ open OUnit2
4
+
5
+ (* Program start *)
6
+ let minChanges (s: string) : int = failwith "Not implemented"
7
+
8
+ (* Program end *)
9
+
10
+ (* Test cases *)
11
+
12
+ let test1 _ = assert_equal 2 (minChanges "1001")
13
+
14
+ let test2 _ = assert_equal 1 (minChanges "10")
15
+
16
+ let test3 _ = assert_equal 0 (minChanges "0000")
17
+
18
+
19
+ (* Grouping test cases *)
20
+ let suite = "Test Suite for minChanges" >::: [
21
+
22
+ "test1" >:: test1;
23
+ "test2" >:: test2;
24
+ "test3" >:: test3;
25
+ ]
26
+
27
+
28
+ (* Running the tests *)
29
+ let () = run_test_tt_main suite
30
+ end
minimum_number_of_changes_to_make_binary_string_beautiful/scala_tests/MySuite.scala ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ class MySuite extends munit.FunSuite {
3
+
4
+ test("test1") {
5
+ assertEquals(Main.minChanges("1001"), 2)
6
+ }
7
+
8
+ test("test2") {
9
+ assertEquals(Main.minChanges("10"), 1)
10
+ }
11
+
12
+ test("test3") {
13
+ assertEquals(Main.minChanges("0000"), 0)
14
+ }
15
+
16
+ }
minimum_number_of_coins_for_fruits/haskell_tests/Main.hs ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ module Main where
3
+ import Test.HUnit
4
+
5
+ --Program start
6
+ minimumCoins :: [Int] -> Int
7
+ minimumCoins prices = undefined
8
+
9
+ --Program end
10
+
11
+ -- Test cases
12
+
13
+ test1 :: Test
14
+ test1 = TestCase (assertEqual "for (minimumCoins [3,1,2])," 4 (minimumCoins [3,1,2]))
15
+
16
+ test2 :: Test
17
+ test2 = TestCase (assertEqual "for (minimumCoins [1,10,1,1])," 2 (minimumCoins [1,10,1,1]))
18
+
19
+ test3 :: Test
20
+ test3 = TestCase (assertEqual "for (minimumCoins [26,18,6,12,49,7,45,45])," 39 (minimumCoins [26,18,6,12,49,7,45,45]))
21
+
22
+ test4 :: Test
23
+ test4 = TestCase (assertEqual "for (minimumCoins [25274, 21829, 95346, 28245, 24245, 37803, 38360, 16039, 31802, 23193, 33504, 97219, 16925, 70574, 13560, 7625, 82860, 76280, 96716, 73895, 22692, 51136, 87146, 65163, 51629, 44000, 20919, 25697, 77628, 21836, 24398, 54626, 26704, 28996, 75626, 49812, 14484, 90212, 29445, 28574, 66907, 74570, 89418, 32886, 32293, 6088, 55831, 21697, 38819, 74671, 47965, 11396, 66086, 16298, 21840, 85271, 75761, 9501, 95228, 19405, 23632, 24389, 24377, 62787, 96480, 57008, 84889, 54563, 46663, 15678, 50535, 72823, 2389, 77445, 32480, 90368, 15052, 43885, 35417, 24399, 26527, 56252, 53344, 97174, 14198, 55647, 31911, 55084, 97817, 176, 59785, 12706, 98256, 70328, 87691, 68884, 52055, 61581, 28214, 80709, 96084, 34913, 19845, 43427, 56047, 91419, 37292, 28720, 18420, 64021, 28012, 57830, 5738, 75211, 45206, 4045, 23675, 12586, 22254, 4665, 27040, 79391, 22283, 46279, 41200, 76915, 1176, 22144, 14147, 24175, 89960, 44127, 44437, 84993, 31304, 87132, 61776, 89137, 50126, 36772, 77920, 65015, 70168, 44093, 43002, 84834, 4751, 69070, 22323, 97538, 21920, 76721, 41462, 86518, 68262, 75616, 4607, 55684, 61921, 93969, 18161, 31598, 3124, 30911, 37361, 68210, 7329, 76304, 3770, 54397, 74791, 92941, 55638, 29337, 59087, 27593, 17671, 66290, 7105, 42309, 91197, 52966, 89293, 51785, 17079, 3369, 72463, 43418, 99070, 5560, 66924, 10423, 8102, 92488, 27378, 18189, 91738, 33005, 32280, 49365, 87150, 49628, 38591, 31944, 40121, 87860, 40269, 56710, 3281, 32381, 92163, 89701, 32387, 3807, 77778, 18988, 48548, 39641, 95800, 5179, 29904, 28267, 63162, 83210, 84095, 52268, 88162, 90863, 93578, 7550, 72386, 47560, 16251, 26075, 5196, 59010, 98520, 25039, 93383, 29945, 10287, 65817, 66536, 76113, 79093, 17575, 61324, 51883, 20694, 60603, 28450, 63310, 73433, 86161, 6785, 57728, 52602, 64516, 85688, 53199, 77800, 17631, 78309, 30500, 51212, 22004, 58234, 7996, 28086, 80252, 15692, 99887, 88585, 94936, 77129, 73452, 76823, 89339, 79384, 79277, 26511, 38364, 74974, 75977, 48064, 7543, 45588, 98664, 73282, 20401, 75286, 87778, 86337, 67886, 8907, 20380, 17677, 69449, 79567, 62464, 41909, 55384, 11362, 14807, 7294, 87880, 96017, 99971, 88796, 10323, 67695, 77267, 51342, 2682, 205, 64755, 27214, 65733, 85496, 23706, 88159, 28288, 98958, 76058, 78709, 71098, 54940, 97467, 45648, 21663, 20507, 75111, 78383, 55692, 39811, 20207, 98747, 6294, 59015, 11362, 26670, 49111, 72097, 87180, 34887, 97415, 86399, 93755, 12391, 78121, 49288, 89879, 75280, 77655, 38577, 54617, 31076, 75623, 62253, 29826, 4761, 30602, 22208, 72349, 8736, 34530, 47544, 81048, 39409, 3121, 75148, 71824, 85852, 26634, 22537, 14791, 13582, 32043, 3, 14194, 1509, 67020, 27193, 76831, 48821, 5791, 39372, 87427, 3266, 31240, 85126, 44559, 74066, 54239, 34138, 93964, 63328, 73840, 75331, 12796, 83605, 38516, 87981, 25519, 69524, 24068, 58527, 14034, 97772, 75690, 97292, 12094, 18063, 57660, 59622, 15009, 9947, 47798, 14709, 56415, 8481, 78315, 58717, 29398, 38564, 45851, 12726, 1148, 61644, 62166, 69410, 1682, 28420, 40121, 77581, 98494, 82847, 14444, 84529, 16546, 3163, 55333, 12656, 1980, 52693, 8546, 30411, 77251, 48376, 77286, 77690, 75453, 95132, 79815, 313, 11257, 68173, 69882, 82518, 4405, 90998, 85976, 55016, 70891, 87410, 87579, 332, 9433, 49780, 77044, 63658, 75626, 97957, 34844, 25115, 12789, 57294, 23840, 69431, 36106, 22662, 10300, 61423, 44506, 93224, 53515, 90565, 27916, 90476, 63726, 33299, 43574])," 125524 (minimumCoins [25274, 21829, 95346, 28245, 24245, 37803, 38360, 16039, 31802, 23193, 33504, 97219, 16925, 70574, 13560, 7625, 82860, 76280, 96716, 73895, 22692, 51136, 87146, 65163, 51629, 44000, 20919, 25697, 77628, 21836, 24398, 54626, 26704, 28996, 75626, 49812, 14484, 90212, 29445, 28574, 66907, 74570, 89418, 32886, 32293, 6088, 55831, 21697, 38819, 74671, 47965, 11396, 66086, 16298, 21840, 85271, 75761, 9501, 95228, 19405, 23632, 24389, 24377, 62787, 96480, 57008, 84889, 54563, 46663, 15678, 50535, 72823, 2389, 77445, 32480, 90368, 15052, 43885, 35417, 24399, 26527, 56252, 53344, 97174, 14198, 55647, 31911, 55084, 97817, 176, 59785, 12706, 98256, 70328, 87691, 68884, 52055, 61581, 28214, 80709, 96084, 34913, 19845, 43427, 56047, 91419, 37292, 28720, 18420, 64021, 28012, 57830, 5738, 75211, 45206, 4045, 23675, 12586, 22254, 4665, 27040, 79391, 22283, 46279, 41200, 76915, 1176, 22144, 14147, 24175, 89960, 44127, 44437, 84993, 31304, 87132, 61776, 89137, 50126, 36772, 77920, 65015, 70168, 44093, 43002, 84834, 4751, 69070, 22323, 97538, 21920, 76721, 41462, 86518, 68262, 75616, 4607, 55684, 61921, 93969, 18161, 31598, 3124, 30911, 37361, 68210, 7329, 76304, 3770, 54397, 74791, 92941, 55638, 29337, 59087, 27593, 17671, 66290, 7105, 42309, 91197, 52966, 89293, 51785, 17079, 3369, 72463, 43418, 99070, 5560, 66924, 10423, 8102, 92488, 27378, 18189, 91738, 33005, 32280, 49365, 87150, 49628, 38591, 31944, 40121, 87860, 40269, 56710, 3281, 32381, 92163, 89701, 32387, 3807, 77778, 18988, 48548, 39641, 95800, 5179, 29904, 28267, 63162, 83210, 84095, 52268, 88162, 90863, 93578, 7550, 72386, 47560, 16251, 26075, 5196, 59010, 98520, 25039, 93383, 29945, 10287, 65817, 66536, 76113, 79093, 17575, 61324, 51883, 20694, 60603, 28450, 63310, 73433, 86161, 6785, 57728, 52602, 64516, 85688, 53199, 77800, 17631, 78309, 30500, 51212, 22004, 58234, 7996, 28086, 80252, 15692, 99887, 88585, 94936, 77129, 73452, 76823, 89339, 79384, 79277, 26511, 38364, 74974, 75977, 48064, 7543, 45588, 98664, 73282, 20401, 75286, 87778, 86337, 67886, 8907, 20380, 17677, 69449, 79567, 62464, 41909, 55384, 11362, 14807, 7294, 87880, 96017, 99971, 88796, 10323, 67695, 77267, 51342, 2682, 205, 64755, 27214, 65733, 85496, 23706, 88159, 28288, 98958, 76058, 78709, 71098, 54940, 97467, 45648, 21663, 20507, 75111, 78383, 55692, 39811, 20207, 98747, 6294, 59015, 11362, 26670, 49111, 72097, 87180, 34887, 97415, 86399, 93755, 12391, 78121, 49288, 89879, 75280, 77655, 38577, 54617, 31076, 75623, 62253, 29826, 4761, 30602, 22208, 72349, 8736, 34530, 47544, 81048, 39409, 3121, 75148, 71824, 85852, 26634, 22537, 14791, 13582, 32043, 3, 14194, 1509, 67020, 27193, 76831, 48821, 5791, 39372, 87427, 3266, 31240, 85126, 44559, 74066, 54239, 34138, 93964, 63328, 73840, 75331, 12796, 83605, 38516, 87981, 25519, 69524, 24068, 58527, 14034, 97772, 75690, 97292, 12094, 18063, 57660, 59622, 15009, 9947, 47798, 14709, 56415, 8481, 78315, 58717, 29398, 38564, 45851, 12726, 1148, 61644, 62166, 69410, 1682, 28420, 40121, 77581, 98494, 82847, 14444, 84529, 16546, 3163, 55333, 12656, 1980, 52693, 8546, 30411, 77251, 48376, 77286, 77690, 75453, 95132, 79815, 313, 11257, 68173, 69882, 82518, 4405, 90998, 85976, 55016, 70891, 87410, 87579, 332, 9433, 49780, 77044, 63658, 75626, 97957, 34844, 25115, 12789, 57294, 23840, 69431, 36106, 22662, 10300, 61423, 44506, 93224, 53515, 90565, 27916, 90476, 63726, 33299, 43574]))
24
+
25
+ test5 :: Test
26
+ test5 = TestCase (assertEqual "for (minimumCoins [87456, 62878, 2902, 19684, 18472, 71532, 47090, 95104, 93715, 7242, 12971, 42860, 52919, 24131, 30584, 70208, 97914, 47047, 90047, 47793, 53991, 59800, 41309, 66673, 58872, 5251, 11960, 56641, 62105, 78866, 64470, 61227, 17719, 77876, 68947, 20734, 66117, 45917, 68884, 65689, 38691, 29680, 96821, 27581, 62125, 59353, 64541, 49569, 9569, 76300, 60736, 65234, 81941, 98028, 64952, 65082, 91370, 92902, 88308, 74634, 22593, 1424, 83187, 95049, 54761, 31556, 85312, 30480, 47625, 37928, 12594, 50370, 91529, 93968, 75410, 25030, 87006, 10469, 72915, 9229, 23726, 9072, 84395, 10898, 81428, 41910, 69049, 90322, 41725, 23712, 56668, 95116, 85601, 19800, 37019, 45850, 88633, 99940, 11015, 93824, 17633, 41577, 74372, 79513, 32894, 52410, 53586, 88069, 72276, 20595, 57818, 20651, 23237, 13247, 22506, 96935, 38734, 19604, 67796, 20404, 59826, 10987, 67747, 54172, 41049, 55585, 99181, 3307, 36320, 23217, 38570, 24422, 89438, 74373, 48552, 77461, 27869, 85999, 23599, 63626, 43067, 80563, 10227, 735, 56578, 43862, 6553, 18750, 30742, 31466, 29422, 31765, 7203, 29625, 57602, 97387, 61988, 58919, 84463, 80096, 97805, 6694, 3299, 93698, 68681, 97520, 14321, 24095, 2209, 87482, 28490, 14591, 70301, 91029, 90807, 74788, 68482, 37611, 15297, 62563, 59487, 47095, 67264, 63078, 40520, 33555, 18124, 1678, 88234, 13958, 27021, 13544, 57608, 81353, 81785, 64860, 7708, 9143, 9366, 76781, 51827, 87629, 40455, 84072, 7224, 49524, 18016, 68911, 71537, 7207, 23979, 28366, 80429, 17705, 17657, 20278, 55111, 91874, 99647, 82400, 66899, 40858, 87910, 54519, 33181, 15907, 26509, 1702, 5190, 14305, 96057, 89065, 65316, 37989, 53407, 79703, 37494, 46065, 65536, 96393, 36447, 45812, 88829, 49190, 49430, 54540, 96090, 55284, 63598, 63059, 69078, 27801, 66994, 29261, 60866, 70611, 6747, 38134, 86922, 40672, 19322, 51545, 35953, 86611, 5907, 60819, 44182, 7388, 76210, 73752, 18672, 13205, 36423, 10400, 62260, 62690, 98658, 77575, 50891, 55349, 16424, 1618, 51165, 38135, 35194, 38412, 22192, 96906, 50318, 19300, 41411, 71158, 638, 57903, 60659, 329, 41891, 97441, 18699, 93087, 56300, 59594, 74651, 4680, 21505, 37996, 96514, 84878, 21974, 47520, 301, 28408, 70978, 48326, 22243, 7952, 88939, 36656, 70636, 57347, 32199, 89057, 67554, 53754, 57646, 37996, 66181, 53654, 85595, 88692, 64331, 91864, 10914, 82070, 60825, 1927, 92361, 66082, 77494, 94377, 96529, 88807, 51196, 55666, 90825, 77312, 2279, 32783, 68228, 19170, 36062, 38519, 53159, 17745, 33858, 10841, 27185, 76894, 36642, 73917, 10228, 7893, 37231, 13274, 61549, 43292, 59764, 79262, 6777, 64665, 91246, 43223, 43330, 37727, 38088, 68627, 78509, 24068, 53926, 57526, 45247, 86166, 13774, 11886, 82584, 78138, 2070, 20345, 19377, 74370, 94565, 8802, 9934, 40092, 19034, 43863, 63531, 74324, 90720, 84616, 13947, 18953, 10971, 40124, 47764, 21512, 51855, 93163, 93537, 48420, 58795, 70793, 15406, 64185, 10269, 97514, 94056, 6294, 81886, 62820, 69194, 4396, 82523, 19813, 83426, 94755, 77451, 33750, 7196, 52125, 49081, 4892, 53507, 82658, 19517, 30730, 60257, 82177, 31750, 9876, 40391, 70406, 32192, 61600, 5132, 46579, 89452, 40648, 96364, 53534, 71857, 39507, 905, 8471, 13111, 12125, 14147, 75894, 42053, 62717, 36940, 50594, 50901, 45227, 26669, 2633, 41612, 65779, 17592, 37429, 24384, 18717, 14292, 30803, 40041, 95208, 91884, 12527, 72464, 80393, 988, 18941, 34197, 14541, 1709, 42299, 46355, 41995, 83214, 23682, 50805, 86339, 36149, 75794, 37412, 19184, 21949, 700, 66087, 49442, 96729, 94830, 65052, 68093, 43150, 19919, 9353, 12387, 44944, 75125, 82166, 85707, 91538, 39421, 79330, 48831, 39495, 44036, 21466, 41455, 52815, 43212, 72804, 58376, 68281, 31411, 20636, 57684, 53185, 15382, 73383, 64746, 44022, 47497, 76274, 96038, 54176, 72869, 58876, 38387, 11204, 40250, 47433, 83584, 22167, 25364, 90094, 19675, 84728, 30636, 89583, 6244, 70605, 81838, 73503, 46830, 70779, 80694, 40773, 41043, 7034, 84806, 66315, 45586, 60034, 10368, 36218, 83697, 88771, 34382, 78079, 14202, 13149, 15319, 27466, 40632, 61016, 69860, 72756, 42894, 95686, 8765, 31222])," 166749 (minimumCoins [87456, 62878, 2902, 19684, 18472, 71532, 47090, 95104, 93715, 7242, 12971, 42860, 52919, 24131, 30584, 70208, 97914, 47047, 90047, 47793, 53991, 59800, 41309, 66673, 58872, 5251, 11960, 56641, 62105, 78866, 64470, 61227, 17719, 77876, 68947, 20734, 66117, 45917, 68884, 65689, 38691, 29680, 96821, 27581, 62125, 59353, 64541, 49569, 9569, 76300, 60736, 65234, 81941, 98028, 64952, 65082, 91370, 92902, 88308, 74634, 22593, 1424, 83187, 95049, 54761, 31556, 85312, 30480, 47625, 37928, 12594, 50370, 91529, 93968, 75410, 25030, 87006, 10469, 72915, 9229, 23726, 9072, 84395, 10898, 81428, 41910, 69049, 90322, 41725, 23712, 56668, 95116, 85601, 19800, 37019, 45850, 88633, 99940, 11015, 93824, 17633, 41577, 74372, 79513, 32894, 52410, 53586, 88069, 72276, 20595, 57818, 20651, 23237, 13247, 22506, 96935, 38734, 19604, 67796, 20404, 59826, 10987, 67747, 54172, 41049, 55585, 99181, 3307, 36320, 23217, 38570, 24422, 89438, 74373, 48552, 77461, 27869, 85999, 23599, 63626, 43067, 80563, 10227, 735, 56578, 43862, 6553, 18750, 30742, 31466, 29422, 31765, 7203, 29625, 57602, 97387, 61988, 58919, 84463, 80096, 97805, 6694, 3299, 93698, 68681, 97520, 14321, 24095, 2209, 87482, 28490, 14591, 70301, 91029, 90807, 74788, 68482, 37611, 15297, 62563, 59487, 47095, 67264, 63078, 40520, 33555, 18124, 1678, 88234, 13958, 27021, 13544, 57608, 81353, 81785, 64860, 7708, 9143, 9366, 76781, 51827, 87629, 40455, 84072, 7224, 49524, 18016, 68911, 71537, 7207, 23979, 28366, 80429, 17705, 17657, 20278, 55111, 91874, 99647, 82400, 66899, 40858, 87910, 54519, 33181, 15907, 26509, 1702, 5190, 14305, 96057, 89065, 65316, 37989, 53407, 79703, 37494, 46065, 65536, 96393, 36447, 45812, 88829, 49190, 49430, 54540, 96090, 55284, 63598, 63059, 69078, 27801, 66994, 29261, 60866, 70611, 6747, 38134, 86922, 40672, 19322, 51545, 35953, 86611, 5907, 60819, 44182, 7388, 76210, 73752, 18672, 13205, 36423, 10400, 62260, 62690, 98658, 77575, 50891, 55349, 16424, 1618, 51165, 38135, 35194, 38412, 22192, 96906, 50318, 19300, 41411, 71158, 638, 57903, 60659, 329, 41891, 97441, 18699, 93087, 56300, 59594, 74651, 4680, 21505, 37996, 96514, 84878, 21974, 47520, 301, 28408, 70978, 48326, 22243, 7952, 88939, 36656, 70636, 57347, 32199, 89057, 67554, 53754, 57646, 37996, 66181, 53654, 85595, 88692, 64331, 91864, 10914, 82070, 60825, 1927, 92361, 66082, 77494, 94377, 96529, 88807, 51196, 55666, 90825, 77312, 2279, 32783, 68228, 19170, 36062, 38519, 53159, 17745, 33858, 10841, 27185, 76894, 36642, 73917, 10228, 7893, 37231, 13274, 61549, 43292, 59764, 79262, 6777, 64665, 91246, 43223, 43330, 37727, 38088, 68627, 78509, 24068, 53926, 57526, 45247, 86166, 13774, 11886, 82584, 78138, 2070, 20345, 19377, 74370, 94565, 8802, 9934, 40092, 19034, 43863, 63531, 74324, 90720, 84616, 13947, 18953, 10971, 40124, 47764, 21512, 51855, 93163, 93537, 48420, 58795, 70793, 15406, 64185, 10269, 97514, 94056, 6294, 81886, 62820, 69194, 4396, 82523, 19813, 83426, 94755, 77451, 33750, 7196, 52125, 49081, 4892, 53507, 82658, 19517, 30730, 60257, 82177, 31750, 9876, 40391, 70406, 32192, 61600, 5132, 46579, 89452, 40648, 96364, 53534, 71857, 39507, 905, 8471, 13111, 12125, 14147, 75894, 42053, 62717, 36940, 50594, 50901, 45227, 26669, 2633, 41612, 65779, 17592, 37429, 24384, 18717, 14292, 30803, 40041, 95208, 91884, 12527, 72464, 80393, 988, 18941, 34197, 14541, 1709, 42299, 46355, 41995, 83214, 23682, 50805, 86339, 36149, 75794, 37412, 19184, 21949, 700, 66087, 49442, 96729, 94830, 65052, 68093, 43150, 19919, 9353, 12387, 44944, 75125, 82166, 85707, 91538, 39421, 79330, 48831, 39495, 44036, 21466, 41455, 52815, 43212, 72804, 58376, 68281, 31411, 20636, 57684, 53185, 15382, 73383, 64746, 44022, 47497, 76274, 96038, 54176, 72869, 58876, 38387, 11204, 40250, 47433, 83584, 22167, 25364, 90094, 19675, 84728, 30636, 89583, 6244, 70605, 81838, 73503, 46830, 70779, 80694, 40773, 41043, 7034, 84806, 66315, 45586, 60034, 10368, 36218, 83697, 88771, 34382, 78079, 14202, 13149, 15319, 27466, 40632, 61016, 69860, 72756, 42894, 95686, 8765, 31222]))
27
+
28
+ test6 :: Test
29
+ test6 = TestCase (assertEqual "for (minimumCoins [51869, 76872, 71438, 92190, 9550, 89065, 40629, 41068, 57474, 45987, 35992, 47570, 10130, 12426, 52908, 43666, 48032, 36253, 21873, 44893, 227, 11500, 85939, 78161, 34907, 84069, 10218, 27662, 35236, 89218, 22436, 60675, 11664, 83328, 88050, 6105, 17949, 31568, 8097, 7233, 50869, 82415, 63501, 90416, 32986, 85801, 97821, 48386, 20538, 2408, 32049, 86059, 15230, 15944, 98583, 83603, 74872, 71531, 13026, 64050, 48867, 72239, 23800, 14169, 23551, 10798, 23069, 76516, 68101, 79800, 32657, 29829, 25147, 17923, 38690, 8792, 96986, 91902, 94129, 73297, 72497, 60846, 1753, 99925, 96434, 74552, 76583, 31658, 19068, 35444, 71542, 83380, 47494, 89460, 58189, 33193, 58053, 14674, 84728, 80857, 65488, 26600, 93647, 68545, 54046, 26631, 92265, 67233, 42661, 49867, 15736, 2102, 8002, 61330, 76155, 26901, 72326, 77760, 54831, 90632, 42238, 51144, 69189, 22235, 23953, 21784, 73191, 60671, 4839, 69324, 33746, 13015, 54889, 47647, 56258, 85843, 77656, 71578, 71605, 65735, 89660, 68045, 44846, 985, 34149, 17138, 69522, 6480, 34878, 20000, 71938, 83332, 81533, 63129, 21679, 85316, 27, 58101, 28263, 69498, 2026, 40106, 34858, 34528, 52298, 40047, 18862, 32912, 98337, 18135, 37362, 8242, 61759, 29342, 58013, 20469, 84606, 35968, 17172, 6685, 33688, 87788, 93531, 68923, 74826, 8069, 38092, 83934, 8406, 21402, 86935, 34789, 14978, 44717, 66086, 81058, 21242, 651, 86265, 96535, 69064, 64625, 17522, 21415, 17422, 70141, 57761, 21879, 96955, 10729, 7682, 81381, 33054, 26685, 62228, 57585, 56290, 57431, 11517, 93911, 99125, 54938, 98434, 71000, 66809, 42981, 74096, 90617, 10267, 23531, 26345, 29313, 48650, 47089, 34490, 29737, 3401, 72495, 5650, 27950, 43725, 71758, 73068, 6527, 65882, 91124, 82704, 66821, 1185, 9895, 1737, 94582, 20932, 30841, 5426, 87057, 83773, 10242, 81924, 93460, 82214, 86165, 57737, 94599, 29387, 95097, 67997, 40303, 46520, 41369, 65466, 64514, 91447, 45386, 97558, 54229, 38763, 18597, 60018, 76088, 97192, 61886, 92528, 4614, 47072, 66699, 67034, 2784, 76997, 50207, 37677, 50388, 97013, 92911, 43473, 87487, 10025, 73680, 23551, 94830, 43389, 71288, 91268, 48165, 74007, 40129, 86140, 45451, 89308, 24718, 81229, 28399, 57816, 36690, 80938, 55650, 67917, 31840, 30277, 54879, 92373, 98101, 59128, 61714, 39370, 41906, 33120, 12184, 55932, 40029, 72890, 18076, 22938, 55599, 95029, 85309, 52944, 82584, 13284, 62167, 12467, 55814, 54668, 51418, 39111, 73149, 72587, 19192, 37043, 53841, 22283, 16035, 33046, 87845, 52730, 69819, 6075, 69258, 95912, 30124, 55001, 5402, 65654, 17722, 64577, 62267])," 180020 (minimumCoins [51869, 76872, 71438, 92190, 9550, 89065, 40629, 41068, 57474, 45987, 35992, 47570, 10130, 12426, 52908, 43666, 48032, 36253, 21873, 44893, 227, 11500, 85939, 78161, 34907, 84069, 10218, 27662, 35236, 89218, 22436, 60675, 11664, 83328, 88050, 6105, 17949, 31568, 8097, 7233, 50869, 82415, 63501, 90416, 32986, 85801, 97821, 48386, 20538, 2408, 32049, 86059, 15230, 15944, 98583, 83603, 74872, 71531, 13026, 64050, 48867, 72239, 23800, 14169, 23551, 10798, 23069, 76516, 68101, 79800, 32657, 29829, 25147, 17923, 38690, 8792, 96986, 91902, 94129, 73297, 72497, 60846, 1753, 99925, 96434, 74552, 76583, 31658, 19068, 35444, 71542, 83380, 47494, 89460, 58189, 33193, 58053, 14674, 84728, 80857, 65488, 26600, 93647, 68545, 54046, 26631, 92265, 67233, 42661, 49867, 15736, 2102, 8002, 61330, 76155, 26901, 72326, 77760, 54831, 90632, 42238, 51144, 69189, 22235, 23953, 21784, 73191, 60671, 4839, 69324, 33746, 13015, 54889, 47647, 56258, 85843, 77656, 71578, 71605, 65735, 89660, 68045, 44846, 985, 34149, 17138, 69522, 6480, 34878, 20000, 71938, 83332, 81533, 63129, 21679, 85316, 27, 58101, 28263, 69498, 2026, 40106, 34858, 34528, 52298, 40047, 18862, 32912, 98337, 18135, 37362, 8242, 61759, 29342, 58013, 20469, 84606, 35968, 17172, 6685, 33688, 87788, 93531, 68923, 74826, 8069, 38092, 83934, 8406, 21402, 86935, 34789, 14978, 44717, 66086, 81058, 21242, 651, 86265, 96535, 69064, 64625, 17522, 21415, 17422, 70141, 57761, 21879, 96955, 10729, 7682, 81381, 33054, 26685, 62228, 57585, 56290, 57431, 11517, 93911, 99125, 54938, 98434, 71000, 66809, 42981, 74096, 90617, 10267, 23531, 26345, 29313, 48650, 47089, 34490, 29737, 3401, 72495, 5650, 27950, 43725, 71758, 73068, 6527, 65882, 91124, 82704, 66821, 1185, 9895, 1737, 94582, 20932, 30841, 5426, 87057, 83773, 10242, 81924, 93460, 82214, 86165, 57737, 94599, 29387, 95097, 67997, 40303, 46520, 41369, 65466, 64514, 91447, 45386, 97558, 54229, 38763, 18597, 60018, 76088, 97192, 61886, 92528, 4614, 47072, 66699, 67034, 2784, 76997, 50207, 37677, 50388, 97013, 92911, 43473, 87487, 10025, 73680, 23551, 94830, 43389, 71288, 91268, 48165, 74007, 40129, 86140, 45451, 89308, 24718, 81229, 28399, 57816, 36690, 80938, 55650, 67917, 31840, 30277, 54879, 92373, 98101, 59128, 61714, 39370, 41906, 33120, 12184, 55932, 40029, 72890, 18076, 22938, 55599, 95029, 85309, 52944, 82584, 13284, 62167, 12467, 55814, 54668, 51418, 39111, 73149, 72587, 19192, 37043, 53841, 22283, 16035, 33046, 87845, 52730, 69819, 6075, 69258, 95912, 30124, 55001, 5402, 65654, 17722, 64577, 62267]))
30
+
31
+ test7 :: Test
32
+ test7 = TestCase (assertEqual "for (minimumCoins [85819, 57524, 67472, 96017, 94749, 74943, 9279, 88526, 32, 69933, 71137, 62964, 80714, 61858, 9434, 75908, 95785, 68452, 52898, 91585, 14462, 7420, 12108, 11527, 32345, 16873, 89007, 94831, 90120, 97675, 77799, 19883, 19200, 98977, 22406, 56138, 57252, 70818, 86320, 84110, 46761, 24388, 4171, 70925, 93907, 1837, 41625, 27118, 62687, 23216, 32292, 85764, 93133, 86691, 44539, 66006, 46016, 42710, 67482, 40023, 47949, 36166, 11083, 45107, 83826, 25051, 27909, 38401, 72628, 7145, 6269, 92652, 46089, 96361, 30562, 70625, 5300, 76809, 19756, 59708, 54907, 1627, 77180, 76381, 56002, 2551, 38246, 21336, 68458, 46252, 54817, 88680, 27483, 2093, 42078, 59165, 16204, 67931, 28413, 19485, 28035, 35783, 87279, 33760, 2045, 43157, 85813, 41778, 95093, 85776, 18114, 97737, 13303, 75094, 97281, 16498, 93909, 37643, 84240, 68667, 16991, 70500, 7385, 60269, 97454, 29326, 94025, 63782, 38052, 49540, 10868, 54902, 4988, 51910, 14657, 14938, 76843, 38097, 49596, 56993, 63727, 30414, 2572, 6137, 32420, 12577, 96999, 93014, 53942, 69315, 58199, 37255, 18375, 54081, 91290, 22609, 6842, 16918, 71351, 46609, 31929, 89400, 1993, 91250, 59227, 32065, 15347, 20484, 86308, 50923, 44648, 43756, 68586, 69559, 13845, 5835, 61208, 40854, 92599, 81452, 43584, 21018, 79955, 35160, 63281, 67545, 16735, 11220, 19126, 57525, 97149, 94587, 46908, 37620, 28988, 75624, 74351, 11923, 92867, 48535, 61485, 51034, 99814, 54604, 3293, 30930, 95905, 45278, 85359, 62031, 99563, 55161, 85039, 10717, 41098, 34523, 74455, 74438, 74814, 52944, 60178, 56627, 68731, 51697, 37903, 20145, 93336, 5040, 53163, 73683, 60799, 87001, 33455, 62702, 14010, 44870, 28838, 17667, 1663, 94004, 64936, 99893, 7620, 22159, 5453, 21995, 61858, 11294, 64677, 37538, 93154, 65811, 16625, 51865, 20944, 52964, 55758, 46613, 48471, 94548, 31978, 59427, 50628, 90549, 91316, 84918, 99057, 96266, 94191, 57466, 87265, 69167, 70460, 84562, 24306, 86152, 23483, 23412, 60673, 26751, 22086, 99448, 23981, 14864, 55606, 56632, 76297, 79332, 80268, 78028, 37174, 8736, 33913, 55328, 14816, 35196, 63911, 91240, 47356, 96085, 15734, 20003, 98832, 24111, 49334, 8828, 31295, 76056, 71618, 53369, 8967, 59110, 56024, 16999, 27871, 40634, 73582, 94206, 62950, 21530, 96573, 42104, 9007, 71879, 18850, 18476, 87885, 37004, 2154, 53191, 16386, 21586, 84780, 35593, 84437, 46921, 46179, 85172, 96352, 28586, 22980, 53267, 87861, 45404, 31528, 1075, 23153, 69384, 39249, 21166, 88322, 50843, 6648, 4244, 57045, 82490, 25320, 6299, 9337, 64235, 85921, 54613, 55316, 35699, 9577, 40169, 29763, 92937, 44289, 79322, 85169, 71813, 68135, 5386, 75039, 37667, 73374, 28254, 43072, 73343, 40502, 92572, 47440, 53947, 20702, 17315, 87289, 61731, 54167, 19128, 97148, 79889, 80618, 6366, 18375, 10530, 14395, 73559, 53481, 73810, 91365, 12933, 20099, 1783, 11904, 74293, 35364, 83179, 20742, 20406, 59984, 36489, 72384, 80864, 26720, 56633, 35806, 86671, 25276, 53049, 19967, 67615, 42214, 71190, 37126, 71653, 57011, 76781, 74856, 62086, 76708, 25117, 38639, 15649, 39958, 42697, 59550, 55638, 5399, 47733, 64702, 98646, 21513, 23401, 56358, 92883, 63214, 58143, 68827, 43672, 26406, 40026, 73956, 22509, 97495, 98215, 68560, 66237, 35136, 95803])," 188878 (minimumCoins [85819, 57524, 67472, 96017, 94749, 74943, 9279, 88526, 32, 69933, 71137, 62964, 80714, 61858, 9434, 75908, 95785, 68452, 52898, 91585, 14462, 7420, 12108, 11527, 32345, 16873, 89007, 94831, 90120, 97675, 77799, 19883, 19200, 98977, 22406, 56138, 57252, 70818, 86320, 84110, 46761, 24388, 4171, 70925, 93907, 1837, 41625, 27118, 62687, 23216, 32292, 85764, 93133, 86691, 44539, 66006, 46016, 42710, 67482, 40023, 47949, 36166, 11083, 45107, 83826, 25051, 27909, 38401, 72628, 7145, 6269, 92652, 46089, 96361, 30562, 70625, 5300, 76809, 19756, 59708, 54907, 1627, 77180, 76381, 56002, 2551, 38246, 21336, 68458, 46252, 54817, 88680, 27483, 2093, 42078, 59165, 16204, 67931, 28413, 19485, 28035, 35783, 87279, 33760, 2045, 43157, 85813, 41778, 95093, 85776, 18114, 97737, 13303, 75094, 97281, 16498, 93909, 37643, 84240, 68667, 16991, 70500, 7385, 60269, 97454, 29326, 94025, 63782, 38052, 49540, 10868, 54902, 4988, 51910, 14657, 14938, 76843, 38097, 49596, 56993, 63727, 30414, 2572, 6137, 32420, 12577, 96999, 93014, 53942, 69315, 58199, 37255, 18375, 54081, 91290, 22609, 6842, 16918, 71351, 46609, 31929, 89400, 1993, 91250, 59227, 32065, 15347, 20484, 86308, 50923, 44648, 43756, 68586, 69559, 13845, 5835, 61208, 40854, 92599, 81452, 43584, 21018, 79955, 35160, 63281, 67545, 16735, 11220, 19126, 57525, 97149, 94587, 46908, 37620, 28988, 75624, 74351, 11923, 92867, 48535, 61485, 51034, 99814, 54604, 3293, 30930, 95905, 45278, 85359, 62031, 99563, 55161, 85039, 10717, 41098, 34523, 74455, 74438, 74814, 52944, 60178, 56627, 68731, 51697, 37903, 20145, 93336, 5040, 53163, 73683, 60799, 87001, 33455, 62702, 14010, 44870, 28838, 17667, 1663, 94004, 64936, 99893, 7620, 22159, 5453, 21995, 61858, 11294, 64677, 37538, 93154, 65811, 16625, 51865, 20944, 52964, 55758, 46613, 48471, 94548, 31978, 59427, 50628, 90549, 91316, 84918, 99057, 96266, 94191, 57466, 87265, 69167, 70460, 84562, 24306, 86152, 23483, 23412, 60673, 26751, 22086, 99448, 23981, 14864, 55606, 56632, 76297, 79332, 80268, 78028, 37174, 8736, 33913, 55328, 14816, 35196, 63911, 91240, 47356, 96085, 15734, 20003, 98832, 24111, 49334, 8828, 31295, 76056, 71618, 53369, 8967, 59110, 56024, 16999, 27871, 40634, 73582, 94206, 62950, 21530, 96573, 42104, 9007, 71879, 18850, 18476, 87885, 37004, 2154, 53191, 16386, 21586, 84780, 35593, 84437, 46921, 46179, 85172, 96352, 28586, 22980, 53267, 87861, 45404, 31528, 1075, 23153, 69384, 39249, 21166, 88322, 50843, 6648, 4244, 57045, 82490, 25320, 6299, 9337, 64235, 85921, 54613, 55316, 35699, 9577, 40169, 29763, 92937, 44289, 79322, 85169, 71813, 68135, 5386, 75039, 37667, 73374, 28254, 43072, 73343, 40502, 92572, 47440, 53947, 20702, 17315, 87289, 61731, 54167, 19128, 97148, 79889, 80618, 6366, 18375, 10530, 14395, 73559, 53481, 73810, 91365, 12933, 20099, 1783, 11904, 74293, 35364, 83179, 20742, 20406, 59984, 36489, 72384, 80864, 26720, 56633, 35806, 86671, 25276, 53049, 19967, 67615, 42214, 71190, 37126, 71653, 57011, 76781, 74856, 62086, 76708, 25117, 38639, 15649, 39958, 42697, 59550, 55638, 5399, 47733, 64702, 98646, 21513, 23401, 56358, 92883, 63214, 58143, 68827, 43672, 26406, 40026, 73956, 22509, 97495, 98215, 68560, 66237, 35136, 95803]))
33
+
34
+ test8 :: Test
35
+ test8 = TestCase (assertEqual "for (minimumCoins [79080, 49226, 66188, 38017, 85603, 77739, 30639, 93768, 18176, 71053, 62748, 88177, 58108, 11316, 2497, 10252, 37227, 43226, 64011, 94374, 45358, 1193, 97674, 1575, 18501, 49270, 46410, 26855, 23713, 70078, 13165, 77640, 68048, 46862, 12163, 42742, 21592, 8493, 64927, 9520, 66459, 17978, 36472, 78894, 44626, 58106, 18859, 50241, 60069, 93319, 38758, 51133, 36974, 92241, 16105, 39943, 71741, 9841, 85910, 84395, 97373, 24564, 31813, 23662, 50943, 5723, 12667, 14300, 54642, 52481, 52262, 63838, 66120, 35806, 82384, 83617, 13167, 73919, 79691, 85522, 71713, 78549, 84724, 87949, 57562, 27674, 59289, 79040, 56150, 60333, 87432, 45641, 65947, 1807, 49974, 56727, 98429, 36259, 70755, 94375, 22242, 54324, 62942, 82666, 21993, 45370, 57035, 13941, 98354, 55861, 24689, 58771, 50870, 9992, 68630, 59845, 52122, 51793, 32097, 21282, 39739, 55815, 98184, 57652, 57706, 18907, 51062, 54207, 71625, 29427, 92042, 40703, 89172, 9242, 42570, 96454, 29696, 87719, 34473, 90568, 19191, 39381, 2100, 30683, 56370, 83672, 15991, 94808, 54732, 35443, 73746, 45188, 26264, 66716, 40676, 19709, 63202, 32250, 67215, 87263, 18164, 16676, 27857, 68756, 29242, 84507, 86346, 43396, 1213, 86118, 62582, 2933, 29594, 59674, 95135, 44620, 16763, 9675, 52980, 19444, 58525, 62194, 18615, 98255, 25243, 73750, 77295, 61753, 61977, 87623, 57834, 67439, 10996, 16831, 4917, 73350, 73124, 45534, 85077, 82745, 84723, 23384, 77826, 55246, 16331, 49665, 39432, 39296, 89059, 60530, 55938, 77319, 12293, 12810, 12271, 12400, 21891, 48731, 11351, 9901, 40298, 77776, 46630, 70943, 54415, 14597, 67429, 35299, 66982, 49634, 9507, 1537, 30693, 60557, 56492, 87789, 20565, 40722, 88773, 35744, 19306, 48511, 22901, 64568, 37310, 67408, 34501, 39600, 21970, 23632, 33731, 38690, 54452, 23675, 43508, 63839, 26999, 83699, 77415, 36885, 21099, 37638, 44294, 51301, 21407, 35472, 22812, 19575, 82282, 92354, 83296, 60051, 60827, 10252, 97548, 86762, 90120, 54776, 10573, 60041, 8837, 15513, 75819, 97248, 41362, 19139, 76830, 80428, 86137, 83774, 65843, 42548, 96464, 1653, 94499, 97051, 31490, 26371, 98708, 57928, 56241, 76929, 17743, 81886, 97748, 61651, 1778, 14855, 48801, 65417, 38525, 27935, 62838, 53266, 69513, 8352, 65282, 91895, 9815, 19637, 84527, 23111, 99042, 4967, 1413, 76721, 30986, 79972, 89648, 50324, 30685, 15994, 46189, 42183, 49629, 14379, 40285, 36370, 57656, 19324, 30127, 32548, 34400, 46391, 96580, 641, 59260, 47331, 51899, 8201, 29975, 93104, 4508, 49506, 61078, 25173, 57897, 41701, 16604, 27960, 6174, 10887, 87478, 18519, 45351, 94664, 76025, 43593, 51037])," 198246 (minimumCoins [79080, 49226, 66188, 38017, 85603, 77739, 30639, 93768, 18176, 71053, 62748, 88177, 58108, 11316, 2497, 10252, 37227, 43226, 64011, 94374, 45358, 1193, 97674, 1575, 18501, 49270, 46410, 26855, 23713, 70078, 13165, 77640, 68048, 46862, 12163, 42742, 21592, 8493, 64927, 9520, 66459, 17978, 36472, 78894, 44626, 58106, 18859, 50241, 60069, 93319, 38758, 51133, 36974, 92241, 16105, 39943, 71741, 9841, 85910, 84395, 97373, 24564, 31813, 23662, 50943, 5723, 12667, 14300, 54642, 52481, 52262, 63838, 66120, 35806, 82384, 83617, 13167, 73919, 79691, 85522, 71713, 78549, 84724, 87949, 57562, 27674, 59289, 79040, 56150, 60333, 87432, 45641, 65947, 1807, 49974, 56727, 98429, 36259, 70755, 94375, 22242, 54324, 62942, 82666, 21993, 45370, 57035, 13941, 98354, 55861, 24689, 58771, 50870, 9992, 68630, 59845, 52122, 51793, 32097, 21282, 39739, 55815, 98184, 57652, 57706, 18907, 51062, 54207, 71625, 29427, 92042, 40703, 89172, 9242, 42570, 96454, 29696, 87719, 34473, 90568, 19191, 39381, 2100, 30683, 56370, 83672, 15991, 94808, 54732, 35443, 73746, 45188, 26264, 66716, 40676, 19709, 63202, 32250, 67215, 87263, 18164, 16676, 27857, 68756, 29242, 84507, 86346, 43396, 1213, 86118, 62582, 2933, 29594, 59674, 95135, 44620, 16763, 9675, 52980, 19444, 58525, 62194, 18615, 98255, 25243, 73750, 77295, 61753, 61977, 87623, 57834, 67439, 10996, 16831, 4917, 73350, 73124, 45534, 85077, 82745, 84723, 23384, 77826, 55246, 16331, 49665, 39432, 39296, 89059, 60530, 55938, 77319, 12293, 12810, 12271, 12400, 21891, 48731, 11351, 9901, 40298, 77776, 46630, 70943, 54415, 14597, 67429, 35299, 66982, 49634, 9507, 1537, 30693, 60557, 56492, 87789, 20565, 40722, 88773, 35744, 19306, 48511, 22901, 64568, 37310, 67408, 34501, 39600, 21970, 23632, 33731, 38690, 54452, 23675, 43508, 63839, 26999, 83699, 77415, 36885, 21099, 37638, 44294, 51301, 21407, 35472, 22812, 19575, 82282, 92354, 83296, 60051, 60827, 10252, 97548, 86762, 90120, 54776, 10573, 60041, 8837, 15513, 75819, 97248, 41362, 19139, 76830, 80428, 86137, 83774, 65843, 42548, 96464, 1653, 94499, 97051, 31490, 26371, 98708, 57928, 56241, 76929, 17743, 81886, 97748, 61651, 1778, 14855, 48801, 65417, 38525, 27935, 62838, 53266, 69513, 8352, 65282, 91895, 9815, 19637, 84527, 23111, 99042, 4967, 1413, 76721, 30986, 79972, 89648, 50324, 30685, 15994, 46189, 42183, 49629, 14379, 40285, 36370, 57656, 19324, 30127, 32548, 34400, 46391, 96580, 641, 59260, 47331, 51899, 8201, 29975, 93104, 4508, 49506, 61078, 25173, 57897, 41701, 16604, 27960, 6174, 10887, 87478, 18519, 45351, 94664, 76025, 43593, 51037]))
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
minimum_number_of_coins_for_fruits/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, minimumCoins(Arrays.asList(3,1,2)));
14
+ }
15
+ @Test
16
+ public void test2() {
17
+ assertEquals(2, minimumCoins(Arrays.asList(1,10,1,1)));
18
+ }
19
+ @Test
20
+ public void test3() {
21
+ assertEquals(39, minimumCoins(Arrays.asList(26,18,6,12,49,7,45,45)));
22
+ }
23
+
24
+ }
minimum_number_of_coins_for_fruits/meta.json ADDED
@@ -0,0 +1,2327 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "id": 3209,
3
+ "name": "minimum_number_of_coins_for_fruits",
4
+ "difficulty": "Medium",
5
+ "link": "https://leetcode.com/problems/minimum-number-of-coins-for-fruits/",
6
+ "date": "2023-11-11 00:00:00",
7
+ "task_description": "You are given an **0-indexed** integer array `prices` where `prices[i]` denotes the number of coins needed to purchase the `(i + 1)th` fruit. The fruit market has the following reward for each fruit: If you purchase the `(i + 1)th` fruit at `prices[i]` coins, you can get any number of the next `i` fruits for free. **Note** that even if you **can** take fruit `j` for free, you can still purchase it for `prices[j - 1]` coins to receive its reward. Return the **minimum** number of coins needed to acquire all the fruits. **Example 1:** **Input:** prices = [3,1,2] **Output:** 4 **Explanation:** Purchase the 1st fruit with `prices[0] = 3` coins, you are allowed to take the 2nd fruit for free. Purchase the 2nd fruit with `prices[1] = 1` coin, you are allowed to take the 3rd fruit for free. Take the 3rd fruit for free. Note that even though you could take the 2nd fruit for free as a reward of buying 1st fruit, you purchase it to receive its reward, which is more optimal. **Example 2:** **Input:** prices = [1,10,1,1] **Output:** 2 **Explanation:** Purchase the 1st fruit with `prices[0] = 1` coin, you are allowed to take the 2nd fruit for free. Take the 2nd fruit for free. Purchase the 3rd fruit for `prices[2] = 1` coin, you are allowed to take the 4th fruit for free. Take the 4th fruit for free. **Example 3:** **Input:** prices = [26,18,6,12,49,7,45,45] **Output:** 39 **Explanation:** Purchase the 1st fruit with `prices[0] = 26` coin, you are allowed to take the 2nd fruit for free. Take the 2nd fruit for free. Purchase the 3rd fruit for `prices[2] = 6` coin, you are allowed to take the 4th, 5th and 6th (the next three) fruits for free. Take the 4th fruit for free. Take the 5th fruit for free. Purchase the 6th fruit with `prices[5] = 7` coin, you are allowed to take the 8th and 9th fruit for free. Take the 7th fruit for free. Take the 8th fruit for free. Note that even though you could take the 6th fruit for free as a reward of buying 3rd fruit, you purchase it to receive its reward, which is more optimal. **Constraints:** `1 <= prices.length <= 1000` `1 <= prices[i] <= 105`",
8
+ "public_test_cases": [
9
+ {
10
+ "label": "Example 1",
11
+ "input": "prices = [3,1,2]",
12
+ "output": "4 "
13
+ },
14
+ {
15
+ "label": "Example 2",
16
+ "input": "prices = [1,10,1,1]",
17
+ "output": "2 "
18
+ },
19
+ {
20
+ "label": "Example 3",
21
+ "input": "prices = [26,18,6,12,49,7,45,45]",
22
+ "output": "39 "
23
+ }
24
+ ],
25
+ "private_test_cases": [
26
+ {
27
+ "input": [
28
+ 25274,
29
+ 21829,
30
+ 95346,
31
+ 28245,
32
+ 24245,
33
+ 37803,
34
+ 38360,
35
+ 16039,
36
+ 31802,
37
+ 23193,
38
+ 33504,
39
+ 97219,
40
+ 16925,
41
+ 70574,
42
+ 13560,
43
+ 7625,
44
+ 82860,
45
+ 76280,
46
+ 96716,
47
+ 73895,
48
+ 22692,
49
+ 51136,
50
+ 87146,
51
+ 65163,
52
+ 51629,
53
+ 44000,
54
+ 20919,
55
+ 25697,
56
+ 77628,
57
+ 21836,
58
+ 24398,
59
+ 54626,
60
+ 26704,
61
+ 28996,
62
+ 75626,
63
+ 49812,
64
+ 14484,
65
+ 90212,
66
+ 29445,
67
+ 28574,
68
+ 66907,
69
+ 74570,
70
+ 89418,
71
+ 32886,
72
+ 32293,
73
+ 6088,
74
+ 55831,
75
+ 21697,
76
+ 38819,
77
+ 74671,
78
+ 47965,
79
+ 11396,
80
+ 66086,
81
+ 16298,
82
+ 21840,
83
+ 85271,
84
+ 75761,
85
+ 9501,
86
+ 95228,
87
+ 19405,
88
+ 23632,
89
+ 24389,
90
+ 24377,
91
+ 62787,
92
+ 96480,
93
+ 57008,
94
+ 84889,
95
+ 54563,
96
+ 46663,
97
+ 15678,
98
+ 50535,
99
+ 72823,
100
+ 2389,
101
+ 77445,
102
+ 32480,
103
+ 90368,
104
+ 15052,
105
+ 43885,
106
+ 35417,
107
+ 24399,
108
+ 26527,
109
+ 56252,
110
+ 53344,
111
+ 97174,
112
+ 14198,
113
+ 55647,
114
+ 31911,
115
+ 55084,
116
+ 97817,
117
+ 176,
118
+ 59785,
119
+ 12706,
120
+ 98256,
121
+ 70328,
122
+ 87691,
123
+ 68884,
124
+ 52055,
125
+ 61581,
126
+ 28214,
127
+ 80709,
128
+ 96084,
129
+ 34913,
130
+ 19845,
131
+ 43427,
132
+ 56047,
133
+ 91419,
134
+ 37292,
135
+ 28720,
136
+ 18420,
137
+ 64021,
138
+ 28012,
139
+ 57830,
140
+ 5738,
141
+ 75211,
142
+ 45206,
143
+ 4045,
144
+ 23675,
145
+ 12586,
146
+ 22254,
147
+ 4665,
148
+ 27040,
149
+ 79391,
150
+ 22283,
151
+ 46279,
152
+ 41200,
153
+ 76915,
154
+ 1176,
155
+ 22144,
156
+ 14147,
157
+ 24175,
158
+ 89960,
159
+ 44127,
160
+ 44437,
161
+ 84993,
162
+ 31304,
163
+ 87132,
164
+ 61776,
165
+ 89137,
166
+ 50126,
167
+ 36772,
168
+ 77920,
169
+ 65015,
170
+ 70168,
171
+ 44093,
172
+ 43002,
173
+ 84834,
174
+ 4751,
175
+ 69070,
176
+ 22323,
177
+ 97538,
178
+ 21920,
179
+ 76721,
180
+ 41462,
181
+ 86518,
182
+ 68262,
183
+ 75616,
184
+ 4607,
185
+ 55684,
186
+ 61921,
187
+ 93969,
188
+ 18161,
189
+ 31598,
190
+ 3124,
191
+ 30911,
192
+ 37361,
193
+ 68210,
194
+ 7329,
195
+ 76304,
196
+ 3770,
197
+ 54397,
198
+ 74791,
199
+ 92941,
200
+ 55638,
201
+ 29337,
202
+ 59087,
203
+ 27593,
204
+ 17671,
205
+ 66290,
206
+ 7105,
207
+ 42309,
208
+ 91197,
209
+ 52966,
210
+ 89293,
211
+ 51785,
212
+ 17079,
213
+ 3369,
214
+ 72463,
215
+ 43418,
216
+ 99070,
217
+ 5560,
218
+ 66924,
219
+ 10423,
220
+ 8102,
221
+ 92488,
222
+ 27378,
223
+ 18189,
224
+ 91738,
225
+ 33005,
226
+ 32280,
227
+ 49365,
228
+ 87150,
229
+ 49628,
230
+ 38591,
231
+ 31944,
232
+ 40121,
233
+ 87860,
234
+ 40269,
235
+ 56710,
236
+ 3281,
237
+ 32381,
238
+ 92163,
239
+ 89701,
240
+ 32387,
241
+ 3807,
242
+ 77778,
243
+ 18988,
244
+ 48548,
245
+ 39641,
246
+ 95800,
247
+ 5179,
248
+ 29904,
249
+ 28267,
250
+ 63162,
251
+ 83210,
252
+ 84095,
253
+ 52268,
254
+ 88162,
255
+ 90863,
256
+ 93578,
257
+ 7550,
258
+ 72386,
259
+ 47560,
260
+ 16251,
261
+ 26075,
262
+ 5196,
263
+ 59010,
264
+ 98520,
265
+ 25039,
266
+ 93383,
267
+ 29945,
268
+ 10287,
269
+ 65817,
270
+ 66536,
271
+ 76113,
272
+ 79093,
273
+ 17575,
274
+ 61324,
275
+ 51883,
276
+ 20694,
277
+ 60603,
278
+ 28450,
279
+ 63310,
280
+ 73433,
281
+ 86161,
282
+ 6785,
283
+ 57728,
284
+ 52602,
285
+ 64516,
286
+ 85688,
287
+ 53199,
288
+ 77800,
289
+ 17631,
290
+ 78309,
291
+ 30500,
292
+ 51212,
293
+ 22004,
294
+ 58234,
295
+ 7996,
296
+ 28086,
297
+ 80252,
298
+ 15692,
299
+ 99887,
300
+ 88585,
301
+ 94936,
302
+ 77129,
303
+ 73452,
304
+ 76823,
305
+ 89339,
306
+ 79384,
307
+ 79277,
308
+ 26511,
309
+ 38364,
310
+ 74974,
311
+ 75977,
312
+ 48064,
313
+ 7543,
314
+ 45588,
315
+ 98664,
316
+ 73282,
317
+ 20401,
318
+ 75286,
319
+ 87778,
320
+ 86337,
321
+ 67886,
322
+ 8907,
323
+ 20380,
324
+ 17677,
325
+ 69449,
326
+ 79567,
327
+ 62464,
328
+ 41909,
329
+ 55384,
330
+ 11362,
331
+ 14807,
332
+ 7294,
333
+ 87880,
334
+ 96017,
335
+ 99971,
336
+ 88796,
337
+ 10323,
338
+ 67695,
339
+ 77267,
340
+ 51342,
341
+ 2682,
342
+ 205,
343
+ 64755,
344
+ 27214,
345
+ 65733,
346
+ 85496,
347
+ 23706,
348
+ 88159,
349
+ 28288,
350
+ 98958,
351
+ 76058,
352
+ 78709,
353
+ 71098,
354
+ 54940,
355
+ 97467,
356
+ 45648,
357
+ 21663,
358
+ 20507,
359
+ 75111,
360
+ 78383,
361
+ 55692,
362
+ 39811,
363
+ 20207,
364
+ 98747,
365
+ 6294,
366
+ 59015,
367
+ 11362,
368
+ 26670,
369
+ 49111,
370
+ 72097,
371
+ 87180,
372
+ 34887,
373
+ 97415,
374
+ 86399,
375
+ 93755,
376
+ 12391,
377
+ 78121,
378
+ 49288,
379
+ 89879,
380
+ 75280,
381
+ 77655,
382
+ 38577,
383
+ 54617,
384
+ 31076,
385
+ 75623,
386
+ 62253,
387
+ 29826,
388
+ 4761,
389
+ 30602,
390
+ 22208,
391
+ 72349,
392
+ 8736,
393
+ 34530,
394
+ 47544,
395
+ 81048,
396
+ 39409,
397
+ 3121,
398
+ 75148,
399
+ 71824,
400
+ 85852,
401
+ 26634,
402
+ 22537,
403
+ 14791,
404
+ 13582,
405
+ 32043,
406
+ 3,
407
+ 14194,
408
+ 1509,
409
+ 67020,
410
+ 27193,
411
+ 76831,
412
+ 48821,
413
+ 5791,
414
+ 39372,
415
+ 87427,
416
+ 3266,
417
+ 31240,
418
+ 85126,
419
+ 44559,
420
+ 74066,
421
+ 54239,
422
+ 34138,
423
+ 93964,
424
+ 63328,
425
+ 73840,
426
+ 75331,
427
+ 12796,
428
+ 83605,
429
+ 38516,
430
+ 87981,
431
+ 25519,
432
+ 69524,
433
+ 24068,
434
+ 58527,
435
+ 14034,
436
+ 97772,
437
+ 75690,
438
+ 97292,
439
+ 12094,
440
+ 18063,
441
+ 57660,
442
+ 59622,
443
+ 15009,
444
+ 9947,
445
+ 47798,
446
+ 14709,
447
+ 56415,
448
+ 8481,
449
+ 78315,
450
+ 58717,
451
+ 29398,
452
+ 38564,
453
+ 45851,
454
+ 12726,
455
+ 1148,
456
+ 61644,
457
+ 62166,
458
+ 69410,
459
+ 1682,
460
+ 28420,
461
+ 40121,
462
+ 77581,
463
+ 98494,
464
+ 82847,
465
+ 14444,
466
+ 84529,
467
+ 16546,
468
+ 3163,
469
+ 55333,
470
+ 12656,
471
+ 1980,
472
+ 52693,
473
+ 8546,
474
+ 30411,
475
+ 77251,
476
+ 48376,
477
+ 77286,
478
+ 77690,
479
+ 75453,
480
+ 95132,
481
+ 79815,
482
+ 313,
483
+ 11257,
484
+ 68173,
485
+ 69882,
486
+ 82518,
487
+ 4405,
488
+ 90998,
489
+ 85976,
490
+ 55016,
491
+ 70891,
492
+ 87410,
493
+ 87579,
494
+ 332,
495
+ 9433,
496
+ 49780,
497
+ 77044,
498
+ 63658,
499
+ 75626,
500
+ 97957,
501
+ 34844,
502
+ 25115,
503
+ 12789,
504
+ 57294,
505
+ 23840,
506
+ 69431,
507
+ 36106,
508
+ 22662,
509
+ 10300,
510
+ 61423,
511
+ 44506,
512
+ 93224,
513
+ 53515,
514
+ 90565,
515
+ 27916,
516
+ 90476,
517
+ 63726,
518
+ 33299,
519
+ 43574
520
+ ],
521
+ "output": 125524
522
+ },
523
+ {
524
+ "input": [
525
+ 87456,
526
+ 62878,
527
+ 2902,
528
+ 19684,
529
+ 18472,
530
+ 71532,
531
+ 47090,
532
+ 95104,
533
+ 93715,
534
+ 7242,
535
+ 12971,
536
+ 42860,
537
+ 52919,
538
+ 24131,
539
+ 30584,
540
+ 70208,
541
+ 97914,
542
+ 47047,
543
+ 90047,
544
+ 47793,
545
+ 53991,
546
+ 59800,
547
+ 41309,
548
+ 66673,
549
+ 58872,
550
+ 5251,
551
+ 11960,
552
+ 56641,
553
+ 62105,
554
+ 78866,
555
+ 64470,
556
+ 61227,
557
+ 17719,
558
+ 77876,
559
+ 68947,
560
+ 20734,
561
+ 66117,
562
+ 45917,
563
+ 68884,
564
+ 65689,
565
+ 38691,
566
+ 29680,
567
+ 96821,
568
+ 27581,
569
+ 62125,
570
+ 59353,
571
+ 64541,
572
+ 49569,
573
+ 9569,
574
+ 76300,
575
+ 60736,
576
+ 65234,
577
+ 81941,
578
+ 98028,
579
+ 64952,
580
+ 65082,
581
+ 91370,
582
+ 92902,
583
+ 88308,
584
+ 74634,
585
+ 22593,
586
+ 1424,
587
+ 83187,
588
+ 95049,
589
+ 54761,
590
+ 31556,
591
+ 85312,
592
+ 30480,
593
+ 47625,
594
+ 37928,
595
+ 12594,
596
+ 50370,
597
+ 91529,
598
+ 93968,
599
+ 75410,
600
+ 25030,
601
+ 87006,
602
+ 10469,
603
+ 72915,
604
+ 9229,
605
+ 23726,
606
+ 9072,
607
+ 84395,
608
+ 10898,
609
+ 81428,
610
+ 41910,
611
+ 69049,
612
+ 90322,
613
+ 41725,
614
+ 23712,
615
+ 56668,
616
+ 95116,
617
+ 85601,
618
+ 19800,
619
+ 37019,
620
+ 45850,
621
+ 88633,
622
+ 99940,
623
+ 11015,
624
+ 93824,
625
+ 17633,
626
+ 41577,
627
+ 74372,
628
+ 79513,
629
+ 32894,
630
+ 52410,
631
+ 53586,
632
+ 88069,
633
+ 72276,
634
+ 20595,
635
+ 57818,
636
+ 20651,
637
+ 23237,
638
+ 13247,
639
+ 22506,
640
+ 96935,
641
+ 38734,
642
+ 19604,
643
+ 67796,
644
+ 20404,
645
+ 59826,
646
+ 10987,
647
+ 67747,
648
+ 54172,
649
+ 41049,
650
+ 55585,
651
+ 99181,
652
+ 3307,
653
+ 36320,
654
+ 23217,
655
+ 38570,
656
+ 24422,
657
+ 89438,
658
+ 74373,
659
+ 48552,
660
+ 77461,
661
+ 27869,
662
+ 85999,
663
+ 23599,
664
+ 63626,
665
+ 43067,
666
+ 80563,
667
+ 10227,
668
+ 735,
669
+ 56578,
670
+ 43862,
671
+ 6553,
672
+ 18750,
673
+ 30742,
674
+ 31466,
675
+ 29422,
676
+ 31765,
677
+ 7203,
678
+ 29625,
679
+ 57602,
680
+ 97387,
681
+ 61988,
682
+ 58919,
683
+ 84463,
684
+ 80096,
685
+ 97805,
686
+ 6694,
687
+ 3299,
688
+ 93698,
689
+ 68681,
690
+ 97520,
691
+ 14321,
692
+ 24095,
693
+ 2209,
694
+ 87482,
695
+ 28490,
696
+ 14591,
697
+ 70301,
698
+ 91029,
699
+ 90807,
700
+ 74788,
701
+ 68482,
702
+ 37611,
703
+ 15297,
704
+ 62563,
705
+ 59487,
706
+ 47095,
707
+ 67264,
708
+ 63078,
709
+ 40520,
710
+ 33555,
711
+ 18124,
712
+ 1678,
713
+ 88234,
714
+ 13958,
715
+ 27021,
716
+ 13544,
717
+ 57608,
718
+ 81353,
719
+ 81785,
720
+ 64860,
721
+ 7708,
722
+ 9143,
723
+ 9366,
724
+ 76781,
725
+ 51827,
726
+ 87629,
727
+ 40455,
728
+ 84072,
729
+ 7224,
730
+ 49524,
731
+ 18016,
732
+ 68911,
733
+ 71537,
734
+ 7207,
735
+ 23979,
736
+ 28366,
737
+ 80429,
738
+ 17705,
739
+ 17657,
740
+ 20278,
741
+ 55111,
742
+ 91874,
743
+ 99647,
744
+ 82400,
745
+ 66899,
746
+ 40858,
747
+ 87910,
748
+ 54519,
749
+ 33181,
750
+ 15907,
751
+ 26509,
752
+ 1702,
753
+ 5190,
754
+ 14305,
755
+ 96057,
756
+ 89065,
757
+ 65316,
758
+ 37989,
759
+ 53407,
760
+ 79703,
761
+ 37494,
762
+ 46065,
763
+ 65536,
764
+ 96393,
765
+ 36447,
766
+ 45812,
767
+ 88829,
768
+ 49190,
769
+ 49430,
770
+ 54540,
771
+ 96090,
772
+ 55284,
773
+ 63598,
774
+ 63059,
775
+ 69078,
776
+ 27801,
777
+ 66994,
778
+ 29261,
779
+ 60866,
780
+ 70611,
781
+ 6747,
782
+ 38134,
783
+ 86922,
784
+ 40672,
785
+ 19322,
786
+ 51545,
787
+ 35953,
788
+ 86611,
789
+ 5907,
790
+ 60819,
791
+ 44182,
792
+ 7388,
793
+ 76210,
794
+ 73752,
795
+ 18672,
796
+ 13205,
797
+ 36423,
798
+ 10400,
799
+ 62260,
800
+ 62690,
801
+ 98658,
802
+ 77575,
803
+ 50891,
804
+ 55349,
805
+ 16424,
806
+ 1618,
807
+ 51165,
808
+ 38135,
809
+ 35194,
810
+ 38412,
811
+ 22192,
812
+ 96906,
813
+ 50318,
814
+ 19300,
815
+ 41411,
816
+ 71158,
817
+ 638,
818
+ 57903,
819
+ 60659,
820
+ 329,
821
+ 41891,
822
+ 97441,
823
+ 18699,
824
+ 93087,
825
+ 56300,
826
+ 59594,
827
+ 74651,
828
+ 4680,
829
+ 21505,
830
+ 37996,
831
+ 96514,
832
+ 84878,
833
+ 21974,
834
+ 47520,
835
+ 301,
836
+ 28408,
837
+ 70978,
838
+ 48326,
839
+ 22243,
840
+ 7952,
841
+ 88939,
842
+ 36656,
843
+ 70636,
844
+ 57347,
845
+ 32199,
846
+ 89057,
847
+ 67554,
848
+ 53754,
849
+ 57646,
850
+ 37996,
851
+ 66181,
852
+ 53654,
853
+ 85595,
854
+ 88692,
855
+ 64331,
856
+ 91864,
857
+ 10914,
858
+ 82070,
859
+ 60825,
860
+ 1927,
861
+ 92361,
862
+ 66082,
863
+ 77494,
864
+ 94377,
865
+ 96529,
866
+ 88807,
867
+ 51196,
868
+ 55666,
869
+ 90825,
870
+ 77312,
871
+ 2279,
872
+ 32783,
873
+ 68228,
874
+ 19170,
875
+ 36062,
876
+ 38519,
877
+ 53159,
878
+ 17745,
879
+ 33858,
880
+ 10841,
881
+ 27185,
882
+ 76894,
883
+ 36642,
884
+ 73917,
885
+ 10228,
886
+ 7893,
887
+ 37231,
888
+ 13274,
889
+ 61549,
890
+ 43292,
891
+ 59764,
892
+ 79262,
893
+ 6777,
894
+ 64665,
895
+ 91246,
896
+ 43223,
897
+ 43330,
898
+ 37727,
899
+ 38088,
900
+ 68627,
901
+ 78509,
902
+ 24068,
903
+ 53926,
904
+ 57526,
905
+ 45247,
906
+ 86166,
907
+ 13774,
908
+ 11886,
909
+ 82584,
910
+ 78138,
911
+ 2070,
912
+ 20345,
913
+ 19377,
914
+ 74370,
915
+ 94565,
916
+ 8802,
917
+ 9934,
918
+ 40092,
919
+ 19034,
920
+ 43863,
921
+ 63531,
922
+ 74324,
923
+ 90720,
924
+ 84616,
925
+ 13947,
926
+ 18953,
927
+ 10971,
928
+ 40124,
929
+ 47764,
930
+ 21512,
931
+ 51855,
932
+ 93163,
933
+ 93537,
934
+ 48420,
935
+ 58795,
936
+ 70793,
937
+ 15406,
938
+ 64185,
939
+ 10269,
940
+ 97514,
941
+ 94056,
942
+ 6294,
943
+ 81886,
944
+ 62820,
945
+ 69194,
946
+ 4396,
947
+ 82523,
948
+ 19813,
949
+ 83426,
950
+ 94755,
951
+ 77451,
952
+ 33750,
953
+ 7196,
954
+ 52125,
955
+ 49081,
956
+ 4892,
957
+ 53507,
958
+ 82658,
959
+ 19517,
960
+ 30730,
961
+ 60257,
962
+ 82177,
963
+ 31750,
964
+ 9876,
965
+ 40391,
966
+ 70406,
967
+ 32192,
968
+ 61600,
969
+ 5132,
970
+ 46579,
971
+ 89452,
972
+ 40648,
973
+ 96364,
974
+ 53534,
975
+ 71857,
976
+ 39507,
977
+ 905,
978
+ 8471,
979
+ 13111,
980
+ 12125,
981
+ 14147,
982
+ 75894,
983
+ 42053,
984
+ 62717,
985
+ 36940,
986
+ 50594,
987
+ 50901,
988
+ 45227,
989
+ 26669,
990
+ 2633,
991
+ 41612,
992
+ 65779,
993
+ 17592,
994
+ 37429,
995
+ 24384,
996
+ 18717,
997
+ 14292,
998
+ 30803,
999
+ 40041,
1000
+ 95208,
1001
+ 91884,
1002
+ 12527,
1003
+ 72464,
1004
+ 80393,
1005
+ 988,
1006
+ 18941,
1007
+ 34197,
1008
+ 14541,
1009
+ 1709,
1010
+ 42299,
1011
+ 46355,
1012
+ 41995,
1013
+ 83214,
1014
+ 23682,
1015
+ 50805,
1016
+ 86339,
1017
+ 36149,
1018
+ 75794,
1019
+ 37412,
1020
+ 19184,
1021
+ 21949,
1022
+ 700,
1023
+ 66087,
1024
+ 49442,
1025
+ 96729,
1026
+ 94830,
1027
+ 65052,
1028
+ 68093,
1029
+ 43150,
1030
+ 19919,
1031
+ 9353,
1032
+ 12387,
1033
+ 44944,
1034
+ 75125,
1035
+ 82166,
1036
+ 85707,
1037
+ 91538,
1038
+ 39421,
1039
+ 79330,
1040
+ 48831,
1041
+ 39495,
1042
+ 44036,
1043
+ 21466,
1044
+ 41455,
1045
+ 52815,
1046
+ 43212,
1047
+ 72804,
1048
+ 58376,
1049
+ 68281,
1050
+ 31411,
1051
+ 20636,
1052
+ 57684,
1053
+ 53185,
1054
+ 15382,
1055
+ 73383,
1056
+ 64746,
1057
+ 44022,
1058
+ 47497,
1059
+ 76274,
1060
+ 96038,
1061
+ 54176,
1062
+ 72869,
1063
+ 58876,
1064
+ 38387,
1065
+ 11204,
1066
+ 40250,
1067
+ 47433,
1068
+ 83584,
1069
+ 22167,
1070
+ 25364,
1071
+ 90094,
1072
+ 19675,
1073
+ 84728,
1074
+ 30636,
1075
+ 89583,
1076
+ 6244,
1077
+ 70605,
1078
+ 81838,
1079
+ 73503,
1080
+ 46830,
1081
+ 70779,
1082
+ 80694,
1083
+ 40773,
1084
+ 41043,
1085
+ 7034,
1086
+ 84806,
1087
+ 66315,
1088
+ 45586,
1089
+ 60034,
1090
+ 10368,
1091
+ 36218,
1092
+ 83697,
1093
+ 88771,
1094
+ 34382,
1095
+ 78079,
1096
+ 14202,
1097
+ 13149,
1098
+ 15319,
1099
+ 27466,
1100
+ 40632,
1101
+ 61016,
1102
+ 69860,
1103
+ 72756,
1104
+ 42894,
1105
+ 95686,
1106
+ 8765,
1107
+ 31222
1108
+ ],
1109
+ "output": 166749
1110
+ },
1111
+ {
1112
+ "input": [
1113
+ 51869,
1114
+ 76872,
1115
+ 71438,
1116
+ 92190,
1117
+ 9550,
1118
+ 89065,
1119
+ 40629,
1120
+ 41068,
1121
+ 57474,
1122
+ 45987,
1123
+ 35992,
1124
+ 47570,
1125
+ 10130,
1126
+ 12426,
1127
+ 52908,
1128
+ 43666,
1129
+ 48032,
1130
+ 36253,
1131
+ 21873,
1132
+ 44893,
1133
+ 227,
1134
+ 11500,
1135
+ 85939,
1136
+ 78161,
1137
+ 34907,
1138
+ 84069,
1139
+ 10218,
1140
+ 27662,
1141
+ 35236,
1142
+ 89218,
1143
+ 22436,
1144
+ 60675,
1145
+ 11664,
1146
+ 83328,
1147
+ 88050,
1148
+ 6105,
1149
+ 17949,
1150
+ 31568,
1151
+ 8097,
1152
+ 7233,
1153
+ 50869,
1154
+ 82415,
1155
+ 63501,
1156
+ 90416,
1157
+ 32986,
1158
+ 85801,
1159
+ 97821,
1160
+ 48386,
1161
+ 20538,
1162
+ 2408,
1163
+ 32049,
1164
+ 86059,
1165
+ 15230,
1166
+ 15944,
1167
+ 98583,
1168
+ 83603,
1169
+ 74872,
1170
+ 71531,
1171
+ 13026,
1172
+ 64050,
1173
+ 48867,
1174
+ 72239,
1175
+ 23800,
1176
+ 14169,
1177
+ 23551,
1178
+ 10798,
1179
+ 23069,
1180
+ 76516,
1181
+ 68101,
1182
+ 79800,
1183
+ 32657,
1184
+ 29829,
1185
+ 25147,
1186
+ 17923,
1187
+ 38690,
1188
+ 8792,
1189
+ 96986,
1190
+ 91902,
1191
+ 94129,
1192
+ 73297,
1193
+ 72497,
1194
+ 60846,
1195
+ 1753,
1196
+ 99925,
1197
+ 96434,
1198
+ 74552,
1199
+ 76583,
1200
+ 31658,
1201
+ 19068,
1202
+ 35444,
1203
+ 71542,
1204
+ 83380,
1205
+ 47494,
1206
+ 89460,
1207
+ 58189,
1208
+ 33193,
1209
+ 58053,
1210
+ 14674,
1211
+ 84728,
1212
+ 80857,
1213
+ 65488,
1214
+ 26600,
1215
+ 93647,
1216
+ 68545,
1217
+ 54046,
1218
+ 26631,
1219
+ 92265,
1220
+ 67233,
1221
+ 42661,
1222
+ 49867,
1223
+ 15736,
1224
+ 2102,
1225
+ 8002,
1226
+ 61330,
1227
+ 76155,
1228
+ 26901,
1229
+ 72326,
1230
+ 77760,
1231
+ 54831,
1232
+ 90632,
1233
+ 42238,
1234
+ 51144,
1235
+ 69189,
1236
+ 22235,
1237
+ 23953,
1238
+ 21784,
1239
+ 73191,
1240
+ 60671,
1241
+ 4839,
1242
+ 69324,
1243
+ 33746,
1244
+ 13015,
1245
+ 54889,
1246
+ 47647,
1247
+ 56258,
1248
+ 85843,
1249
+ 77656,
1250
+ 71578,
1251
+ 71605,
1252
+ 65735,
1253
+ 89660,
1254
+ 68045,
1255
+ 44846,
1256
+ 985,
1257
+ 34149,
1258
+ 17138,
1259
+ 69522,
1260
+ 6480,
1261
+ 34878,
1262
+ 20000,
1263
+ 71938,
1264
+ 83332,
1265
+ 81533,
1266
+ 63129,
1267
+ 21679,
1268
+ 85316,
1269
+ 27,
1270
+ 58101,
1271
+ 28263,
1272
+ 69498,
1273
+ 2026,
1274
+ 40106,
1275
+ 34858,
1276
+ 34528,
1277
+ 52298,
1278
+ 40047,
1279
+ 18862,
1280
+ 32912,
1281
+ 98337,
1282
+ 18135,
1283
+ 37362,
1284
+ 8242,
1285
+ 61759,
1286
+ 29342,
1287
+ 58013,
1288
+ 20469,
1289
+ 84606,
1290
+ 35968,
1291
+ 17172,
1292
+ 6685,
1293
+ 33688,
1294
+ 87788,
1295
+ 93531,
1296
+ 68923,
1297
+ 74826,
1298
+ 8069,
1299
+ 38092,
1300
+ 83934,
1301
+ 8406,
1302
+ 21402,
1303
+ 86935,
1304
+ 34789,
1305
+ 14978,
1306
+ 44717,
1307
+ 66086,
1308
+ 81058,
1309
+ 21242,
1310
+ 651,
1311
+ 86265,
1312
+ 96535,
1313
+ 69064,
1314
+ 64625,
1315
+ 17522,
1316
+ 21415,
1317
+ 17422,
1318
+ 70141,
1319
+ 57761,
1320
+ 21879,
1321
+ 96955,
1322
+ 10729,
1323
+ 7682,
1324
+ 81381,
1325
+ 33054,
1326
+ 26685,
1327
+ 62228,
1328
+ 57585,
1329
+ 56290,
1330
+ 57431,
1331
+ 11517,
1332
+ 93911,
1333
+ 99125,
1334
+ 54938,
1335
+ 98434,
1336
+ 71000,
1337
+ 66809,
1338
+ 42981,
1339
+ 74096,
1340
+ 90617,
1341
+ 10267,
1342
+ 23531,
1343
+ 26345,
1344
+ 29313,
1345
+ 48650,
1346
+ 47089,
1347
+ 34490,
1348
+ 29737,
1349
+ 3401,
1350
+ 72495,
1351
+ 5650,
1352
+ 27950,
1353
+ 43725,
1354
+ 71758,
1355
+ 73068,
1356
+ 6527,
1357
+ 65882,
1358
+ 91124,
1359
+ 82704,
1360
+ 66821,
1361
+ 1185,
1362
+ 9895,
1363
+ 1737,
1364
+ 94582,
1365
+ 20932,
1366
+ 30841,
1367
+ 5426,
1368
+ 87057,
1369
+ 83773,
1370
+ 10242,
1371
+ 81924,
1372
+ 93460,
1373
+ 82214,
1374
+ 86165,
1375
+ 57737,
1376
+ 94599,
1377
+ 29387,
1378
+ 95097,
1379
+ 67997,
1380
+ 40303,
1381
+ 46520,
1382
+ 41369,
1383
+ 65466,
1384
+ 64514,
1385
+ 91447,
1386
+ 45386,
1387
+ 97558,
1388
+ 54229,
1389
+ 38763,
1390
+ 18597,
1391
+ 60018,
1392
+ 76088,
1393
+ 97192,
1394
+ 61886,
1395
+ 92528,
1396
+ 4614,
1397
+ 47072,
1398
+ 66699,
1399
+ 67034,
1400
+ 2784,
1401
+ 76997,
1402
+ 50207,
1403
+ 37677,
1404
+ 50388,
1405
+ 97013,
1406
+ 92911,
1407
+ 43473,
1408
+ 87487,
1409
+ 10025,
1410
+ 73680,
1411
+ 23551,
1412
+ 94830,
1413
+ 43389,
1414
+ 71288,
1415
+ 91268,
1416
+ 48165,
1417
+ 74007,
1418
+ 40129,
1419
+ 86140,
1420
+ 45451,
1421
+ 89308,
1422
+ 24718,
1423
+ 81229,
1424
+ 28399,
1425
+ 57816,
1426
+ 36690,
1427
+ 80938,
1428
+ 55650,
1429
+ 67917,
1430
+ 31840,
1431
+ 30277,
1432
+ 54879,
1433
+ 92373,
1434
+ 98101,
1435
+ 59128,
1436
+ 61714,
1437
+ 39370,
1438
+ 41906,
1439
+ 33120,
1440
+ 12184,
1441
+ 55932,
1442
+ 40029,
1443
+ 72890,
1444
+ 18076,
1445
+ 22938,
1446
+ 55599,
1447
+ 95029,
1448
+ 85309,
1449
+ 52944,
1450
+ 82584,
1451
+ 13284,
1452
+ 62167,
1453
+ 12467,
1454
+ 55814,
1455
+ 54668,
1456
+ 51418,
1457
+ 39111,
1458
+ 73149,
1459
+ 72587,
1460
+ 19192,
1461
+ 37043,
1462
+ 53841,
1463
+ 22283,
1464
+ 16035,
1465
+ 33046,
1466
+ 87845,
1467
+ 52730,
1468
+ 69819,
1469
+ 6075,
1470
+ 69258,
1471
+ 95912,
1472
+ 30124,
1473
+ 55001,
1474
+ 5402,
1475
+ 65654,
1476
+ 17722,
1477
+ 64577,
1478
+ 62267
1479
+ ],
1480
+ "output": 180020
1481
+ },
1482
+ {
1483
+ "input": [
1484
+ 85819,
1485
+ 57524,
1486
+ 67472,
1487
+ 96017,
1488
+ 94749,
1489
+ 74943,
1490
+ 9279,
1491
+ 88526,
1492
+ 32,
1493
+ 69933,
1494
+ 71137,
1495
+ 62964,
1496
+ 80714,
1497
+ 61858,
1498
+ 9434,
1499
+ 75908,
1500
+ 95785,
1501
+ 68452,
1502
+ 52898,
1503
+ 91585,
1504
+ 14462,
1505
+ 7420,
1506
+ 12108,
1507
+ 11527,
1508
+ 32345,
1509
+ 16873,
1510
+ 89007,
1511
+ 94831,
1512
+ 90120,
1513
+ 97675,
1514
+ 77799,
1515
+ 19883,
1516
+ 19200,
1517
+ 98977,
1518
+ 22406,
1519
+ 56138,
1520
+ 57252,
1521
+ 70818,
1522
+ 86320,
1523
+ 84110,
1524
+ 46761,
1525
+ 24388,
1526
+ 4171,
1527
+ 70925,
1528
+ 93907,
1529
+ 1837,
1530
+ 41625,
1531
+ 27118,
1532
+ 62687,
1533
+ 23216,
1534
+ 32292,
1535
+ 85764,
1536
+ 93133,
1537
+ 86691,
1538
+ 44539,
1539
+ 66006,
1540
+ 46016,
1541
+ 42710,
1542
+ 67482,
1543
+ 40023,
1544
+ 47949,
1545
+ 36166,
1546
+ 11083,
1547
+ 45107,
1548
+ 83826,
1549
+ 25051,
1550
+ 27909,
1551
+ 38401,
1552
+ 72628,
1553
+ 7145,
1554
+ 6269,
1555
+ 92652,
1556
+ 46089,
1557
+ 96361,
1558
+ 30562,
1559
+ 70625,
1560
+ 5300,
1561
+ 76809,
1562
+ 19756,
1563
+ 59708,
1564
+ 54907,
1565
+ 1627,
1566
+ 77180,
1567
+ 76381,
1568
+ 56002,
1569
+ 2551,
1570
+ 38246,
1571
+ 21336,
1572
+ 68458,
1573
+ 46252,
1574
+ 54817,
1575
+ 88680,
1576
+ 27483,
1577
+ 2093,
1578
+ 42078,
1579
+ 59165,
1580
+ 16204,
1581
+ 67931,
1582
+ 28413,
1583
+ 19485,
1584
+ 28035,
1585
+ 35783,
1586
+ 87279,
1587
+ 33760,
1588
+ 2045,
1589
+ 43157,
1590
+ 85813,
1591
+ 41778,
1592
+ 95093,
1593
+ 85776,
1594
+ 18114,
1595
+ 97737,
1596
+ 13303,
1597
+ 75094,
1598
+ 97281,
1599
+ 16498,
1600
+ 93909,
1601
+ 37643,
1602
+ 84240,
1603
+ 68667,
1604
+ 16991,
1605
+ 70500,
1606
+ 7385,
1607
+ 60269,
1608
+ 97454,
1609
+ 29326,
1610
+ 94025,
1611
+ 63782,
1612
+ 38052,
1613
+ 49540,
1614
+ 10868,
1615
+ 54902,
1616
+ 4988,
1617
+ 51910,
1618
+ 14657,
1619
+ 14938,
1620
+ 76843,
1621
+ 38097,
1622
+ 49596,
1623
+ 56993,
1624
+ 63727,
1625
+ 30414,
1626
+ 2572,
1627
+ 6137,
1628
+ 32420,
1629
+ 12577,
1630
+ 96999,
1631
+ 93014,
1632
+ 53942,
1633
+ 69315,
1634
+ 58199,
1635
+ 37255,
1636
+ 18375,
1637
+ 54081,
1638
+ 91290,
1639
+ 22609,
1640
+ 6842,
1641
+ 16918,
1642
+ 71351,
1643
+ 46609,
1644
+ 31929,
1645
+ 89400,
1646
+ 1993,
1647
+ 91250,
1648
+ 59227,
1649
+ 32065,
1650
+ 15347,
1651
+ 20484,
1652
+ 86308,
1653
+ 50923,
1654
+ 44648,
1655
+ 43756,
1656
+ 68586,
1657
+ 69559,
1658
+ 13845,
1659
+ 5835,
1660
+ 61208,
1661
+ 40854,
1662
+ 92599,
1663
+ 81452,
1664
+ 43584,
1665
+ 21018,
1666
+ 79955,
1667
+ 35160,
1668
+ 63281,
1669
+ 67545,
1670
+ 16735,
1671
+ 11220,
1672
+ 19126,
1673
+ 57525,
1674
+ 97149,
1675
+ 94587,
1676
+ 46908,
1677
+ 37620,
1678
+ 28988,
1679
+ 75624,
1680
+ 74351,
1681
+ 11923,
1682
+ 92867,
1683
+ 48535,
1684
+ 61485,
1685
+ 51034,
1686
+ 99814,
1687
+ 54604,
1688
+ 3293,
1689
+ 30930,
1690
+ 95905,
1691
+ 45278,
1692
+ 85359,
1693
+ 62031,
1694
+ 99563,
1695
+ 55161,
1696
+ 85039,
1697
+ 10717,
1698
+ 41098,
1699
+ 34523,
1700
+ 74455,
1701
+ 74438,
1702
+ 74814,
1703
+ 52944,
1704
+ 60178,
1705
+ 56627,
1706
+ 68731,
1707
+ 51697,
1708
+ 37903,
1709
+ 20145,
1710
+ 93336,
1711
+ 5040,
1712
+ 53163,
1713
+ 73683,
1714
+ 60799,
1715
+ 87001,
1716
+ 33455,
1717
+ 62702,
1718
+ 14010,
1719
+ 44870,
1720
+ 28838,
1721
+ 17667,
1722
+ 1663,
1723
+ 94004,
1724
+ 64936,
1725
+ 99893,
1726
+ 7620,
1727
+ 22159,
1728
+ 5453,
1729
+ 21995,
1730
+ 61858,
1731
+ 11294,
1732
+ 64677,
1733
+ 37538,
1734
+ 93154,
1735
+ 65811,
1736
+ 16625,
1737
+ 51865,
1738
+ 20944,
1739
+ 52964,
1740
+ 55758,
1741
+ 46613,
1742
+ 48471,
1743
+ 94548,
1744
+ 31978,
1745
+ 59427,
1746
+ 50628,
1747
+ 90549,
1748
+ 91316,
1749
+ 84918,
1750
+ 99057,
1751
+ 96266,
1752
+ 94191,
1753
+ 57466,
1754
+ 87265,
1755
+ 69167,
1756
+ 70460,
1757
+ 84562,
1758
+ 24306,
1759
+ 86152,
1760
+ 23483,
1761
+ 23412,
1762
+ 60673,
1763
+ 26751,
1764
+ 22086,
1765
+ 99448,
1766
+ 23981,
1767
+ 14864,
1768
+ 55606,
1769
+ 56632,
1770
+ 76297,
1771
+ 79332,
1772
+ 80268,
1773
+ 78028,
1774
+ 37174,
1775
+ 8736,
1776
+ 33913,
1777
+ 55328,
1778
+ 14816,
1779
+ 35196,
1780
+ 63911,
1781
+ 91240,
1782
+ 47356,
1783
+ 96085,
1784
+ 15734,
1785
+ 20003,
1786
+ 98832,
1787
+ 24111,
1788
+ 49334,
1789
+ 8828,
1790
+ 31295,
1791
+ 76056,
1792
+ 71618,
1793
+ 53369,
1794
+ 8967,
1795
+ 59110,
1796
+ 56024,
1797
+ 16999,
1798
+ 27871,
1799
+ 40634,
1800
+ 73582,
1801
+ 94206,
1802
+ 62950,
1803
+ 21530,
1804
+ 96573,
1805
+ 42104,
1806
+ 9007,
1807
+ 71879,
1808
+ 18850,
1809
+ 18476,
1810
+ 87885,
1811
+ 37004,
1812
+ 2154,
1813
+ 53191,
1814
+ 16386,
1815
+ 21586,
1816
+ 84780,
1817
+ 35593,
1818
+ 84437,
1819
+ 46921,
1820
+ 46179,
1821
+ 85172,
1822
+ 96352,
1823
+ 28586,
1824
+ 22980,
1825
+ 53267,
1826
+ 87861,
1827
+ 45404,
1828
+ 31528,
1829
+ 1075,
1830
+ 23153,
1831
+ 69384,
1832
+ 39249,
1833
+ 21166,
1834
+ 88322,
1835
+ 50843,
1836
+ 6648,
1837
+ 4244,
1838
+ 57045,
1839
+ 82490,
1840
+ 25320,
1841
+ 6299,
1842
+ 9337,
1843
+ 64235,
1844
+ 85921,
1845
+ 54613,
1846
+ 55316,
1847
+ 35699,
1848
+ 9577,
1849
+ 40169,
1850
+ 29763,
1851
+ 92937,
1852
+ 44289,
1853
+ 79322,
1854
+ 85169,
1855
+ 71813,
1856
+ 68135,
1857
+ 5386,
1858
+ 75039,
1859
+ 37667,
1860
+ 73374,
1861
+ 28254,
1862
+ 43072,
1863
+ 73343,
1864
+ 40502,
1865
+ 92572,
1866
+ 47440,
1867
+ 53947,
1868
+ 20702,
1869
+ 17315,
1870
+ 87289,
1871
+ 61731,
1872
+ 54167,
1873
+ 19128,
1874
+ 97148,
1875
+ 79889,
1876
+ 80618,
1877
+ 6366,
1878
+ 18375,
1879
+ 10530,
1880
+ 14395,
1881
+ 73559,
1882
+ 53481,
1883
+ 73810,
1884
+ 91365,
1885
+ 12933,
1886
+ 20099,
1887
+ 1783,
1888
+ 11904,
1889
+ 74293,
1890
+ 35364,
1891
+ 83179,
1892
+ 20742,
1893
+ 20406,
1894
+ 59984,
1895
+ 36489,
1896
+ 72384,
1897
+ 80864,
1898
+ 26720,
1899
+ 56633,
1900
+ 35806,
1901
+ 86671,
1902
+ 25276,
1903
+ 53049,
1904
+ 19967,
1905
+ 67615,
1906
+ 42214,
1907
+ 71190,
1908
+ 37126,
1909
+ 71653,
1910
+ 57011,
1911
+ 76781,
1912
+ 74856,
1913
+ 62086,
1914
+ 76708,
1915
+ 25117,
1916
+ 38639,
1917
+ 15649,
1918
+ 39958,
1919
+ 42697,
1920
+ 59550,
1921
+ 55638,
1922
+ 5399,
1923
+ 47733,
1924
+ 64702,
1925
+ 98646,
1926
+ 21513,
1927
+ 23401,
1928
+ 56358,
1929
+ 92883,
1930
+ 63214,
1931
+ 58143,
1932
+ 68827,
1933
+ 43672,
1934
+ 26406,
1935
+ 40026,
1936
+ 73956,
1937
+ 22509,
1938
+ 97495,
1939
+ 98215,
1940
+ 68560,
1941
+ 66237,
1942
+ 35136,
1943
+ 95803
1944
+ ],
1945
+ "output": 188878
1946
+ },
1947
+ {
1948
+ "input": [
1949
+ 79080,
1950
+ 49226,
1951
+ 66188,
1952
+ 38017,
1953
+ 85603,
1954
+ 77739,
1955
+ 30639,
1956
+ 93768,
1957
+ 18176,
1958
+ 71053,
1959
+ 62748,
1960
+ 88177,
1961
+ 58108,
1962
+ 11316,
1963
+ 2497,
1964
+ 10252,
1965
+ 37227,
1966
+ 43226,
1967
+ 64011,
1968
+ 94374,
1969
+ 45358,
1970
+ 1193,
1971
+ 97674,
1972
+ 1575,
1973
+ 18501,
1974
+ 49270,
1975
+ 46410,
1976
+ 26855,
1977
+ 23713,
1978
+ 70078,
1979
+ 13165,
1980
+ 77640,
1981
+ 68048,
1982
+ 46862,
1983
+ 12163,
1984
+ 42742,
1985
+ 21592,
1986
+ 8493,
1987
+ 64927,
1988
+ 9520,
1989
+ 66459,
1990
+ 17978,
1991
+ 36472,
1992
+ 78894,
1993
+ 44626,
1994
+ 58106,
1995
+ 18859,
1996
+ 50241,
1997
+ 60069,
1998
+ 93319,
1999
+ 38758,
2000
+ 51133,
2001
+ 36974,
2002
+ 92241,
2003
+ 16105,
2004
+ 39943,
2005
+ 71741,
2006
+ 9841,
2007
+ 85910,
2008
+ 84395,
2009
+ 97373,
2010
+ 24564,
2011
+ 31813,
2012
+ 23662,
2013
+ 50943,
2014
+ 5723,
2015
+ 12667,
2016
+ 14300,
2017
+ 54642,
2018
+ 52481,
2019
+ 52262,
2020
+ 63838,
2021
+ 66120,
2022
+ 35806,
2023
+ 82384,
2024
+ 83617,
2025
+ 13167,
2026
+ 73919,
2027
+ 79691,
2028
+ 85522,
2029
+ 71713,
2030
+ 78549,
2031
+ 84724,
2032
+ 87949,
2033
+ 57562,
2034
+ 27674,
2035
+ 59289,
2036
+ 79040,
2037
+ 56150,
2038
+ 60333,
2039
+ 87432,
2040
+ 45641,
2041
+ 65947,
2042
+ 1807,
2043
+ 49974,
2044
+ 56727,
2045
+ 98429,
2046
+ 36259,
2047
+ 70755,
2048
+ 94375,
2049
+ 22242,
2050
+ 54324,
2051
+ 62942,
2052
+ 82666,
2053
+ 21993,
2054
+ 45370,
2055
+ 57035,
2056
+ 13941,
2057
+ 98354,
2058
+ 55861,
2059
+ 24689,
2060
+ 58771,
2061
+ 50870,
2062
+ 9992,
2063
+ 68630,
2064
+ 59845,
2065
+ 52122,
2066
+ 51793,
2067
+ 32097,
2068
+ 21282,
2069
+ 39739,
2070
+ 55815,
2071
+ 98184,
2072
+ 57652,
2073
+ 57706,
2074
+ 18907,
2075
+ 51062,
2076
+ 54207,
2077
+ 71625,
2078
+ 29427,
2079
+ 92042,
2080
+ 40703,
2081
+ 89172,
2082
+ 9242,
2083
+ 42570,
2084
+ 96454,
2085
+ 29696,
2086
+ 87719,
2087
+ 34473,
2088
+ 90568,
2089
+ 19191,
2090
+ 39381,
2091
+ 2100,
2092
+ 30683,
2093
+ 56370,
2094
+ 83672,
2095
+ 15991,
2096
+ 94808,
2097
+ 54732,
2098
+ 35443,
2099
+ 73746,
2100
+ 45188,
2101
+ 26264,
2102
+ 66716,
2103
+ 40676,
2104
+ 19709,
2105
+ 63202,
2106
+ 32250,
2107
+ 67215,
2108
+ 87263,
2109
+ 18164,
2110
+ 16676,
2111
+ 27857,
2112
+ 68756,
2113
+ 29242,
2114
+ 84507,
2115
+ 86346,
2116
+ 43396,
2117
+ 1213,
2118
+ 86118,
2119
+ 62582,
2120
+ 2933,
2121
+ 29594,
2122
+ 59674,
2123
+ 95135,
2124
+ 44620,
2125
+ 16763,
2126
+ 9675,
2127
+ 52980,
2128
+ 19444,
2129
+ 58525,
2130
+ 62194,
2131
+ 18615,
2132
+ 98255,
2133
+ 25243,
2134
+ 73750,
2135
+ 77295,
2136
+ 61753,
2137
+ 61977,
2138
+ 87623,
2139
+ 57834,
2140
+ 67439,
2141
+ 10996,
2142
+ 16831,
2143
+ 4917,
2144
+ 73350,
2145
+ 73124,
2146
+ 45534,
2147
+ 85077,
2148
+ 82745,
2149
+ 84723,
2150
+ 23384,
2151
+ 77826,
2152
+ 55246,
2153
+ 16331,
2154
+ 49665,
2155
+ 39432,
2156
+ 39296,
2157
+ 89059,
2158
+ 60530,
2159
+ 55938,
2160
+ 77319,
2161
+ 12293,
2162
+ 12810,
2163
+ 12271,
2164
+ 12400,
2165
+ 21891,
2166
+ 48731,
2167
+ 11351,
2168
+ 9901,
2169
+ 40298,
2170
+ 77776,
2171
+ 46630,
2172
+ 70943,
2173
+ 54415,
2174
+ 14597,
2175
+ 67429,
2176
+ 35299,
2177
+ 66982,
2178
+ 49634,
2179
+ 9507,
2180
+ 1537,
2181
+ 30693,
2182
+ 60557,
2183
+ 56492,
2184
+ 87789,
2185
+ 20565,
2186
+ 40722,
2187
+ 88773,
2188
+ 35744,
2189
+ 19306,
2190
+ 48511,
2191
+ 22901,
2192
+ 64568,
2193
+ 37310,
2194
+ 67408,
2195
+ 34501,
2196
+ 39600,
2197
+ 21970,
2198
+ 23632,
2199
+ 33731,
2200
+ 38690,
2201
+ 54452,
2202
+ 23675,
2203
+ 43508,
2204
+ 63839,
2205
+ 26999,
2206
+ 83699,
2207
+ 77415,
2208
+ 36885,
2209
+ 21099,
2210
+ 37638,
2211
+ 44294,
2212
+ 51301,
2213
+ 21407,
2214
+ 35472,
2215
+ 22812,
2216
+ 19575,
2217
+ 82282,
2218
+ 92354,
2219
+ 83296,
2220
+ 60051,
2221
+ 60827,
2222
+ 10252,
2223
+ 97548,
2224
+ 86762,
2225
+ 90120,
2226
+ 54776,
2227
+ 10573,
2228
+ 60041,
2229
+ 8837,
2230
+ 15513,
2231
+ 75819,
2232
+ 97248,
2233
+ 41362,
2234
+ 19139,
2235
+ 76830,
2236
+ 80428,
2237
+ 86137,
2238
+ 83774,
2239
+ 65843,
2240
+ 42548,
2241
+ 96464,
2242
+ 1653,
2243
+ 94499,
2244
+ 97051,
2245
+ 31490,
2246
+ 26371,
2247
+ 98708,
2248
+ 57928,
2249
+ 56241,
2250
+ 76929,
2251
+ 17743,
2252
+ 81886,
2253
+ 97748,
2254
+ 61651,
2255
+ 1778,
2256
+ 14855,
2257
+ 48801,
2258
+ 65417,
2259
+ 38525,
2260
+ 27935,
2261
+ 62838,
2262
+ 53266,
2263
+ 69513,
2264
+ 8352,
2265
+ 65282,
2266
+ 91895,
2267
+ 9815,
2268
+ 19637,
2269
+ 84527,
2270
+ 23111,
2271
+ 99042,
2272
+ 4967,
2273
+ 1413,
2274
+ 76721,
2275
+ 30986,
2276
+ 79972,
2277
+ 89648,
2278
+ 50324,
2279
+ 30685,
2280
+ 15994,
2281
+ 46189,
2282
+ 42183,
2283
+ 49629,
2284
+ 14379,
2285
+ 40285,
2286
+ 36370,
2287
+ 57656,
2288
+ 19324,
2289
+ 30127,
2290
+ 32548,
2291
+ 34400,
2292
+ 46391,
2293
+ 96580,
2294
+ 641,
2295
+ 59260,
2296
+ 47331,
2297
+ 51899,
2298
+ 8201,
2299
+ 29975,
2300
+ 93104,
2301
+ 4508,
2302
+ 49506,
2303
+ 61078,
2304
+ 25173,
2305
+ 57897,
2306
+ 41701,
2307
+ 16604,
2308
+ 27960,
2309
+ 6174,
2310
+ 10887,
2311
+ 87478,
2312
+ 18519,
2313
+ 45351,
2314
+ 94664,
2315
+ 76025,
2316
+ 43593,
2317
+ 51037
2318
+ ],
2319
+ "output": 198246
2320
+ }
2321
+ ],
2322
+ "haskell_template": "minimumCoins :: [Int] -> Int\nminimumCoins prices ",
2323
+ "ocaml_template": "let minimumCoins (prices: int list) : int = ",
2324
+ "scala_template": "def minimumCoins(prices: List[Int]): Int = { \n \n}",
2325
+ "java_template": "class Solution {\n public int minimumCoins(int[] prices) {\n \n }\n}",
2326
+ "python_template": "class Solution(object):\n def minimumCoins(self, prices):\n \"\"\"\n :type prices: List[int]\n :rtype: int\n \"\"\"\n "
2327
+ }
minimum_number_of_coins_for_fruits/ocaml_tests/main.ml ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ module Main = struct
3
+ open OUnit2
4
+
5
+ (* Program start *)
6
+ let minimumCoins (prices: int list) : int = failwith "Not implemented"
7
+
8
+ (* Program end *)
9
+
10
+ (* Test cases *)
11
+
12
+ let test1 _ = assert_equal 4 (minimumCoins [3;1;2])
13
+
14
+ let test2 _ = assert_equal 2 (minimumCoins [1;10;1;1])
15
+
16
+ let test3 _ = assert_equal 39 (minimumCoins [26;18;6;12;49;7;45;45])
17
+
18
+ let test4 _ = assert_equal 39 (minimumCoins [25274; 21829; 95346; 28245; 24245; 37803; 38360; 16039; 31802; 23193; 33504; 97219; 16925; 70574; 13560; 7625; 82860; 76280; 96716; 73895; 22692; 51136; 87146; 65163; 51629; 44000; 20919; 25697; 77628; 21836; 24398; 54626; 26704; 28996; 75626; 49812; 14484; 90212; 29445; 28574; 66907; 74570; 89418; 32886; 32293; 6088; 55831; 21697; 38819; 74671; 47965; 11396; 66086; 16298; 21840; 85271; 75761; 9501; 95228; 19405; 23632; 24389; 24377; 62787; 96480; 57008; 84889; 54563; 46663; 15678; 50535; 72823; 2389; 77445; 32480; 90368; 15052; 43885; 35417; 24399; 26527; 56252; 53344; 97174; 14198; 55647; 31911; 55084; 97817; 176; 59785; 12706; 98256; 70328; 87691; 68884; 52055; 61581; 28214; 80709; 96084; 34913; 19845; 43427; 56047; 91419; 37292; 28720; 18420; 64021; 28012; 57830; 5738; 75211; 45206; 4045; 23675; 12586; 22254; 4665; 27040; 79391; 22283; 46279; 41200; 76915; 1176; 22144; 14147; 24175; 89960; 44127; 44437; 84993; 31304; 87132; 61776; 89137; 50126; 36772; 77920; 65015; 70168; 44093; 43002; 84834; 4751; 69070; 22323; 97538; 21920; 76721; 41462; 86518; 68262; 75616; 4607; 55684; 61921; 93969; 18161; 31598; 3124; 30911; 37361; 68210; 7329; 76304; 3770; 54397; 74791; 92941; 55638; 29337; 59087; 27593; 17671; 66290; 7105; 42309; 91197; 52966; 89293; 51785; 17079; 3369; 72463; 43418; 99070; 5560; 66924; 10423; 8102; 92488; 27378; 18189; 91738; 33005; 32280; 49365; 87150; 49628; 38591; 31944; 40121; 87860; 40269; 56710; 3281; 32381; 92163; 89701; 32387; 3807; 77778; 18988; 48548; 39641; 95800; 5179; 29904; 28267; 63162; 83210; 84095; 52268; 88162; 90863; 93578; 7550; 72386; 47560; 16251; 26075; 5196; 59010; 98520; 25039; 93383; 29945; 10287; 65817; 66536; 76113; 79093; 17575; 61324; 51883; 20694; 60603; 28450; 63310; 73433; 86161; 6785; 57728; 52602; 64516; 85688; 53199; 77800; 17631; 78309; 30500; 51212; 22004; 58234; 7996; 28086; 80252; 15692; 99887; 88585; 94936; 77129; 73452; 76823; 89339; 79384; 79277; 26511; 38364; 74974; 75977; 48064; 7543; 45588; 98664; 73282; 20401; 75286; 87778; 86337; 67886; 8907; 20380; 17677; 69449; 79567; 62464; 41909; 55384; 11362; 14807; 7294; 87880; 96017; 99971; 88796; 10323; 67695; 77267; 51342; 2682; 205; 64755; 27214; 65733; 85496; 23706; 88159; 28288; 98958; 76058; 78709; 71098; 54940; 97467; 45648; 21663; 20507; 75111; 78383; 55692; 39811; 20207; 98747; 6294; 59015; 11362; 26670; 49111; 72097; 87180; 34887; 97415; 86399; 93755; 12391; 78121; 49288; 89879; 75280; 77655; 38577; 54617; 31076; 75623; 62253; 29826; 4761; 30602; 22208; 72349; 8736; 34530; 47544; 81048; 39409; 3121; 75148; 71824; 85852; 26634; 22537; 14791; 13582; 32043; 3; 14194; 1509; 67020; 27193; 76831; 48821; 5791; 39372; 87427; 3266; 31240; 85126; 44559; 74066; 54239; 34138; 93964; 63328; 73840; 75331; 12796; 83605; 38516; 87981; 25519; 69524; 24068; 58527; 14034; 97772; 75690; 97292; 12094; 18063; 57660; 59622; 15009; 9947; 47798; 14709; 56415; 8481; 78315; 58717; 29398; 38564; 45851; 12726; 1148; 61644; 62166; 69410; 1682; 28420; 40121; 77581; 98494; 82847; 14444; 84529; 16546; 3163; 55333; 12656; 1980; 52693; 8546; 30411; 77251; 48376; 77286; 77690; 75453; 95132; 79815; 313; 11257; 68173; 69882; 82518; 4405; 90998; 85976; 55016; 70891; 87410; 87579; 332; 9433; 49780; 77044; 63658; 75626; 97957; 34844; 25115; 12789; 57294; 23840; 69431; 36106; 22662; 10300; 61423; 44506; 93224; 53515; 90565; 27916; 90476; 63726; 33299; 43574])
19
+
20
+ let test5 _ = assert_equal 39 (minimumCoins [87456; 62878; 2902; 19684; 18472; 71532; 47090; 95104; 93715; 7242; 12971; 42860; 52919; 24131; 30584; 70208; 97914; 47047; 90047; 47793; 53991; 59800; 41309; 66673; 58872; 5251; 11960; 56641; 62105; 78866; 64470; 61227; 17719; 77876; 68947; 20734; 66117; 45917; 68884; 65689; 38691; 29680; 96821; 27581; 62125; 59353; 64541; 49569; 9569; 76300; 60736; 65234; 81941; 98028; 64952; 65082; 91370; 92902; 88308; 74634; 22593; 1424; 83187; 95049; 54761; 31556; 85312; 30480; 47625; 37928; 12594; 50370; 91529; 93968; 75410; 25030; 87006; 10469; 72915; 9229; 23726; 9072; 84395; 10898; 81428; 41910; 69049; 90322; 41725; 23712; 56668; 95116; 85601; 19800; 37019; 45850; 88633; 99940; 11015; 93824; 17633; 41577; 74372; 79513; 32894; 52410; 53586; 88069; 72276; 20595; 57818; 20651; 23237; 13247; 22506; 96935; 38734; 19604; 67796; 20404; 59826; 10987; 67747; 54172; 41049; 55585; 99181; 3307; 36320; 23217; 38570; 24422; 89438; 74373; 48552; 77461; 27869; 85999; 23599; 63626; 43067; 80563; 10227; 735; 56578; 43862; 6553; 18750; 30742; 31466; 29422; 31765; 7203; 29625; 57602; 97387; 61988; 58919; 84463; 80096; 97805; 6694; 3299; 93698; 68681; 97520; 14321; 24095; 2209; 87482; 28490; 14591; 70301; 91029; 90807; 74788; 68482; 37611; 15297; 62563; 59487; 47095; 67264; 63078; 40520; 33555; 18124; 1678; 88234; 13958; 27021; 13544; 57608; 81353; 81785; 64860; 7708; 9143; 9366; 76781; 51827; 87629; 40455; 84072; 7224; 49524; 18016; 68911; 71537; 7207; 23979; 28366; 80429; 17705; 17657; 20278; 55111; 91874; 99647; 82400; 66899; 40858; 87910; 54519; 33181; 15907; 26509; 1702; 5190; 14305; 96057; 89065; 65316; 37989; 53407; 79703; 37494; 46065; 65536; 96393; 36447; 45812; 88829; 49190; 49430; 54540; 96090; 55284; 63598; 63059; 69078; 27801; 66994; 29261; 60866; 70611; 6747; 38134; 86922; 40672; 19322; 51545; 35953; 86611; 5907; 60819; 44182; 7388; 76210; 73752; 18672; 13205; 36423; 10400; 62260; 62690; 98658; 77575; 50891; 55349; 16424; 1618; 51165; 38135; 35194; 38412; 22192; 96906; 50318; 19300; 41411; 71158; 638; 57903; 60659; 329; 41891; 97441; 18699; 93087; 56300; 59594; 74651; 4680; 21505; 37996; 96514; 84878; 21974; 47520; 301; 28408; 70978; 48326; 22243; 7952; 88939; 36656; 70636; 57347; 32199; 89057; 67554; 53754; 57646; 37996; 66181; 53654; 85595; 88692; 64331; 91864; 10914; 82070; 60825; 1927; 92361; 66082; 77494; 94377; 96529; 88807; 51196; 55666; 90825; 77312; 2279; 32783; 68228; 19170; 36062; 38519; 53159; 17745; 33858; 10841; 27185; 76894; 36642; 73917; 10228; 7893; 37231; 13274; 61549; 43292; 59764; 79262; 6777; 64665; 91246; 43223; 43330; 37727; 38088; 68627; 78509; 24068; 53926; 57526; 45247; 86166; 13774; 11886; 82584; 78138; 2070; 20345; 19377; 74370; 94565; 8802; 9934; 40092; 19034; 43863; 63531; 74324; 90720; 84616; 13947; 18953; 10971; 40124; 47764; 21512; 51855; 93163; 93537; 48420; 58795; 70793; 15406; 64185; 10269; 97514; 94056; 6294; 81886; 62820; 69194; 4396; 82523; 19813; 83426; 94755; 77451; 33750; 7196; 52125; 49081; 4892; 53507; 82658; 19517; 30730; 60257; 82177; 31750; 9876; 40391; 70406; 32192; 61600; 5132; 46579; 89452; 40648; 96364; 53534; 71857; 39507; 905; 8471; 13111; 12125; 14147; 75894; 42053; 62717; 36940; 50594; 50901; 45227; 26669; 2633; 41612; 65779; 17592; 37429; 24384; 18717; 14292; 30803; 40041; 95208; 91884; 12527; 72464; 80393; 988; 18941; 34197; 14541; 1709; 42299; 46355; 41995; 83214; 23682; 50805; 86339; 36149; 75794; 37412; 19184; 21949; 700; 66087; 49442; 96729; 94830; 65052; 68093; 43150; 19919; 9353; 12387; 44944; 75125; 82166; 85707; 91538; 39421; 79330; 48831; 39495; 44036; 21466; 41455; 52815; 43212; 72804; 58376; 68281; 31411; 20636; 57684; 53185; 15382; 73383; 64746; 44022; 47497; 76274; 96038; 54176; 72869; 58876; 38387; 11204; 40250; 47433; 83584; 22167; 25364; 90094; 19675; 84728; 30636; 89583; 6244; 70605; 81838; 73503; 46830; 70779; 80694; 40773; 41043; 7034; 84806; 66315; 45586; 60034; 10368; 36218; 83697; 88771; 34382; 78079; 14202; 13149; 15319; 27466; 40632; 61016; 69860; 72756; 42894; 95686; 8765; 31222])
21
+
22
+ let test6 _ = assert_equal 39 (minimumCoins [51869; 76872; 71438; 92190; 9550; 89065; 40629; 41068; 57474; 45987; 35992; 47570; 10130; 12426; 52908; 43666; 48032; 36253; 21873; 44893; 227; 11500; 85939; 78161; 34907; 84069; 10218; 27662; 35236; 89218; 22436; 60675; 11664; 83328; 88050; 6105; 17949; 31568; 8097; 7233; 50869; 82415; 63501; 90416; 32986; 85801; 97821; 48386; 20538; 2408; 32049; 86059; 15230; 15944; 98583; 83603; 74872; 71531; 13026; 64050; 48867; 72239; 23800; 14169; 23551; 10798; 23069; 76516; 68101; 79800; 32657; 29829; 25147; 17923; 38690; 8792; 96986; 91902; 94129; 73297; 72497; 60846; 1753; 99925; 96434; 74552; 76583; 31658; 19068; 35444; 71542; 83380; 47494; 89460; 58189; 33193; 58053; 14674; 84728; 80857; 65488; 26600; 93647; 68545; 54046; 26631; 92265; 67233; 42661; 49867; 15736; 2102; 8002; 61330; 76155; 26901; 72326; 77760; 54831; 90632; 42238; 51144; 69189; 22235; 23953; 21784; 73191; 60671; 4839; 69324; 33746; 13015; 54889; 47647; 56258; 85843; 77656; 71578; 71605; 65735; 89660; 68045; 44846; 985; 34149; 17138; 69522; 6480; 34878; 20000; 71938; 83332; 81533; 63129; 21679; 85316; 27; 58101; 28263; 69498; 2026; 40106; 34858; 34528; 52298; 40047; 18862; 32912; 98337; 18135; 37362; 8242; 61759; 29342; 58013; 20469; 84606; 35968; 17172; 6685; 33688; 87788; 93531; 68923; 74826; 8069; 38092; 83934; 8406; 21402; 86935; 34789; 14978; 44717; 66086; 81058; 21242; 651; 86265; 96535; 69064; 64625; 17522; 21415; 17422; 70141; 57761; 21879; 96955; 10729; 7682; 81381; 33054; 26685; 62228; 57585; 56290; 57431; 11517; 93911; 99125; 54938; 98434; 71000; 66809; 42981; 74096; 90617; 10267; 23531; 26345; 29313; 48650; 47089; 34490; 29737; 3401; 72495; 5650; 27950; 43725; 71758; 73068; 6527; 65882; 91124; 82704; 66821; 1185; 9895; 1737; 94582; 20932; 30841; 5426; 87057; 83773; 10242; 81924; 93460; 82214; 86165; 57737; 94599; 29387; 95097; 67997; 40303; 46520; 41369; 65466; 64514; 91447; 45386; 97558; 54229; 38763; 18597; 60018; 76088; 97192; 61886; 92528; 4614; 47072; 66699; 67034; 2784; 76997; 50207; 37677; 50388; 97013; 92911; 43473; 87487; 10025; 73680; 23551; 94830; 43389; 71288; 91268; 48165; 74007; 40129; 86140; 45451; 89308; 24718; 81229; 28399; 57816; 36690; 80938; 55650; 67917; 31840; 30277; 54879; 92373; 98101; 59128; 61714; 39370; 41906; 33120; 12184; 55932; 40029; 72890; 18076; 22938; 55599; 95029; 85309; 52944; 82584; 13284; 62167; 12467; 55814; 54668; 51418; 39111; 73149; 72587; 19192; 37043; 53841; 22283; 16035; 33046; 87845; 52730; 69819; 6075; 69258; 95912; 30124; 55001; 5402; 65654; 17722; 64577; 62267])
23
+
24
+ let test7 _ = assert_equal 39 (minimumCoins [85819; 57524; 67472; 96017; 94749; 74943; 9279; 88526; 32; 69933; 71137; 62964; 80714; 61858; 9434; 75908; 95785; 68452; 52898; 91585; 14462; 7420; 12108; 11527; 32345; 16873; 89007; 94831; 90120; 97675; 77799; 19883; 19200; 98977; 22406; 56138; 57252; 70818; 86320; 84110; 46761; 24388; 4171; 70925; 93907; 1837; 41625; 27118; 62687; 23216; 32292; 85764; 93133; 86691; 44539; 66006; 46016; 42710; 67482; 40023; 47949; 36166; 11083; 45107; 83826; 25051; 27909; 38401; 72628; 7145; 6269; 92652; 46089; 96361; 30562; 70625; 5300; 76809; 19756; 59708; 54907; 1627; 77180; 76381; 56002; 2551; 38246; 21336; 68458; 46252; 54817; 88680; 27483; 2093; 42078; 59165; 16204; 67931; 28413; 19485; 28035; 35783; 87279; 33760; 2045; 43157; 85813; 41778; 95093; 85776; 18114; 97737; 13303; 75094; 97281; 16498; 93909; 37643; 84240; 68667; 16991; 70500; 7385; 60269; 97454; 29326; 94025; 63782; 38052; 49540; 10868; 54902; 4988; 51910; 14657; 14938; 76843; 38097; 49596; 56993; 63727; 30414; 2572; 6137; 32420; 12577; 96999; 93014; 53942; 69315; 58199; 37255; 18375; 54081; 91290; 22609; 6842; 16918; 71351; 46609; 31929; 89400; 1993; 91250; 59227; 32065; 15347; 20484; 86308; 50923; 44648; 43756; 68586; 69559; 13845; 5835; 61208; 40854; 92599; 81452; 43584; 21018; 79955; 35160; 63281; 67545; 16735; 11220; 19126; 57525; 97149; 94587; 46908; 37620; 28988; 75624; 74351; 11923; 92867; 48535; 61485; 51034; 99814; 54604; 3293; 30930; 95905; 45278; 85359; 62031; 99563; 55161; 85039; 10717; 41098; 34523; 74455; 74438; 74814; 52944; 60178; 56627; 68731; 51697; 37903; 20145; 93336; 5040; 53163; 73683; 60799; 87001; 33455; 62702; 14010; 44870; 28838; 17667; 1663; 94004; 64936; 99893; 7620; 22159; 5453; 21995; 61858; 11294; 64677; 37538; 93154; 65811; 16625; 51865; 20944; 52964; 55758; 46613; 48471; 94548; 31978; 59427; 50628; 90549; 91316; 84918; 99057; 96266; 94191; 57466; 87265; 69167; 70460; 84562; 24306; 86152; 23483; 23412; 60673; 26751; 22086; 99448; 23981; 14864; 55606; 56632; 76297; 79332; 80268; 78028; 37174; 8736; 33913; 55328; 14816; 35196; 63911; 91240; 47356; 96085; 15734; 20003; 98832; 24111; 49334; 8828; 31295; 76056; 71618; 53369; 8967; 59110; 56024; 16999; 27871; 40634; 73582; 94206; 62950; 21530; 96573; 42104; 9007; 71879; 18850; 18476; 87885; 37004; 2154; 53191; 16386; 21586; 84780; 35593; 84437; 46921; 46179; 85172; 96352; 28586; 22980; 53267; 87861; 45404; 31528; 1075; 23153; 69384; 39249; 21166; 88322; 50843; 6648; 4244; 57045; 82490; 25320; 6299; 9337; 64235; 85921; 54613; 55316; 35699; 9577; 40169; 29763; 92937; 44289; 79322; 85169; 71813; 68135; 5386; 75039; 37667; 73374; 28254; 43072; 73343; 40502; 92572; 47440; 53947; 20702; 17315; 87289; 61731; 54167; 19128; 97148; 79889; 80618; 6366; 18375; 10530; 14395; 73559; 53481; 73810; 91365; 12933; 20099; 1783; 11904; 74293; 35364; 83179; 20742; 20406; 59984; 36489; 72384; 80864; 26720; 56633; 35806; 86671; 25276; 53049; 19967; 67615; 42214; 71190; 37126; 71653; 57011; 76781; 74856; 62086; 76708; 25117; 38639; 15649; 39958; 42697; 59550; 55638; 5399; 47733; 64702; 98646; 21513; 23401; 56358; 92883; 63214; 58143; 68827; 43672; 26406; 40026; 73956; 22509; 97495; 98215; 68560; 66237; 35136; 95803])
25
+
26
+ let test8 _ = assert_equal 39 (minimumCoins [79080; 49226; 66188; 38017; 85603; 77739; 30639; 93768; 18176; 71053; 62748; 88177; 58108; 11316; 2497; 10252; 37227; 43226; 64011; 94374; 45358; 1193; 97674; 1575; 18501; 49270; 46410; 26855; 23713; 70078; 13165; 77640; 68048; 46862; 12163; 42742; 21592; 8493; 64927; 9520; 66459; 17978; 36472; 78894; 44626; 58106; 18859; 50241; 60069; 93319; 38758; 51133; 36974; 92241; 16105; 39943; 71741; 9841; 85910; 84395; 97373; 24564; 31813; 23662; 50943; 5723; 12667; 14300; 54642; 52481; 52262; 63838; 66120; 35806; 82384; 83617; 13167; 73919; 79691; 85522; 71713; 78549; 84724; 87949; 57562; 27674; 59289; 79040; 56150; 60333; 87432; 45641; 65947; 1807; 49974; 56727; 98429; 36259; 70755; 94375; 22242; 54324; 62942; 82666; 21993; 45370; 57035; 13941; 98354; 55861; 24689; 58771; 50870; 9992; 68630; 59845; 52122; 51793; 32097; 21282; 39739; 55815; 98184; 57652; 57706; 18907; 51062; 54207; 71625; 29427; 92042; 40703; 89172; 9242; 42570; 96454; 29696; 87719; 34473; 90568; 19191; 39381; 2100; 30683; 56370; 83672; 15991; 94808; 54732; 35443; 73746; 45188; 26264; 66716; 40676; 19709; 63202; 32250; 67215; 87263; 18164; 16676; 27857; 68756; 29242; 84507; 86346; 43396; 1213; 86118; 62582; 2933; 29594; 59674; 95135; 44620; 16763; 9675; 52980; 19444; 58525; 62194; 18615; 98255; 25243; 73750; 77295; 61753; 61977; 87623; 57834; 67439; 10996; 16831; 4917; 73350; 73124; 45534; 85077; 82745; 84723; 23384; 77826; 55246; 16331; 49665; 39432; 39296; 89059; 60530; 55938; 77319; 12293; 12810; 12271; 12400; 21891; 48731; 11351; 9901; 40298; 77776; 46630; 70943; 54415; 14597; 67429; 35299; 66982; 49634; 9507; 1537; 30693; 60557; 56492; 87789; 20565; 40722; 88773; 35744; 19306; 48511; 22901; 64568; 37310; 67408; 34501; 39600; 21970; 23632; 33731; 38690; 54452; 23675; 43508; 63839; 26999; 83699; 77415; 36885; 21099; 37638; 44294; 51301; 21407; 35472; 22812; 19575; 82282; 92354; 83296; 60051; 60827; 10252; 97548; 86762; 90120; 54776; 10573; 60041; 8837; 15513; 75819; 97248; 41362; 19139; 76830; 80428; 86137; 83774; 65843; 42548; 96464; 1653; 94499; 97051; 31490; 26371; 98708; 57928; 56241; 76929; 17743; 81886; 97748; 61651; 1778; 14855; 48801; 65417; 38525; 27935; 62838; 53266; 69513; 8352; 65282; 91895; 9815; 19637; 84527; 23111; 99042; 4967; 1413; 76721; 30986; 79972; 89648; 50324; 30685; 15994; 46189; 42183; 49629; 14379; 40285; 36370; 57656; 19324; 30127; 32548; 34400; 46391; 96580; 641; 59260; 47331; 51899; 8201; 29975; 93104; 4508; 49506; 61078; 25173; 57897; 41701; 16604; 27960; 6174; 10887; 87478; 18519; 45351; 94664; 76025; 43593; 51037])
27
+
28
+
29
+ (* Grouping test cases *)
30
+ let suite = "Test Suite for minimumCoins" >::: [
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
minimum_number_of_coins_for_fruits/scala_tests/MySuite.scala ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ class MySuite extends munit.FunSuite {
3
+
4
+ test("test1") {
5
+ assertEquals(Main.minimumCoins(List(3,1,2)), 4)
6
+ }
7
+
8
+ test("test2") {
9
+ assertEquals(Main.minimumCoins(List(1,10,1,1)), 2)
10
+ }
11
+
12
+ test("test3") {
13
+ assertEquals(Main.minimumCoins(List(26,18,6,12,49,7,45,45)), 39)
14
+ }
15
+
16
+ test("test4") {
17
+ assertEquals(Main.minimumCoins(25274,21829,95346,28245,24245,37803,38360,16039,31802,23193,33504,97219,16925,70574,13560,7625,82860,76280,96716,73895,22692,51136,87146,65163,51629,44000,20919,25697,77628,21836,24398,54626,26704,28996,75626,49812,14484,90212,29445,28574,66907,74570,89418,32886,32293,6088,55831,21697,38819,74671,47965,11396,66086,16298,21840,85271,75761,9501,95228,19405,23632,24389,24377,62787,96480,57008,84889,54563,46663,15678,50535,72823,2389,77445,32480,90368,15052,43885,35417,24399,26527,56252,53344,97174,14198,55647,31911,55084,97817,176,59785,12706,98256,70328,87691,68884,52055,61581,28214,80709,96084,34913,19845,43427,56047,91419,37292,28720,18420,64021,28012,57830,5738,75211,45206,4045,23675,12586,22254,4665,27040,79391,22283,46279,41200,76915,1176,22144,14147,24175,89960,44127,44437,84993,31304,87132,61776,89137,50126,36772,77920,65015,70168,44093,43002,84834,4751,69070,22323,97538,21920,76721,41462,86518,68262,75616,4607,55684,61921,93969,18161,31598,3124,30911,37361,68210,7329,76304,3770,54397,74791,92941,55638,29337,59087,27593,17671,66290,7105,42309,91197,52966,89293,51785,17079,3369,72463,43418,99070,5560,66924,10423,8102,92488,27378,18189,91738,33005,32280,49365,87150,49628,38591,31944,40121,87860,40269,56710,3281,32381,92163,89701,32387,3807,77778,18988,48548,39641,95800,5179,29904,28267,63162,83210,84095,52268,88162,90863,93578,7550,72386,47560,16251,26075,5196,59010,98520,25039,93383,29945,10287,65817,66536,76113,79093,17575,61324,51883,20694,60603,28450,63310,73433,86161,6785,57728,52602,64516,85688,53199,77800,17631,78309,30500,51212,22004,58234,7996,28086,80252,15692,99887,88585,94936,77129,73452,76823,89339,79384,79277,26511,38364,74974,75977,48064,7543,45588,98664,73282,20401,75286,87778,86337,67886,8907,20380,17677,69449,79567,62464,41909,55384,11362,14807,7294,87880,96017,99971,88796,10323,67695,77267,51342,2682,205,64755,27214,65733,85496,23706,88159,28288,98958,76058,78709,71098,54940,97467,45648,21663,20507,75111,78383,55692,39811,20207,98747,6294,59015,11362,26670,49111,72097,87180,34887,97415,86399,93755,12391,78121,49288,89879,75280,77655,38577,54617,31076,75623,62253,29826,4761,30602,22208,72349,8736,34530,47544,81048,39409,3121,75148,71824,85852,26634,22537,14791,13582,32043,3,14194,1509,67020,27193,76831,48821,5791,39372,87427,3266,31240,85126,44559,74066,54239,34138,93964,63328,73840,75331,12796,83605,38516,87981,25519,69524,24068,58527,14034,97772,75690,97292,12094,18063,57660,59622,15009,9947,47798,14709,56415,8481,78315,58717,29398,38564,45851,12726,1148,61644,62166,69410,1682,28420,40121,77581,98494,82847,14444,84529,16546,3163,55333,12656,1980,52693,8546,30411,77251,48376,77286,77690,75453,95132,79815,313,11257,68173,69882,82518,4405,90998,85976,55016,70891,87410,87579,332,9433,49780,77044,63658,75626,97957,34844,25115,12789,57294,23840,69431,36106,22662,10300,61423,44506,93224,53515,90565,27916,90476,63726,33299,43574), 125524)
18
+ }
19
+
20
+ test("test5") {
21
+ assertEquals(Main.minimumCoins(87456,62878,2902,19684,18472,71532,47090,95104,93715,7242,12971,42860,52919,24131,30584,70208,97914,47047,90047,47793,53991,59800,41309,66673,58872,5251,11960,56641,62105,78866,64470,61227,17719,77876,68947,20734,66117,45917,68884,65689,38691,29680,96821,27581,62125,59353,64541,49569,9569,76300,60736,65234,81941,98028,64952,65082,91370,92902,88308,74634,22593,1424,83187,95049,54761,31556,85312,30480,47625,37928,12594,50370,91529,93968,75410,25030,87006,10469,72915,9229,23726,9072,84395,10898,81428,41910,69049,90322,41725,23712,56668,95116,85601,19800,37019,45850,88633,99940,11015,93824,17633,41577,74372,79513,32894,52410,53586,88069,72276,20595,57818,20651,23237,13247,22506,96935,38734,19604,67796,20404,59826,10987,67747,54172,41049,55585,99181,3307,36320,23217,38570,24422,89438,74373,48552,77461,27869,85999,23599,63626,43067,80563,10227,735,56578,43862,6553,18750,30742,31466,29422,31765,7203,29625,57602,97387,61988,58919,84463,80096,97805,6694,3299,93698,68681,97520,14321,24095,2209,87482,28490,14591,70301,91029,90807,74788,68482,37611,15297,62563,59487,47095,67264,63078,40520,33555,18124,1678,88234,13958,27021,13544,57608,81353,81785,64860,7708,9143,9366,76781,51827,87629,40455,84072,7224,49524,18016,68911,71537,7207,23979,28366,80429,17705,17657,20278,55111,91874,99647,82400,66899,40858,87910,54519,33181,15907,26509,1702,5190,14305,96057,89065,65316,37989,53407,79703,37494,46065,65536,96393,36447,45812,88829,49190,49430,54540,96090,55284,63598,63059,69078,27801,66994,29261,60866,70611,6747,38134,86922,40672,19322,51545,35953,86611,5907,60819,44182,7388,76210,73752,18672,13205,36423,10400,62260,62690,98658,77575,50891,55349,16424,1618,51165,38135,35194,38412,22192,96906,50318,19300,41411,71158,638,57903,60659,329,41891,97441,18699,93087,56300,59594,74651,4680,21505,37996,96514,84878,21974,47520,301,28408,70978,48326,22243,7952,88939,36656,70636,57347,32199,89057,67554,53754,57646,37996,66181,53654,85595,88692,64331,91864,10914,82070,60825,1927,92361,66082,77494,94377,96529,88807,51196,55666,90825,77312,2279,32783,68228,19170,36062,38519,53159,17745,33858,10841,27185,76894,36642,73917,10228,7893,37231,13274,61549,43292,59764,79262,6777,64665,91246,43223,43330,37727,38088,68627,78509,24068,53926,57526,45247,86166,13774,11886,82584,78138,2070,20345,19377,74370,94565,8802,9934,40092,19034,43863,63531,74324,90720,84616,13947,18953,10971,40124,47764,21512,51855,93163,93537,48420,58795,70793,15406,64185,10269,97514,94056,6294,81886,62820,69194,4396,82523,19813,83426,94755,77451,33750,7196,52125,49081,4892,53507,82658,19517,30730,60257,82177,31750,9876,40391,70406,32192,61600,5132,46579,89452,40648,96364,53534,71857,39507,905,8471,13111,12125,14147,75894,42053,62717,36940,50594,50901,45227,26669,2633,41612,65779,17592,37429,24384,18717,14292,30803,40041,95208,91884,12527,72464,80393,988,18941,34197,14541,1709,42299,46355,41995,83214,23682,50805,86339,36149,75794,37412,19184,21949,700,66087,49442,96729,94830,65052,68093,43150,19919,9353,12387,44944,75125,82166,85707,91538,39421,79330,48831,39495,44036,21466,41455,52815,43212,72804,58376,68281,31411,20636,57684,53185,15382,73383,64746,44022,47497,76274,96038,54176,72869,58876,38387,11204,40250,47433,83584,22167,25364,90094,19675,84728,30636,89583,6244,70605,81838,73503,46830,70779,80694,40773,41043,7034,84806,66315,45586,60034,10368,36218,83697,88771,34382,78079,14202,13149,15319,27466,40632,61016,69860,72756,42894,95686,8765,31222), 166749)
22
+ }
23
+
24
+ test("test6") {
25
+ assertEquals(Main.minimumCoins(51869,76872,71438,92190,9550,89065,40629,41068,57474,45987,35992,47570,10130,12426,52908,43666,48032,36253,21873,44893,227,11500,85939,78161,34907,84069,10218,27662,35236,89218,22436,60675,11664,83328,88050,6105,17949,31568,8097,7233,50869,82415,63501,90416,32986,85801,97821,48386,20538,2408,32049,86059,15230,15944,98583,83603,74872,71531,13026,64050,48867,72239,23800,14169,23551,10798,23069,76516,68101,79800,32657,29829,25147,17923,38690,8792,96986,91902,94129,73297,72497,60846,1753,99925,96434,74552,76583,31658,19068,35444,71542,83380,47494,89460,58189,33193,58053,14674,84728,80857,65488,26600,93647,68545,54046,26631,92265,67233,42661,49867,15736,2102,8002,61330,76155,26901,72326,77760,54831,90632,42238,51144,69189,22235,23953,21784,73191,60671,4839,69324,33746,13015,54889,47647,56258,85843,77656,71578,71605,65735,89660,68045,44846,985,34149,17138,69522,6480,34878,20000,71938,83332,81533,63129,21679,85316,27,58101,28263,69498,2026,40106,34858,34528,52298,40047,18862,32912,98337,18135,37362,8242,61759,29342,58013,20469,84606,35968,17172,6685,33688,87788,93531,68923,74826,8069,38092,83934,8406,21402,86935,34789,14978,44717,66086,81058,21242,651,86265,96535,69064,64625,17522,21415,17422,70141,57761,21879,96955,10729,7682,81381,33054,26685,62228,57585,56290,57431,11517,93911,99125,54938,98434,71000,66809,42981,74096,90617,10267,23531,26345,29313,48650,47089,34490,29737,3401,72495,5650,27950,43725,71758,73068,6527,65882,91124,82704,66821,1185,9895,1737,94582,20932,30841,5426,87057,83773,10242,81924,93460,82214,86165,57737,94599,29387,95097,67997,40303,46520,41369,65466,64514,91447,45386,97558,54229,38763,18597,60018,76088,97192,61886,92528,4614,47072,66699,67034,2784,76997,50207,37677,50388,97013,92911,43473,87487,10025,73680,23551,94830,43389,71288,91268,48165,74007,40129,86140,45451,89308,24718,81229,28399,57816,36690,80938,55650,67917,31840,30277,54879,92373,98101,59128,61714,39370,41906,33120,12184,55932,40029,72890,18076,22938,55599,95029,85309,52944,82584,13284,62167,12467,55814,54668,51418,39111,73149,72587,19192,37043,53841,22283,16035,33046,87845,52730,69819,6075,69258,95912,30124,55001,5402,65654,17722,64577,62267), 180020)
26
+ }
27
+
28
+ test("test7") {
29
+ assertEquals(Main.minimumCoins(85819,57524,67472,96017,94749,74943,9279,88526,32,69933,71137,62964,80714,61858,9434,75908,95785,68452,52898,91585,14462,7420,12108,11527,32345,16873,89007,94831,90120,97675,77799,19883,19200,98977,22406,56138,57252,70818,86320,84110,46761,24388,4171,70925,93907,1837,41625,27118,62687,23216,32292,85764,93133,86691,44539,66006,46016,42710,67482,40023,47949,36166,11083,45107,83826,25051,27909,38401,72628,7145,6269,92652,46089,96361,30562,70625,5300,76809,19756,59708,54907,1627,77180,76381,56002,2551,38246,21336,68458,46252,54817,88680,27483,2093,42078,59165,16204,67931,28413,19485,28035,35783,87279,33760,2045,43157,85813,41778,95093,85776,18114,97737,13303,75094,97281,16498,93909,37643,84240,68667,16991,70500,7385,60269,97454,29326,94025,63782,38052,49540,10868,54902,4988,51910,14657,14938,76843,38097,49596,56993,63727,30414,2572,6137,32420,12577,96999,93014,53942,69315,58199,37255,18375,54081,91290,22609,6842,16918,71351,46609,31929,89400,1993,91250,59227,32065,15347,20484,86308,50923,44648,43756,68586,69559,13845,5835,61208,40854,92599,81452,43584,21018,79955,35160,63281,67545,16735,11220,19126,57525,97149,94587,46908,37620,28988,75624,74351,11923,92867,48535,61485,51034,99814,54604,3293,30930,95905,45278,85359,62031,99563,55161,85039,10717,41098,34523,74455,74438,74814,52944,60178,56627,68731,51697,37903,20145,93336,5040,53163,73683,60799,87001,33455,62702,14010,44870,28838,17667,1663,94004,64936,99893,7620,22159,5453,21995,61858,11294,64677,37538,93154,65811,16625,51865,20944,52964,55758,46613,48471,94548,31978,59427,50628,90549,91316,84918,99057,96266,94191,57466,87265,69167,70460,84562,24306,86152,23483,23412,60673,26751,22086,99448,23981,14864,55606,56632,76297,79332,80268,78028,37174,8736,33913,55328,14816,35196,63911,91240,47356,96085,15734,20003,98832,24111,49334,8828,31295,76056,71618,53369,8967,59110,56024,16999,27871,40634,73582,94206,62950,21530,96573,42104,9007,71879,18850,18476,87885,37004,2154,53191,16386,21586,84780,35593,84437,46921,46179,85172,96352,28586,22980,53267,87861,45404,31528,1075,23153,69384,39249,21166,88322,50843,6648,4244,57045,82490,25320,6299,9337,64235,85921,54613,55316,35699,9577,40169,29763,92937,44289,79322,85169,71813,68135,5386,75039,37667,73374,28254,43072,73343,40502,92572,47440,53947,20702,17315,87289,61731,54167,19128,97148,79889,80618,6366,18375,10530,14395,73559,53481,73810,91365,12933,20099,1783,11904,74293,35364,83179,20742,20406,59984,36489,72384,80864,26720,56633,35806,86671,25276,53049,19967,67615,42214,71190,37126,71653,57011,76781,74856,62086,76708,25117,38639,15649,39958,42697,59550,55638,5399,47733,64702,98646,21513,23401,56358,92883,63214,58143,68827,43672,26406,40026,73956,22509,97495,98215,68560,66237,35136,95803), 188878)
30
+ }
31
+
32
+ test("test8") {
33
+ assertEquals(Main.minimumCoins(79080,49226,66188,38017,85603,77739,30639,93768,18176,71053,62748,88177,58108,11316,2497,10252,37227,43226,64011,94374,45358,1193,97674,1575,18501,49270,46410,26855,23713,70078,13165,77640,68048,46862,12163,42742,21592,8493,64927,9520,66459,17978,36472,78894,44626,58106,18859,50241,60069,93319,38758,51133,36974,92241,16105,39943,71741,9841,85910,84395,97373,24564,31813,23662,50943,5723,12667,14300,54642,52481,52262,63838,66120,35806,82384,83617,13167,73919,79691,85522,71713,78549,84724,87949,57562,27674,59289,79040,56150,60333,87432,45641,65947,1807,49974,56727,98429,36259,70755,94375,22242,54324,62942,82666,21993,45370,57035,13941,98354,55861,24689,58771,50870,9992,68630,59845,52122,51793,32097,21282,39739,55815,98184,57652,57706,18907,51062,54207,71625,29427,92042,40703,89172,9242,42570,96454,29696,87719,34473,90568,19191,39381,2100,30683,56370,83672,15991,94808,54732,35443,73746,45188,26264,66716,40676,19709,63202,32250,67215,87263,18164,16676,27857,68756,29242,84507,86346,43396,1213,86118,62582,2933,29594,59674,95135,44620,16763,9675,52980,19444,58525,62194,18615,98255,25243,73750,77295,61753,61977,87623,57834,67439,10996,16831,4917,73350,73124,45534,85077,82745,84723,23384,77826,55246,16331,49665,39432,39296,89059,60530,55938,77319,12293,12810,12271,12400,21891,48731,11351,9901,40298,77776,46630,70943,54415,14597,67429,35299,66982,49634,9507,1537,30693,60557,56492,87789,20565,40722,88773,35744,19306,48511,22901,64568,37310,67408,34501,39600,21970,23632,33731,38690,54452,23675,43508,63839,26999,83699,77415,36885,21099,37638,44294,51301,21407,35472,22812,19575,82282,92354,83296,60051,60827,10252,97548,86762,90120,54776,10573,60041,8837,15513,75819,97248,41362,19139,76830,80428,86137,83774,65843,42548,96464,1653,94499,97051,31490,26371,98708,57928,56241,76929,17743,81886,97748,61651,1778,14855,48801,65417,38525,27935,62838,53266,69513,8352,65282,91895,9815,19637,84527,23111,99042,4967,1413,76721,30986,79972,89648,50324,30685,15994,46189,42183,49629,14379,40285,36370,57656,19324,30127,32548,34400,46391,96580,641,59260,47331,51899,8201,29975,93104,4508,49506,61078,25173,57897,41701,16604,27960,6174,10887,87478,18519,45351,94664,76025,43593,51037), 198246)
34
+ }
35
+
36
+ }
minimum_number_of_coins_to_be_added/haskell_tests/Main.hs ADDED
The diff for this file is too large to render. See raw diff
 
minimum_number_of_coins_to_be_added/java_tests/Main.java ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import static org.junit.jupiter.api.Assertions.*;
3
+ import org.junit.jupiter.api.Test;
4
+ import java.util.List;
5
+ import java.util.Arrays;
6
+ import java.util.ArrayList;
7
+ public class Main {
8
+ //Program start
9
+
10
+ //Program end
11
+
12
+ @Test
13
+ public void test1() {
14
+ assertEquals(2, minimumAddedCoins(new ArrayList<>(Arrays.asList(1,4,10)), 19));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals(1, minimumAddedCoins(new ArrayList<>(Arrays.asList(1,4,10,5,7,19)), 19));
19
+ }
20
+ @Test
21
+ public void test3() {
22
+ assertEquals(3, minimumAddedCoins(new ArrayList<>(Arrays.asList(1,1,1)), 20));
23
+ }
24
+
25
+ }
minimum_number_of_coins_to_be_added/meta.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b0dc9aa2c39c5ae73c8981c47268d6f1078dcbe59ce0a66001a42ea68abbfe99
3
+ size 15977404
minimum_number_of_coins_to_be_added/ocaml_tests/main.ml ADDED
The diff for this file is too large to render. See raw diff
 
minimum_number_of_coins_to_be_added/scala_tests/MySuite.scala ADDED
The diff for this file is too large to render. See raw diff
 
minimum_number_of_groups_to_create_a_valid_assignment/haskell_tests/Main.hs ADDED
The diff for this file is too large to render. See raw diff
 
minimum_number_of_groups_to_create_a_valid_assignment/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(2, minGroupsForValidAssignment(Arrays.asList(3,2,3,2,3)));
14
+ }
15
+ @Test
16
+ public void test2() {
17
+ assertEquals(4, minGroupsForValidAssignment(Arrays.asList(10,10,10,3,1,1)));
18
+ }
19
+
20
+ }
minimum_number_of_groups_to_create_a_valid_assignment/meta.json ADDED
The diff for this file is too large to render. See raw diff
 
minimum_number_of_groups_to_create_a_valid_assignment/ocaml_tests/main.ml ADDED
The diff for this file is too large to render. See raw diff
 
minimum_number_of_groups_to_create_a_valid_assignment/scala_tests/MySuite.scala ADDED
The diff for this file is too large to render. See raw diff
 
minimum_number_of_operations_to_convert_time/.DS_Store ADDED
Binary file (6.15 kB). View file
 
minimum_number_of_operations_to_convert_time/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 (convertTime \"02:30 \" \"04:35 \")," 3 (convertTime "02:30" "04:35"))
13
+
14
+ test2 :: Test
15
+ test2 = TestCase (assertEqual "for (convertTime \"11:00 \" \"11:01 \")," 1 (convertTime "11:00" "11:01"))
16
+
17
+
18
+ -- Grouping test cases
19
+ tests :: Test
20
+ tests = TestList [TestLabel "Test1" test1]
21
+
22
+ -- Running the tests
23
+ main :: IO Counts
24
+ main = runTestTT tests
minimum_number_of_operations_to_convert_time/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, convertTime("02:30", "04:35"));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals(1, convertTime("11:00", "11:01"));
19
+ }
20
+
21
+ }
minimum_number_of_operations_to_convert_time/meta.json ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "id": 2345,
3
+ "name": "minimum_number_of_operations_to_convert_time",
4
+ "difficulty": "Easy",
5
+ "link": "https://leetcode.com/problems/minimum-number-of-operations-to-convert-time/",
6
+ "date": "1648339200000",
7
+ "task_description": "You are given two strings `current` and `correct` representing two **24-hour times**. 24-hour times are formatted as `\"HH:MM\"`, where `HH` is between `00` and `23`, and `MM` is between `00` and `59`. The earliest 24-hour time is `00:00`, and the latest is `23:59`. In one operation you can increase the time `current` by `1`, `5`, `15`, or `60` minutes. You can perform this operation **any** number of times. Return _the **minimum number of operations** needed to convert _`current`_ to _`correct`. **Example 1:** ``` **Input:** current = \"02:30\", correct = \"04:35\" **Output:** 3 **Explanation: **We can convert current to correct in 3 operations as follows: - Add 60 minutes to current. current becomes \"03:30\". - Add 60 minutes to current. current becomes \"04:30\". - Add 5 minutes to current. current becomes \"04:35\". It can be proven that it is not possible to convert current to correct in fewer than 3 operations. ``` **Example 2:** ``` **Input:** current = \"11:00\", correct = \"11:01\" **Output:** 1 **Explanation:** We only have to add one minute to current, so the minimum number of operations needed is 1. ``` **Constraints:** `current` and `correct` are in the format `\"HH:MM\"` `current <= correct`",
8
+ "public_test_cases": [
9
+ {
10
+ "label": "Example 1",
11
+ "input": "current = \"02:30\", correct = \"04:35\"",
12
+ "output": "3 "
13
+ },
14
+ {
15
+ "label": "Example 2",
16
+ "input": "current = \"11:00\", correct = \"11:01\"",
17
+ "output": "1 "
18
+ }
19
+ ],
20
+ "private_test_cases": [
21
+ {
22
+ "input": [
23
+ "\"07:16\"",
24
+ "\"09:14\""
25
+ ],
26
+ "output": 9
27
+ },
28
+ {
29
+ "input": [
30
+ "\"22:58\"",
31
+ "\"23:22\""
32
+ ],
33
+ "output": 6
34
+ },
35
+ {
36
+ "input": [
37
+ "\"15:13\"",
38
+ "\"17:14\""
39
+ ],
40
+ "output": 3
41
+ },
42
+ {
43
+ "input": [
44
+ "\"13:15\"",
45
+ "\"17:22\""
46
+ ],
47
+ "output": 7
48
+ },
49
+ {
50
+ "input": [
51
+ "\"14:02\"",
52
+ "\"17:45\""
53
+ ],
54
+ "output": 10
55
+ },
56
+ {
57
+ "input": [
58
+ "\"05:30\"",
59
+ "\"20:53\""
60
+ ],
61
+ "output": 20
62
+ },
63
+ {
64
+ "input": [
65
+ "\"04:17\"",
66
+ "\"15:12\""
67
+ ],
68
+ "output": 15
69
+ },
70
+ {
71
+ "input": [
72
+ "14:30",
73
+ "14:47"
74
+ ],
75
+ "output": 3
76
+ },
77
+ {
78
+ "input": [
79
+ "16:15",
80
+ "22:13"
81
+ ],
82
+ "output": 13
83
+ },
84
+ {
85
+ "input": [
86
+ "23:54",
87
+ "23:58"
88
+ ],
89
+ "output": 4
90
+ }
91
+ ],
92
+ "haskell_template": "convertTime :: String -> String -> Int\nconvertTime current correct ",
93
+ "ocaml_template": "let convertTime (current: string) (correct: string) : int = ",
94
+ "scala_template": "def convertTime(current: String,correct: String): Int = { \n \n}",
95
+ "java_template": "public static int convertTime(String current, String correct) {\n\n}",
96
+ "python_template": "class Solution(object):\n def convertTime(self, current, correct):\n \"\"\"\n :type current: str\n :type correct: str\n :rtype: int\n \"\"\"\n "
97
+ }
minimum_number_of_operations_to_convert_time/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 (convertTime "02:30" "04:35")
12
+
13
+ let test2 _ = assert_equal 1 (convertTime "11:00" "11:01")
14
+
15
+
16
+ (* Grouping test cases *)
17
+ let suite = "Test Suite for convertTime" >::: [
18
+
19
+ "test1" >:: test1;
20
+ "test2" >:: test2;
21
+ ]
22
+
23
+
24
+ (* Running the tests *)
25
+ let () = run_test_tt_main suite
26
+ end
minimum_number_of_operations_to_convert_time/scala_tests/MySuite.scala ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ class MySuite extends munit.FunSuite {
3
+
4
+ test("test1") {
5
+ assertEquals(Main.convertTime("02:30","04:35"), 3)
6
+ }
7
+
8
+ test("test2") {
9
+ assertEquals(Main.convertTime("11:00","11:01"), 1)
10
+ }
11
+
12
+ }
minimum_number_of_operations_to_make_all_array_elements_equal_to_1/.DS_Store ADDED
Binary file (6.15 kB). View file
 
minimum_number_of_operations_to_make_all_array_elements_equal_to_1/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 (minOperations [2,6,3,4])," 4 (minOperations [2,6,3,4]))
13
+
14
+ test2 :: Test
15
+ test2 = TestCase (assertEqual "for (minOperations [2,10,6,14])," (-1) (minOperations [2,10,6,14]))
16
+
17
+
18
+ -- Grouping test cases
19
+ tests :: Test
20
+ tests = TestList [TestLabel "Test1" test1]
21
+
22
+ -- Running the tests
23
+ main :: IO Counts
24
+ main = runTestTT tests
minimum_number_of_operations_to_make_all_array_elements_equal_to_1/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, minOperations(new ArrayList<>(Arrays.asList(2,6,3,4))));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals(-1, minOperations(new ArrayList<>(Arrays.asList(2,10,6,14))));
19
+ }
20
+
21
+ }
minimum_number_of_operations_to_make_all_array_elements_equal_to_1/meta.json ADDED
@@ -0,0 +1,338 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "id": 2753,
3
+ "name": "minimum_number_of_operations_to_make_all_array_elements_equal_to_1",
4
+ "difficulty": "Medium",
5
+ "link": "https://leetcode.com/problems/minimum-number-of-operations-to-make-all-array-elements-equal-to-1/",
6
+ "date": "1681603200000",
7
+ "task_description": "You are given a **0-indexed** array `nums` consisiting of **positive** integers. You can do the following operation on the array **any** number of times: Select an index `i` such that `0 <= i < n - 1` and replace either of `nums[i]` or `nums[i+1]` with their gcd value. Return _the **minimum** number of operations to make all elements of _`nums`_ equal to _`1`. If it is impossible, return `-1`. The gcd of two integers is the greatest common divisor of the two integers. **Example 1:** ``` **Input:** nums = [2,6,3,4] **Output:** 4 **Explanation:** We can do the following operations: - Choose index i = 2 and replace nums[2] with gcd(3,4) = 1. Now we have nums = [2,6,1,4]. - Choose index i = 1 and replace nums[1] with gcd(6,1) = 1. Now we have nums = [2,1,1,4]. - Choose index i = 0 and replace nums[0] with gcd(2,1) = 1. Now we have nums = [1,1,1,4]. - Choose index i = 2 and replace nums[3] with gcd(1,4) = 1. Now we have nums = [1,1,1,1]. ``` **Example 2:** ``` **Input:** nums = [2,10,6,14] **Output:** -1 **Explanation:** It can be shown that it is impossible to make all the elements equal to 1. ``` **Constraints:** `2 <= nums.length <= 50` `1 <= nums[i] <= 106`",
8
+ "public_test_cases": [
9
+ {
10
+ "label": "Example 1",
11
+ "input": "nums = [2,6,3,4]",
12
+ "output": "4 "
13
+ },
14
+ {
15
+ "label": "Example 2",
16
+ "input": "nums = [2,10,6,14]",
17
+ "output": "-1 "
18
+ }
19
+ ],
20
+ "private_test_cases": [
21
+ {
22
+ "input": [
23
+ 141675,
24
+ 511608,
25
+ 149243,
26
+ 280842,
27
+ 334217,
28
+ 562189,
29
+ 317281,
30
+ 385001,
31
+ 870939,
32
+ 134786,
33
+ 480874,
34
+ 562085,
35
+ 294259,
36
+ 52998,
37
+ 115372,
38
+ 503728
39
+ ],
40
+ "output": 16
41
+ },
42
+ {
43
+ "input": [
44
+ 585067,
45
+ 478248,
46
+ 360455,
47
+ 810314
48
+ ],
49
+ "output": 4
50
+ },
51
+ {
52
+ "input": [
53
+ 473383,
54
+ 346442,
55
+ 725163,
56
+ 566672,
57
+ 616031,
58
+ 874533,
59
+ 495784,
60
+ 963595,
61
+ 691474,
62
+ 350576,
63
+ 479032,
64
+ 207002,
65
+ 608343,
66
+ 887318,
67
+ 593700,
68
+ 419959,
69
+ 481506,
70
+ 698521,
71
+ 25875,
72
+ 369616,
73
+ 534579,
74
+ 365898,
75
+ 649037,
76
+ 108933
77
+ ],
78
+ "output": 24
79
+ },
80
+ {
81
+ "input": [
82
+ 550651,
83
+ 658447,
84
+ 62953,
85
+ 149560,
86
+ 204631,
87
+ 347517,
88
+ 590132,
89
+ 981452,
90
+ 204943,
91
+ 392789,
92
+ 502656,
93
+ 546290,
94
+ 134148,
95
+ 893810,
96
+ 986538,
97
+ 283709,
98
+ 377752,
99
+ 775561,
100
+ 960187,
101
+ 587982,
102
+ 39355,
103
+ 128239,
104
+ 992774,
105
+ 909255,
106
+ 409225,
107
+ 995900,
108
+ 575901,
109
+ 59415,
110
+ 582830,
111
+ 665305,
112
+ 891406,
113
+ 567654,
114
+ 745714,
115
+ 771481,
116
+ 658514,
117
+ 203631,
118
+ 304418
119
+ ],
120
+ "output": 37
121
+ },
122
+ {
123
+ "input": [
124
+ 114287,
125
+ 304451,
126
+ 813694,
127
+ 101610,
128
+ 439759,
129
+ 573450,
130
+ 683066,
131
+ 215561,
132
+ 73224,
133
+ 337881,
134
+ 380758,
135
+ 248327,
136
+ 645784,
137
+ 342786,
138
+ 858091,
139
+ 151547,
140
+ 373050,
141
+ 460687,
142
+ 311099,
143
+ 321135,
144
+ 179738,
145
+ 612966,
146
+ 341883,
147
+ 970715,
148
+ 810627,
149
+ 936619,
150
+ 127404,
151
+ 392433,
152
+ 491067,
153
+ 280355,
154
+ 106032,
155
+ 21531,
156
+ 852242,
157
+ 938290,
158
+ 213934,
159
+ 254373,
160
+ 23533,
161
+ 69035,
162
+ 454127,
163
+ 184313,
164
+ 577002,
165
+ 787069,
166
+ 387496,
167
+ 325230,
168
+ 113187,
169
+ 183742
170
+ ],
171
+ "output": 46
172
+ },
173
+ {
174
+ "input": [
175
+ 762211,
176
+ 771096,
177
+ 739895,
178
+ 654301,
179
+ 186092,
180
+ 834557,
181
+ 211661,
182
+ 611512,
183
+ 42413,
184
+ 480404,
185
+ 483019,
186
+ 977791,
187
+ 451322,
188
+ 687802,
189
+ 248082
190
+ ],
191
+ "output": 15
192
+ },
193
+ {
194
+ "input": [
195
+ 604419,
196
+ 993319
197
+ ],
198
+ "output": 2
199
+ },
200
+ {
201
+ "input": [
202
+ 67929,
203
+ 379145,
204
+ 924873,
205
+ 830307,
206
+ 530070,
207
+ 239920,
208
+ 100076,
209
+ 411885,
210
+ 649333,
211
+ 132958,
212
+ 820378,
213
+ 637671,
214
+ 253685,
215
+ 645041,
216
+ 253791,
217
+ 368434,
218
+ 102598,
219
+ 468251,
220
+ 243249,
221
+ 68866,
222
+ 851651,
223
+ 99122,
224
+ 747267,
225
+ 600537,
226
+ 996073,
227
+ 838595,
228
+ 272893,
229
+ 211624,
230
+ 196371,
231
+ 59123,
232
+ 613897,
233
+ 828867,
234
+ 293485,
235
+ 858296,
236
+ 276301,
237
+ 753012,
238
+ 791914,
239
+ 915051,
240
+ 378586,
241
+ 98949,
242
+ 510624,
243
+ 670494,
244
+ 355265,
245
+ 711266,
246
+ 602048,
247
+ 135616
248
+ ],
249
+ "output": 46
250
+ },
251
+ {
252
+ "input": [
253
+ 772569,
254
+ 814699,
255
+ 836393,
256
+ 249875,
257
+ 592581,
258
+ 700278,
259
+ 189856,
260
+ 433611,
261
+ 79841,
262
+ 993119,
263
+ 528525,
264
+ 4789,
265
+ 939399,
266
+ 584617,
267
+ 42124,
268
+ 413941,
269
+ 662728,
270
+ 358887,
271
+ 420966,
272
+ 672596,
273
+ 181319,
274
+ 409613,
275
+ 40678,
276
+ 154813,
277
+ 701765,
278
+ 632418,
279
+ 470872,
280
+ 628274,
281
+ 106599,
282
+ 175782,
283
+ 5540,
284
+ 685270,
285
+ 478971,
286
+ 947105,
287
+ 298480,
288
+ 158273,
289
+ 879921
290
+ ],
291
+ "output": 37
292
+ },
293
+ {
294
+ "input": [
295
+ 561922,
296
+ 503595,
297
+ 204248,
298
+ 996972,
299
+ 612501,
300
+ 465721,
301
+ 633650,
302
+ 63287,
303
+ 467497,
304
+ 897323,
305
+ 934516,
306
+ 443603,
307
+ 518984,
308
+ 171173,
309
+ 746891,
310
+ 330469,
311
+ 119276,
312
+ 298889,
313
+ 539131,
314
+ 290768,
315
+ 646516,
316
+ 679055,
317
+ 717678,
318
+ 88690,
319
+ 554011,
320
+ 561741,
321
+ 197323,
322
+ 886981,
323
+ 352776,
324
+ 554404,
325
+ 632187,
326
+ 45071,
327
+ 805536,
328
+ 378506
329
+ ],
330
+ "output": 34
331
+ }
332
+ ],
333
+ "haskell_template": "minOperations :: [Int] -> Int\nminOperations nums ",
334
+ "ocaml_template": "let minOperations (nums: int list) : int = ",
335
+ "scala_template": "def minOperations(nums: List[Int]): Int = { \n \n}",
336
+ "java_template": "public static int minOperations(List<Integer> nums) {\n\n}",
337
+ "python_template": "class Solution(object):\n def minOperations(self, nums):\n \"\"\"\n :type nums: List[int]\n :rtype: int\n \"\"\"\n "
338
+ }
minimum_number_of_operations_to_make_all_array_elements_equal_to_1/ocaml_tests/main.ml ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ module Main = struct
3
+ open OUnit2
4
+
5
+ (* Program start *)
6
+
7
+ (* Program end *)
8
+
9
+ (* Test cases *)
10
+
11
+ let test1 _ = assert_equal 4 (minOperations [2;6;3;4])
12
+
13
+ let test2 _ = assert_equal (-1) (minOperations [2;10;6;14])
14
+
15
+
16
+ (* Grouping test cases *)
17
+ let suite = "Test Suite for minOperations" >::: [
18
+
19
+ "test1" >:: test1;
20
+ "test2" >:: test2;
21
+ ]
22
+
23
+
24
+ (* Running the tests *)
25
+ let () = run_test_tt_main suite
26
+ end
minimum_number_of_operations_to_make_all_array_elements_equal_to_1/scala_tests/MySuite.scala ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ class MySuite extends munit.FunSuite {
3
+
4
+ test("test1") {
5
+ assertEquals(Main.minOperations(List(2,6,3,4)), 4)
6
+ }
7
+
8
+ test("test2") {
9
+ assertEquals(Main.minOperations(List(2,10,6,14)), -1)
10
+ }
11
+
12
+ }
minimum_number_of_operations_to_make_array_empty/haskell_tests/Main.hs ADDED
The diff for this file is too large to render. See raw diff
 
minimum_number_of_operations_to_make_array_empty/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(4, minOperations(Arrays.asList(2,3,3,2,2,4,2,3,4)));
14
+ }
15
+ @Test
16
+ public void test2() {
17
+ assertEquals(-1, minOperations(Arrays.asList(2,1,2,2,3,3)));
18
+ }
19
+
20
+ }