DataRepo DatasetRepo commited on
Commit
f7c0146
·
verified ·
0 Parent(s):

Duplicate from FPEvalDataset/LeetCodeProblem

Browse files

Co-authored-by: Public <DatasetRepo@users.noreply.huggingface.co>

This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .DS_Store +3 -0
  2. .gitattributes +299 -0
  3. add_edges_to_make_degrees_of_all_nodes_even/.DS_Store +0 -0
  4. add_edges_to_make_degrees_of_all_nodes_even/haskell_tests/Main.hs +27 -0
  5. add_edges_to_make_degrees_of_all_nodes_even/java_tests/Main.java +25 -0
  6. add_edges_to_make_degrees_of_all_nodes_even/meta.json +3 -0
  7. add_edges_to_make_degrees_of_all_nodes_even/ocaml_tests/main.ml +29 -0
  8. add_edges_to_make_degrees_of_all_nodes_even/scala_tests/MySuite.scala +16 -0
  9. adjacent_increasing_subarrays_detection_i/haskell_tests/Main.hs +45 -0
  10. adjacent_increasing_subarrays_detection_i/java_tests/Main.java +21 -0
  11. adjacent_increasing_subarrays_detection_i/meta.json +603 -0
  12. adjacent_increasing_subarrays_detection_i/ocaml_tests/main.ml +50 -0
  13. adjacent_increasing_subarrays_detection_i/scala_tests/MySuite.scala +44 -0
  14. alice_and_bob_playing_flower_game/haskell_tests/Main.hs +45 -0
  15. alice_and_bob_playing_flower_game/java_tests/Main.java +21 -0
  16. alice_and_bob_playing_flower_game/meta.json +97 -0
  17. alice_and_bob_playing_flower_game/ocaml_tests/main.ml +50 -0
  18. alice_and_bob_playing_flower_game/scala_tests/MySuite.scala +44 -0
  19. all_divisions_with_the_highest_score_of_a_binary_array/.DS_Store +0 -0
  20. all_divisions_with_the_highest_score_of_a_binary_array/haskell_tests/Main.hs +27 -0
  21. all_divisions_with_the_highest_score_of_a_binary_array/java_tests/Main.java +25 -0
  22. all_divisions_with_the_highest_score_of_a_binary_array/meta.json +3 -0
  23. all_divisions_with_the_highest_score_of_a_binary_array/ocaml_tests/main.ml +29 -0
  24. all_divisions_with_the_highest_score_of_a_binary_array/scala_tests/MySuite.scala +16 -0
  25. alternating_groups_i/haskell_tests/Main.hs +41 -0
  26. alternating_groups_i/java_tests/Main.java +20 -0
  27. alternating_groups_i/meta.json +333 -0
  28. alternating_groups_i/ocaml_tests/main.ml +42 -0
  29. alternating_groups_i/scala_tests/MySuite.scala +32 -0
  30. alternating_groups_ii/haskell_tests/Main.hs +0 -0
  31. alternating_groups_ii/java_tests/Main.java +25 -0
  32. alternating_groups_ii/meta.json +0 -0
  33. alternating_groups_ii/ocaml_tests/main.ml +0 -0
  34. alternating_groups_ii/scala_tests/MySuite.scala +0 -0
  35. alternating_groups_iii/haskell_tests/Main.hs +0 -0
  36. alternating_groups_iii/java_tests/Main.java +21 -0
  37. alternating_groups_iii/meta.json +3 -0
  38. alternating_groups_iii/ocaml_tests/main.ml +0 -0
  39. alternating_groups_iii/scala_tests/MySuite.scala +0 -0
  40. ant_on_the_boundary/haskell_tests/Main.hs +41 -0
  41. ant_on_the_boundary/java_tests/Main.java +20 -0
  42. ant_on_the_boundary/meta.json +165 -0
  43. ant_on_the_boundary/ocaml_tests/main.ml +42 -0
  44. ant_on_the_boundary/scala_tests/MySuite.scala +32 -0
  45. append_characters_to_string_to_make_subsequence/.DS_Store +0 -0
  46. append_characters_to_string_to_make_subsequence/haskell_tests/Main.hs +27 -0
  47. append_characters_to_string_to_make_subsequence/java_tests/Main.java +25 -0
  48. append_characters_to_string_to_make_subsequence/meta.json +0 -0
  49. append_characters_to_string_to_make_subsequence/ocaml_tests/main.ml +29 -0
  50. append_characters_to_string_to_make_subsequence/scala_tests/MySuite.scala +16 -0
.DS_Store ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:581110d059fa11e94ed9c16751b5904eef8afbb72f4a3b7ac783ffde1153c3d1
3
+ size 358404
.gitattributes ADDED
@@ -0,0 +1,299 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.lz4 filter=lfs diff=lfs merge=lfs -text
12
+ *.mds filter=lfs diff=lfs merge=lfs -text
13
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
14
+ *.model filter=lfs diff=lfs merge=lfs -text
15
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
16
+ *.npy filter=lfs diff=lfs merge=lfs -text
17
+ *.npz filter=lfs diff=lfs merge=lfs -text
18
+ *.onnx filter=lfs diff=lfs merge=lfs -text
19
+ *.ot filter=lfs diff=lfs merge=lfs -text
20
+ *.parquet filter=lfs diff=lfs merge=lfs -text
21
+ *.pb filter=lfs diff=lfs merge=lfs -text
22
+ *.pickle filter=lfs diff=lfs merge=lfs -text
23
+ *.pkl filter=lfs diff=lfs merge=lfs -text
24
+ *.pt filter=lfs diff=lfs merge=lfs -text
25
+ *.pth filter=lfs diff=lfs merge=lfs -text
26
+ *.rar filter=lfs diff=lfs merge=lfs -text
27
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
28
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
29
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
30
+ *.tar filter=lfs diff=lfs merge=lfs -text
31
+ *.tflite filter=lfs diff=lfs merge=lfs -text
32
+ *.tgz filter=lfs diff=lfs merge=lfs -text
33
+ *.wasm filter=lfs diff=lfs merge=lfs -text
34
+ *.xz filter=lfs diff=lfs merge=lfs -text
35
+ *.zip filter=lfs diff=lfs merge=lfs -text
36
+ *.zst filter=lfs diff=lfs merge=lfs -text
37
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
38
+ # Audio files - uncompressed
39
+ *.pcm filter=lfs diff=lfs merge=lfs -text
40
+ *.sam filter=lfs diff=lfs merge=lfs -text
41
+ *.raw filter=lfs diff=lfs merge=lfs -text
42
+ # Audio files - compressed
43
+ *.aac filter=lfs diff=lfs merge=lfs -text
44
+ *.flac filter=lfs diff=lfs merge=lfs -text
45
+ *.mp3 filter=lfs diff=lfs merge=lfs -text
46
+ *.ogg filter=lfs diff=lfs merge=lfs -text
47
+ *.wav filter=lfs diff=lfs merge=lfs -text
48
+ # Image files - uncompressed
49
+ *.bmp filter=lfs diff=lfs merge=lfs -text
50
+ *.gif filter=lfs diff=lfs merge=lfs -text
51
+ *.png filter=lfs diff=lfs merge=lfs -text
52
+ *.tiff filter=lfs diff=lfs merge=lfs -text
53
+ # Image files - compressed
54
+ *.jpg filter=lfs diff=lfs merge=lfs -text
55
+ *.jpeg filter=lfs diff=lfs merge=lfs -text
56
+ *.webp filter=lfs diff=lfs merge=lfs -text
57
+ # Video files - compressed
58
+ *.mp4 filter=lfs diff=lfs merge=lfs -text
59
+ *.webm filter=lfs diff=lfs merge=lfs -text
60
+ .DS_Store filter=lfs diff=lfs merge=lfs -text
61
+ add_edges_to_make_degrees_of_all_nodes_even/meta.json filter=lfs diff=lfs merge=lfs -text
62
+ all_divisions_with_the_highest_score_of_a_binary_array/meta.json filter=lfs diff=lfs merge=lfs -text
63
+ alternating_groups_iii/meta.json filter=lfs diff=lfs merge=lfs -text
64
+ append_k_integers_with_minimal_sum/meta.json filter=lfs diff=lfs merge=lfs -text
65
+ apply_operations_on_array_to_maximize_sum_of_squares/meta.json filter=lfs diff=lfs merge=lfs -text
66
+ apply_operations_to_maximize_frequency_score/meta.json filter=lfs diff=lfs merge=lfs -text
67
+ apply_operations_to_maximize_score/meta.json filter=lfs diff=lfs merge=lfs -text
68
+ assign_elements_to_groups_with_constraints/haskell_tests/Main.hs filter=lfs diff=lfs merge=lfs -text
69
+ assign_elements_to_groups_with_constraints/meta.json filter=lfs diff=lfs merge=lfs -text
70
+ check_if_grid_can_be_cut_into_sections/haskell_tests/Main.hs filter=lfs diff=lfs merge=lfs -text
71
+ check_if_grid_can_be_cut_into_sections/meta.json filter=lfs diff=lfs merge=lfs -text
72
+ check_if_grid_can_be_cut_into_sections/ocaml_tests/main.ml filter=lfs diff=lfs merge=lfs -text
73
+ check_if_grid_can_be_cut_into_sections/scala_tests/MySuite.scala filter=lfs diff=lfs merge=lfs -text
74
+ closest_equal_element_queries/meta.json filter=lfs diff=lfs merge=lfs -text
75
+ collect_coins_in_a_tree/meta.json filter=lfs diff=lfs merge=lfs -text
76
+ count_array_pairs_divisible_by_k/meta.json filter=lfs diff=lfs merge=lfs -text
77
+ count_connected_components_in_lcm_graph/meta.json filter=lfs diff=lfs merge=lfs -text
78
+ count_days_without_meetings/meta.json filter=lfs diff=lfs merge=lfs -text
79
+ count_good_triplets_in_an_array/meta.json filter=lfs diff=lfs merge=lfs -text
80
+ count_non_decreasing_subarrays_after_k_operations/meta.json filter=lfs diff=lfs merge=lfs -text
81
+ count_number_of_bad_pairs/meta.json filter=lfs diff=lfs merge=lfs -text
82
+ count_of_interesting_subarrays/meta.json filter=lfs diff=lfs merge=lfs -text
83
+ count_pairs_of_points_with_distance_k/meta.json filter=lfs diff=lfs merge=lfs -text
84
+ count_subarrays_where_max_element_appears_at_least_k_times/meta.json filter=lfs diff=lfs merge=lfs -text
85
+ count_subarrays_with_score_less_than_k/meta.json filter=lfs diff=lfs merge=lfs -text
86
+ count_submatrices_with_equal_frequency_of_x_and_y/haskell_tests/Main.hs filter=lfs diff=lfs merge=lfs -text
87
+ count_submatrices_with_equal_frequency_of_x_and_y/meta.json filter=lfs diff=lfs merge=lfs -text
88
+ count_substrings_that_satisfy_k_constraint_ii/haskell_tests/Main.hs filter=lfs diff=lfs merge=lfs -text
89
+ count_substrings_that_satisfy_k_constraint_ii/meta.json filter=lfs diff=lfs merge=lfs -text
90
+ count_the_number_of_beautiful_subarrays/meta.json filter=lfs diff=lfs merge=lfs -text
91
+ count_the_number_of_good_nodes/haskell_tests/Main.hs filter=lfs diff=lfs merge=lfs -text
92
+ count_the_number_of_good_nodes/meta.json filter=lfs diff=lfs merge=lfs -text
93
+ count_the_number_of_good_subarrays/meta.json filter=lfs diff=lfs merge=lfs -text
94
+ count_the_number_of_houses_at_a_certain_distance_ii/meta.json filter=lfs diff=lfs merge=lfs -text
95
+ count_unreachable_pairs_of_nodes_in_an_undirected_graph/haskell_tests/Main.hs filter=lfs diff=lfs merge=lfs -text
96
+ count_unreachable_pairs_of_nodes_in_an_undirected_graph/meta.json filter=lfs diff=lfs merge=lfs -text
97
+ count_unreachable_pairs_of_nodes_in_an_undirected_graph/ocaml_tests/main.ml filter=lfs diff=lfs merge=lfs -text
98
+ count_unreachable_pairs_of_nodes_in_an_undirected_graph/scala_tests/MySuite.scala filter=lfs diff=lfs merge=lfs -text
99
+ count_ways_to_group_overlapping_ranges/meta.json filter=lfs diff=lfs merge=lfs -text
100
+ count_zero_request_servers/haskell_tests/Main.hs filter=lfs diff=lfs merge=lfs -text
101
+ count_zero_request_servers/meta.json filter=lfs diff=lfs merge=lfs -text
102
+ count_zero_request_servers/ocaml_tests/main.ml filter=lfs diff=lfs merge=lfs -text
103
+ count_zero_request_servers/scala_tests/MySuite.scala filter=lfs diff=lfs merge=lfs -text
104
+ create_components_with_same_value/meta.json filter=lfs diff=lfs merge=lfs -text
105
+ cycle_length_queries_in_a_tree/meta.json filter=lfs diff=lfs merge=lfs -text
106
+ destroy_sequential_targets/meta.json filter=lfs diff=lfs merge=lfs -text
107
+ difference_between_maximum_and_minimum_price_sum/haskell_tests/Main.hs filter=lfs diff=lfs merge=lfs -text
108
+ difference_between_maximum_and_minimum_price_sum/meta.json filter=lfs diff=lfs merge=lfs -text
109
+ difference_between_ones_and_zeros_in_row_and_column/meta.json filter=lfs diff=lfs merge=lfs -text
110
+ distribute_elements_into_two_arrays_ii/haskell_tests/Main.hs filter=lfs diff=lfs merge=lfs -text
111
+ distribute_elements_into_two_arrays_ii/meta.json filter=lfs diff=lfs merge=lfs -text
112
+ divide_an_array_into_subarrays_with_minimum_cost_ii/meta.json filter=lfs diff=lfs merge=lfs -text
113
+ divide_array_into_arrays_with_max_difference/meta.json filter=lfs diff=lfs merge=lfs -text
114
+ divide_intervals_into_minimum_number_of_groups/meta.json filter=lfs diff=lfs merge=lfs -text
115
+ eat_pizzas/meta.json filter=lfs diff=lfs merge=lfs -text
116
+ find_all_good_indices/meta.json filter=lfs diff=lfs merge=lfs -text
117
+ find_building_where_alice_and_bob_can_meet/haskell_tests/Main.hs filter=lfs diff=lfs merge=lfs -text
118
+ find_building_where_alice_and_bob_can_meet/meta.json filter=lfs diff=lfs merge=lfs -text
119
+ find_closest_node_to_given_two_nodes/meta.json filter=lfs diff=lfs merge=lfs -text
120
+ find_indices_with_index_and_value_difference_ii/meta.json filter=lfs diff=lfs merge=lfs -text
121
+ find_number_of_coins_to_place_in_tree_nodes/meta.json filter=lfs diff=lfs merge=lfs -text
122
+ find_occurrences_of_an_element_in_an_array/meta.json filter=lfs diff=lfs merge=lfs -text
123
+ find_subtree_sizes_after_changes/meta.json filter=lfs diff=lfs merge=lfs -text
124
+ find_the_first_player_to_win_k_games_in_a_row/meta.json filter=lfs diff=lfs merge=lfs -text
125
+ find_the_k_sum_of_an_array/meta.json filter=lfs diff=lfs merge=lfs -text
126
+ find_the_longest_equal_subarray/meta.json filter=lfs diff=lfs merge=lfs -text
127
+ find_the_maximum_number_of_marked_indices/meta.json filter=lfs diff=lfs merge=lfs -text
128
+ find_the_minimum_area_to_cover_all_ones_i/meta.json filter=lfs diff=lfs merge=lfs -text
129
+ find_the_number_of_good_pairs_ii/meta.json filter=lfs diff=lfs merge=lfs -text
130
+ find_the_original_array_of_prefix_xor/meta.json filter=lfs diff=lfs merge=lfs -text
131
+ find_the_score_of_all_prefixes_of_an_array/meta.json filter=lfs diff=lfs merge=lfs -text
132
+ find_x_sum_of_all_k_long_subarrays_ii/haskell_tests/Main.hs filter=lfs diff=lfs merge=lfs -text
133
+ find_x_sum_of_all_k_long_subarrays_ii/meta.json filter=lfs diff=lfs merge=lfs -text
134
+ frog_jump_ii/meta.json filter=lfs diff=lfs merge=lfs -text
135
+ fruits_into_baskets_iii/haskell_tests/Main.hs filter=lfs diff=lfs merge=lfs -text
136
+ fruits_into_baskets_iii/meta.json filter=lfs diff=lfs merge=lfs -text
137
+ handling_sum_queries_after_update/meta.json filter=lfs diff=lfs merge=lfs -text
138
+ house_robber_iv/meta.json filter=lfs diff=lfs merge=lfs -text
139
+ increment_submatrices_by_one/meta.json filter=lfs diff=lfs merge=lfs -text
140
+ intervals_between_identical_elements/meta.json filter=lfs diff=lfs merge=lfs -text
141
+ k_th_nearest_obstacle_queries/haskell_tests/Main.hs filter=lfs diff=lfs merge=lfs -text
142
+ k_th_nearest_obstacle_queries/meta.json filter=lfs diff=lfs merge=lfs -text
143
+ largest_combination_with_bitwise_and_greater_than_zero/meta.json filter=lfs diff=lfs merge=lfs -text
144
+ largest_element_in_an_array_after_merge_operations/meta.json filter=lfs diff=lfs merge=lfs -text
145
+ length_of_longest_subarray_with_at_most_k_frequency/meta.json filter=lfs diff=lfs merge=lfs -text
146
+ length_of_the_longest_increasing_path/haskell_tests/Main.hs filter=lfs diff=lfs merge=lfs -text
147
+ length_of_the_longest_increasing_path/meta.json filter=lfs diff=lfs merge=lfs -text
148
+ longest_non_decreasing_subarray_from_two_arrays/haskell_tests/Main.hs filter=lfs diff=lfs merge=lfs -text
149
+ longest_non_decreasing_subarray_from_two_arrays/meta.json filter=lfs diff=lfs merge=lfs -text
150
+ longest_palindrome_by_concatenating_two_letter_words/meta.json filter=lfs diff=lfs merge=lfs -text
151
+ longest_path_with_different_adjacent_characters/meta.json filter=lfs diff=lfs merge=lfs -text
152
+ longest_special_path/meta.json filter=lfs diff=lfs merge=lfs -text
153
+ longest_special_path_ii/meta.json filter=lfs diff=lfs merge=lfs -text
154
+ longest_subarray_with_maximum_bitwise_and/meta.json filter=lfs diff=lfs merge=lfs -text
155
+ max_sum_of_a_pair_with_equal_sum_of_digits/meta.json filter=lfs diff=lfs merge=lfs -text
156
+ maximal_score_after_applying_k_operations/meta.json filter=lfs diff=lfs merge=lfs -text
157
+ maximize_happiness_of_selected_children/haskell_tests/Main.hs filter=lfs diff=lfs merge=lfs -text
158
+ maximize_happiness_of_selected_children/meta.json filter=lfs diff=lfs merge=lfs -text
159
+ maximize_score_of_numbers_in_ranges/meta.json filter=lfs diff=lfs merge=lfs -text
160
+ maximize_sum_of_weights_after_edge_removals/haskell_tests/Main.hs filter=lfs diff=lfs merge=lfs -text
161
+ maximize_sum_of_weights_after_edge_removals/meta.json filter=lfs diff=lfs merge=lfs -text
162
+ maximize_sum_of_weights_after_edge_removals/ocaml_tests/main.ml filter=lfs diff=lfs merge=lfs -text
163
+ maximize_sum_of_weights_after_edge_removals/scala_tests/MySuite.scala filter=lfs diff=lfs merge=lfs -text
164
+ maximize_the_profit_as_the_salesman/meta.json filter=lfs diff=lfs merge=lfs -text
165
+ maximize_value_of_function_in_a_ball_passing_game/meta.json filter=lfs diff=lfs merge=lfs -text
166
+ maximize_win_from_two_segments/meta.json filter=lfs diff=lfs merge=lfs -text
167
+ maximum_and_minimum_sums_of_at_most_size_k_subarrays/meta.json filter=lfs diff=lfs merge=lfs -text
168
+ maximum_bags_with_full_capacity_of_rocks/meta.json filter=lfs diff=lfs merge=lfs -text
169
+ maximum_beauty_of_an_array_after_applying_operation/meta.json filter=lfs diff=lfs merge=lfs -text
170
+ maximum_coins_from_k_consecutive_bags/haskell_tests/Main.hs filter=lfs diff=lfs merge=lfs -text
171
+ maximum_coins_from_k_consecutive_bags/meta.json filter=lfs diff=lfs merge=lfs -text
172
+ maximum_consecutive_floors_without_special_floors/meta.json filter=lfs diff=lfs merge=lfs -text
173
+ maximum_difference_score_in_a_grid/haskell_tests/Main.hs filter=lfs diff=lfs merge=lfs -text
174
+ maximum_difference_score_in_a_grid/meta.json filter=lfs diff=lfs merge=lfs -text
175
+ maximum_elegance_of_a_k_length_subsequence/meta.json filter=lfs diff=lfs merge=lfs -text
176
+ maximum_frequency_after_subarray_operation/meta.json filter=lfs diff=lfs merge=lfs -text
177
+ maximum_frequency_of_an_element_after_performing_operations_i/meta.json filter=lfs diff=lfs merge=lfs -text
178
+ maximum_frequency_of_an_element_after_performing_operations_ii/meta.json filter=lfs diff=lfs merge=lfs -text
179
+ maximum_good_subarray_sum/meta.json filter=lfs diff=lfs merge=lfs -text
180
+ maximum_matching_of_players_with_trainers/meta.json filter=lfs diff=lfs merge=lfs -text
181
+ maximum_number_of_groups_entering_a_competition/meta.json filter=lfs diff=lfs merge=lfs -text
182
+ maximum_number_of_groups_with_increasing_length/meta.json filter=lfs diff=lfs merge=lfs -text
183
+ maximum_number_of_k_divisible_components/meta.json filter=lfs diff=lfs merge=lfs -text
184
+ maximum_or/meta.json filter=lfs diff=lfs merge=lfs -text
185
+ maximum_points_after_collecting_coins_from_all_nodes/haskell_tests/Main.hs filter=lfs diff=lfs merge=lfs -text
186
+ maximum_points_after_collecting_coins_from_all_nodes/meta.json filter=lfs diff=lfs merge=lfs -text
187
+ maximum_points_after_collecting_coins_from_all_nodes/scala_tests/MySuite.scala filter=lfs diff=lfs merge=lfs -text
188
+ maximum_prime_difference/meta.json filter=lfs diff=lfs merge=lfs -text
189
+ maximum_score_after_applying_operations_on_a_tree/meta.json filter=lfs diff=lfs merge=lfs -text
190
+ maximum_score_of_a_node_sequence/meta.json filter=lfs diff=lfs merge=lfs -text
191
+ maximum_star_sum_of_a_graph/meta.json filter=lfs diff=lfs merge=lfs -text
192
+ maximum_subarray_sum_with_length_divisible_by_k/haskell_tests/Main.hs filter=lfs diff=lfs merge=lfs -text
193
+ maximum_subarray_sum_with_length_divisible_by_k/meta.json filter=lfs diff=lfs merge=lfs -text
194
+ maximum_sum_of_distinct_subarrays_with_length_k/meta.json filter=lfs diff=lfs merge=lfs -text
195
+ maximum_sum_of_subsequence_with_non_adjacent_elements/meta.json filter=lfs diff=lfs merge=lfs -text
196
+ maximum_sum_queries/haskell_tests/Main.hs filter=lfs diff=lfs merge=lfs -text
197
+ maximum_sum_queries/meta.json filter=lfs diff=lfs merge=lfs -text
198
+ maximum_sum_queries/ocaml_tests/main.ml filter=lfs diff=lfs merge=lfs -text
199
+ maximum_sum_queries/scala_tests/MySuite.scala filter=lfs diff=lfs merge=lfs -text
200
+ maximum_tastiness_of_candy_basket/meta.json filter=lfs diff=lfs merge=lfs -text
201
+ maximum_total_beauty_of_the_gardens/meta.json filter=lfs diff=lfs merge=lfs -text
202
+ maximum_total_importance_of_roads/meta.json filter=lfs diff=lfs merge=lfs -text
203
+ maximum_xor_score_subarray_queries/haskell_tests/Main.hs filter=lfs diff=lfs merge=lfs -text
204
+ maximum_xor_score_subarray_queries/meta.json filter=lfs diff=lfs merge=lfs -text
205
+ maximum_xor_score_subarray_queries/scala_tests/MySuite.scala filter=lfs diff=lfs merge=lfs -text
206
+ meeting_rooms_iii/meta.json filter=lfs diff=lfs merge=lfs -text
207
+ meta2/.DS_Store filter=lfs diff=lfs merge=lfs -text
208
+ meta2/add_edges_to_make_degrees_of_all_nodes_even/meta.json filter=lfs diff=lfs merge=lfs -text
209
+ meta2/all_divisions_with_the_highest_score_of_a_binary_array/meta.json filter=lfs diff=lfs merge=lfs -text
210
+ mice_and_cheese/meta.json filter=lfs diff=lfs merge=lfs -text
211
+ minimize_maximum_of_array/meta.json filter=lfs diff=lfs merge=lfs -text
212
+ minimize_or_of_remaining_elements_using_operations/meta.json filter=lfs diff=lfs merge=lfs -text
213
+ minimize_the_maximum_difference_of_pairs/meta.json filter=lfs diff=lfs merge=lfs -text
214
+ minimum_absolute_difference_between_elements_with_constraint/meta.json filter=lfs diff=lfs merge=lfs -text
215
+ minimum_array_length_after_pair_removals/meta.json filter=lfs diff=lfs merge=lfs -text
216
+ minimum_cost_to_equalize_array/meta.json filter=lfs diff=lfs merge=lfs -text
217
+ minimum_cost_to_make_arrays_identical/meta.json filter=lfs diff=lfs merge=lfs -text
218
+ minimum_difference_in_sums_after_removal_of_elements/meta.json filter=lfs diff=lfs merge=lfs -text
219
+ minimum_fuel_cost_to_report_to_the_capital/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
224
+ minimum_number_of_operations_to_make_array_xor_equal_to_k/meta.json filter=lfs diff=lfs merge=lfs -text
225
+ minimum_number_of_operations_to_make_arrays_similar/meta.json filter=lfs diff=lfs merge=lfs -text
226
+ minimum_number_of_operations_to_satisfy_conditions/meta.json filter=lfs diff=lfs merge=lfs -text
227
+ minimum_operations_to_exceed_threshold_value_ii/haskell_tests/Main.hs filter=lfs diff=lfs merge=lfs -text
228
+ minimum_operations_to_exceed_threshold_value_ii/meta.json filter=lfs diff=lfs merge=lfs -text
229
+ minimum_operations_to_halve_array_sum/meta.json filter=lfs diff=lfs merge=lfs -text
230
+ minimum_operations_to_make_array_equal_ii/meta.json filter=lfs diff=lfs merge=lfs -text
231
+ minimum_operations_to_make_array_equal_to_target/haskell_tests/Main.hs filter=lfs diff=lfs merge=lfs -text
232
+ minimum_operations_to_make_array_equal_to_target/meta.json filter=lfs diff=lfs merge=lfs -text
233
+ minimum_operations_to_make_median_of_array_equal_to_k/haskell_tests/Main.hs filter=lfs diff=lfs merge=lfs -text
234
+ minimum_operations_to_make_median_of_array_equal_to_k/meta.json filter=lfs diff=lfs merge=lfs -text
235
+ minimum_operations_to_make_the_array_alternating/meta.json filter=lfs diff=lfs merge=lfs -text
236
+ minimum_processing_time/meta.json filter=lfs diff=lfs merge=lfs -text
237
+ minimum_rectangles_to_cover_points/haskell_tests/Main.hs filter=lfs diff=lfs merge=lfs -text
238
+ minimum_rectangles_to_cover_points/meta.json filter=lfs diff=lfs merge=lfs -text
239
+ minimum_rectangles_to_cover_points/scala_tests/MySuite.scala filter=lfs diff=lfs merge=lfs -text
240
+ minimum_replacements_to_sort_the_array/meta.json filter=lfs diff=lfs merge=lfs -text
241
+ minimum_rounds_to_complete_all_tasks/meta.json filter=lfs diff=lfs merge=lfs -text
242
+ minimum_score_of_a_path_between_two_cities/meta.json filter=lfs diff=lfs merge=lfs -text
243
+ minimum_seconds_to_equalize_a_circular_array/meta.json filter=lfs diff=lfs merge=lfs -text
244
+ minimum_size_subarray_in_infinite_array/meta.json filter=lfs diff=lfs merge=lfs -text
245
+ minimum_sum_of_squared_difference/meta.json filter=lfs diff=lfs merge=lfs -text
246
+ minimum_swaps_to_group_all_1s_together_ii/meta.json filter=lfs diff=lfs merge=lfs -text
247
+ minimum_time_to_complete_trips/meta.json filter=lfs diff=lfs merge=lfs -text
248
+ minimum_time_to_finish_the_race/meta.json filter=lfs diff=lfs merge=lfs -text
249
+ minimum_time_to_repair_cars/meta.json filter=lfs diff=lfs merge=lfs -text
250
+ minimum_total_cost_to_make_arrays_unequal/meta.json filter=lfs diff=lfs merge=lfs -text
251
+ most_popular_video_creator/meta.json filter=lfs diff=lfs merge=lfs -text
252
+ movement_of_robots/meta.json filter=lfs diff=lfs merge=lfs -text
253
+ next_greater_element_iv/meta.json filter=lfs diff=lfs merge=lfs -text
254
+ node_with_highest_edge_score/meta.json filter=lfs diff=lfs merge=lfs -text
255
+ number_of_excellent_pairs/meta.json filter=lfs diff=lfs merge=lfs -text
256
+ number_of_flowers_in_full_bloom/meta.json filter=lfs diff=lfs merge=lfs -text
257
+ number_of_increasing_paths_in_a_grid/haskell_tests/Main.hs filter=lfs diff=lfs merge=lfs -text
258
+ number_of_increasing_paths_in_a_grid/meta.json filter=lfs diff=lfs merge=lfs -text
259
+ number_of_pairs_satisfying_inequality/meta.json filter=lfs diff=lfs merge=lfs -text
260
+ number_of_zero_filled_subarrays/meta.json filter=lfs diff=lfs merge=lfs -text
261
+ paint_house_iv/haskell_tests/Main.hs filter=lfs diff=lfs merge=lfs -text
262
+ paint_house_iv/meta.json filter=lfs diff=lfs merge=lfs -text
263
+ partition_array_according_to_given_pivot/meta.json filter=lfs diff=lfs merge=lfs -text
264
+ partition_array_such_that_maximum_difference_is_k/meta.json filter=lfs diff=lfs merge=lfs -text
265
+ paths_in_matrix_whose_sum_is_divisible_by_k/meta.json filter=lfs diff=lfs merge=lfs -text
266
+ reachable_nodes_with_restrictions/meta.json filter=lfs diff=lfs merge=lfs -text
267
+ rearrange_array_elements_by_sign/meta.json filter=lfs diff=lfs merge=lfs -text
268
+ rearranging_fruits/meta.json filter=lfs diff=lfs merge=lfs -text
269
+ remove_methods_from_project/haskell_tests/Main.hs filter=lfs diff=lfs merge=lfs -text
270
+ remove_methods_from_project/meta.json filter=lfs diff=lfs merge=lfs -text
271
+ remove_methods_from_project/ocaml_tests/main.ml filter=lfs diff=lfs merge=lfs -text
272
+ remove_methods_from_project/scala_tests/MySuite.scala filter=lfs diff=lfs merge=lfs -text
273
+ removing_minimum_number_of_magic_beans/meta.json filter=lfs diff=lfs merge=lfs -text
274
+ replace_non_coprime_numbers_in_array/meta.json filter=lfs diff=lfs merge=lfs -text
275
+ robot_collisions/meta.json filter=lfs diff=lfs merge=lfs -text
276
+ shifting_letters_ii/meta.json filter=lfs diff=lfs merge=lfs -text
277
+ shortest_impossible_sequence_of_rolls/meta.json filter=lfs diff=lfs merge=lfs -text
278
+ shortest_subarray_with_or_at_least_k_ii/meta.json filter=lfs diff=lfs merge=lfs -text
279
+ sliding_subarray_beauty/meta.json filter=lfs diff=lfs merge=lfs -text
280
+ smallest_missing_non_negative_integer_after_operations/meta.json filter=lfs diff=lfs merge=lfs -text
281
+ solving_questions_with_brainpower/meta.json filter=lfs diff=lfs merge=lfs -text
282
+ sorted_gcd_pair_queries/meta.json filter=lfs diff=lfs merge=lfs -text
283
+ steps_to_make_array_non_decreasing/meta.json filter=lfs diff=lfs merge=lfs -text
284
+ subarray_with_elements_greater_than_varying_threshold/meta.json filter=lfs diff=lfs merge=lfs -text
285
+ substring_xor_queries/meta.json filter=lfs diff=lfs merge=lfs -text
286
+ successful_pairs_of_spells_and_potions/meta.json filter=lfs diff=lfs merge=lfs -text
287
+ sum_of_distances/meta.json filter=lfs diff=lfs merge=lfs -text
288
+ sum_of_matrix_after_queries/meta.json filter=lfs diff=lfs merge=lfs -text
289
+ task_scheduler_ii/meta.json filter=lfs diff=lfs merge=lfs -text
290
+ total_cost_to_hire_k_workers/meta.json filter=lfs diff=lfs merge=lfs -text
291
+ zero_array_transformation_i/haskell_tests/Main.hs filter=lfs diff=lfs merge=lfs -text
292
+ zero_array_transformation_i/meta.json filter=lfs diff=lfs merge=lfs -text
293
+ zero_array_transformation_i/ocaml_tests/main.ml filter=lfs diff=lfs merge=lfs -text
294
+ zero_array_transformation_i/scala_tests/MySuite.scala filter=lfs diff=lfs merge=lfs -text
295
+ zero_array_transformation_ii/haskell_tests/Main.hs filter=lfs diff=lfs merge=lfs -text
296
+ zero_array_transformation_ii/meta.json filter=lfs diff=lfs merge=lfs -text
297
+ zero_array_transformation_ii/scala_tests/MySuite.scala filter=lfs diff=lfs merge=lfs -text
298
+ zero_array_transformation_iii/haskell_tests/Main.hs filter=lfs diff=lfs merge=lfs -text
299
+ zero_array_transformation_iii/meta.json filter=lfs diff=lfs merge=lfs -text
add_edges_to_make_degrees_of_all_nodes_even/.DS_Store ADDED
Binary file (6.15 kB). View file
 
add_edges_to_make_degrees_of_all_nodes_even/haskell_tests/Main.hs ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ module Main where
3
+ import Test.HUnit
4
+
5
+ --Program start
6
+
7
+ --Program end
8
+
9
+ -- Test cases
10
+
11
+ test1 :: Test
12
+ test1 = TestCase (assertEqual "for (isPossible 5 [[1,2],[2,3],[3,4],[4,2],[1,4],[2,5]])," True (isPossible 5 [[1,2],[2,3],[3,4],[4,2],[1,4],[2,5]]))
13
+
14
+ test2 :: Test
15
+ test2 = TestCase (assertEqual "for (isPossible 4 [[1,2],[3,4]])," True (isPossible 4 [[1,2],[3,4]]))
16
+
17
+ test3 :: Test
18
+ test3 = TestCase (assertEqual "for (isPossible 4 [[1,2],[1,3],[1,4]])," False (isPossible 4 [[1,2],[1,3],[1,4]]))
19
+
20
+
21
+ -- Grouping test cases
22
+ tests :: Test
23
+ tests = TestList [TestLabel "Test1" test1, TestLabel "Test2" test2]
24
+
25
+ -- Running the tests
26
+ main :: IO Counts
27
+ main = runTestTT tests
add_edges_to_make_degrees_of_all_nodes_even/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(true, isPossible(5, new ArrayList<>(Arrays.asList(new ArrayList<>(Arrays.asList(1,2)),new ArrayList<>(Arrays.asList(2,3)),new ArrayList<>(Arrays.asList(3,4)),new ArrayList<>(Arrays.asList(4,2)),new ArrayList<>(Arrays.asList(1,4)),new ArrayList<>(Arrays.asList(2,5))))));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals(true, isPossible(4, new ArrayList<>(Arrays.asList(new ArrayList<>(Arrays.asList(1,2)),new ArrayList<>(Arrays.asList(3,4))))));
19
+ }
20
+ @Test
21
+ public void test3() {
22
+ assertEquals(false, isPossible(4, new ArrayList<>(Arrays.asList(new ArrayList<>(Arrays.asList(1,2)),new ArrayList<>(Arrays.asList(1,3)),new ArrayList<>(Arrays.asList(1,4))))));
23
+ }
24
+
25
+ }
add_edges_to_make_degrees_of_all_nodes_even/meta.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:26b3d803db7b998bccd4920f2700d94c046456ec26a0c24cc4daeca7d5d672a4
3
+ size 48906019
add_edges_to_make_degrees_of_all_nodes_even/ocaml_tests/main.ml ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ module Main = struct
3
+ open OUnit2
4
+
5
+ (* Program start *)
6
+
7
+ (* Program end *)
8
+
9
+ (* Test cases *)
10
+
11
+ let test1 _ = assert_equal true (isPossible 5 [[1;2];[2;3];[3;4];[4;2];[1;4];[2;5]])
12
+
13
+ let test2 _ = assert_equal true (isPossible 4 [[1;2];[3;4]])
14
+
15
+ let test3 _ = assert_equal false (isPossible 4 [[1;2];[1;3];[1;4]])
16
+
17
+
18
+ (* Grouping test cases *)
19
+ let suite = "Test Suite for isPossible" >::: [
20
+
21
+ "test1" >:: test1;
22
+ "test2" >:: test2;
23
+ "test3" >:: test3;
24
+ ]
25
+
26
+
27
+ (* Running the tests *)
28
+ let () = run_test_tt_main suite
29
+ end
add_edges_to_make_degrees_of_all_nodes_even/scala_tests/MySuite.scala ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ class MySuite extends munit.FunSuite {
3
+
4
+ test("test1") {
5
+ assertEquals(Main.isPossible(5,List(List(1,2),List(2,3),List(3,4),List(4,2),List(1,4),List(2,5))), true)
6
+ }
7
+
8
+ test("test2") {
9
+ assertEquals(Main.isPossible(4,List(List(1,2),List(3,4))), true)
10
+ }
11
+
12
+ test("test3") {
13
+ assertEquals(Main.isPossible(4,List(List(1,2),List(1,3),List(1,4))), false)
14
+ }
15
+
16
+ }
adjacent_increasing_subarrays_detection_i/haskell_tests/Main.hs ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ module Main where
3
+ import Test.HUnit
4
+
5
+ --Program start
6
+
7
+ --Program end
8
+
9
+ -- Test cases
10
+
11
+ test1 :: Test
12
+ test1 = TestCase (assertEqual "for (hasIncreasingSubarrays [2,5,7,8,9,2,3,4,3,1] 3)," True (hasIncreasingSubarrays [2,5,7,8,9,2,3,4,3,1] 3))
13
+
14
+ test2 :: Test
15
+ test2 = TestCase (assertEqual "for (hasIncreasingSubarrays [1,2,3,4,4,4,4,5,6,7] 5)," False (hasIncreasingSubarrays [1,2,3,4,4,4,4,5,6,7] 5))
16
+
17
+ test3 :: Test
18
+ test3 = TestCase (assertEqual "for (hasIncreasingSubarrays [-669, 939, ( -671), ( -764), ( -122), 65, 433, ( -158), 532, ( -539), 634, ( -912), ( -271), 596, 397, 732, ( -474), 665, 518, 851, 3, 290, ( -172), ( -303), ( -856), 594, ( -99), 265, ( -948), ( -66), 381, ( -217), 765, 992, ( -799), ( -962), ( -359), ( -116), ( -737), ( -271), 441, 552, ( -845), ( -663), ( -415), 23, 987] 20)," False (hasIncreasingSubarrays [-669, 939, -671, -764, -122, 65, 433, -158, 532, -539, 634, -912, -271, 596, 397, 732, -474, 665, 518, 851, 3, 290, -172, -303, -856, 594, -99, 265, -948, -66, 381, -217, 765, 992, -799, -962, -359, -116, -737, -271, 441, 552, -845, -663, -415, 23, 987] 20))
19
+
20
+ test4 :: Test
21
+ test4 = TestCase (assertEqual "for (hasIncreasingSubarrays [846, ( -627), 915, ( -300), ( -391), ( -505), 507] 2)," False (hasIncreasingSubarrays [846, -627, 915, -300, -391, -505, 507] 2))
22
+
23
+ test5 :: Test
24
+ test5 = TestCase (assertEqual "for (hasIncreasingSubarrays [871, ( -896), ( -232), 537, 464, 728, ( -10), ( -927), ( -539), ( -113), 928, 555, 775, ( -900), ( -289), 795, ( -849), 450, 253, 450, ( -308), ( -589), ( -563), 848, 119, ( -780), ( -381)] 5)," False (hasIncreasingSubarrays [871, -896, -232, 537, 464, 728, -10, -927, -539, -113, 928, 555, 775, -900, -289, 795, -849, 450, 253, 450, -308, -589, -563, 848, 119, -780, -381] 5))
25
+
26
+ test6 :: Test
27
+ test6 = TestCase (assertEqual "for (hasIncreasingSubarrays [0, ( -807), 367, 485, 105, 174, ( -444), ( -479), ( -440), ( -626), ( -645), 422, 608, 881, ( -2), 147, ( -796), ( -752), 799, ( -782), ( -281), ( -955), ( -700), ( -946), ( -175), 134, 738, ( -983), 441, 284, 545, ( -597), ( -168), ( -53), 702, ( -845), ( -34), 126, ( -351), 842, 257, 59, 821, ( -974), 546, ( -628), ( -55), ( -452), 203, ( -793), ( -251), ( -515), 284] 16)," False (hasIncreasingSubarrays [0, -807, 367, 485, 105, 174, -444, -479, -440, -626, -645, 422, 608, 881, -2, 147, -796, -752, 799, -782, -281, -955, -700, -946, -175, 134, 738, -983, 441, 284, 545, -597, -168, -53, 702, -845, -34, 126, -351, 842, 257, 59, 821, -974, 546, -628, -55, -452, 203, -793, -251, -515, 284] 16))
28
+
29
+ test7 :: Test
30
+ test7 = TestCase (assertEqual "for (hasIncreasingSubarrays [-256, ( -176), 324, ( -573), ( -964), ( -489), ( -141), 884, ( -44), 137, 492, 813, ( -442), 608, ( -455), 971, ( -200), 940, 772, 359, ( -886), ( -454), ( -148), ( -473), ( -344), 18, 292, 137, ( -893), 238, ( -706), 974, ( -980), ( -639), ( -51), 267] 6)," False (hasIncreasingSubarrays [-256, -176, 324, -573, -964, -489, -141, 884, -44, 137, 492, 813, -442, 608, -455, 971, -200, 940, 772, 359, -886, -454, -148, -473, -344, 18, 292, 137, -893, 238, -706, 974, -980, -639, -51, 267] 6))
31
+
32
+ test8 :: Test
33
+ test8 = TestCase (assertEqual "for (hasIncreasingSubarrays [-744, 380, 344, 139, 841, 750, 102, ( -653), ( -428), ( -138), 104, 987, 604, ( -83), ( -428), ( -414), 664, ( -601), 663, ( -907), 190, 180, 926, ( -533), ( -872)] 3)," False (hasIncreasingSubarrays [-744, 380, 344, 139, 841, 750, 102, -653, -428, -138, 104, 987, 604, -83, -428, -414, 664, -601, 663, -907, 190, 180, 926, -533, -872] 3))
34
+
35
+ test9 :: Test
36
+ test9 = TestCase (assertEqual "for (hasIncreasingSubarrays [945, ( -656), 548, ( -31), 150, 186, 646, ( -910), 998, 336, 297, ( -267), 255, 748, ( -171), 488, ( -426), 826, ( -497), ( -228), 558, ( -875), 606, ( -372), ( -83), ( -63), ( -639), 195, 747, ( -795), ( -198), 102, 187, ( -546), ( -325), 414, 839, 890, 959, ( -581), ( -662), 365, 369, 12, ( -955), ( -657), ( -199), 56, ( -141), 382, ( -892), ( -461), 259, ( -574), ( -677), ( -211), ( -170), 889, ( -221), 462, 901, 291, 588, 863, 193, 376, ( -358), ( -677), 620, ( -717), 782, 813, ( -329), ( -424), ( -901)] 18)," False (hasIncreasingSubarrays [945, -656, 548, -31, 150, 186, 646, -910, 998, 336, 297, -267, 255, 748, -171, 488, -426, 826, -497, -228, 558, -875, 606, -372, -83, -63, -639, 195, 747, -795, -198, 102, 187, -546, -325, 414, 839, 890, 959, -581, -662, 365, 369, 12, -955, -657, -199, 56, -141, 382, -892, -461, 259, -574, -677, -211, -170, 889, -221, 462, 901, 291, 588, 863, 193, 376, -358, -677, 620, -717, 782, 813, -329, -424, -901] 18))
37
+
38
+
39
+ -- Grouping test cases
40
+ tests :: Test
41
+ tests = TestList [TestLabel "Test1" test1, TestLabel "Test2" test2, TestLabel "Test3" test3, TestLabel "Test4" test4, TestLabel "Test5" test5, TestLabel "Test6" test6, TestLabel "Test7" test7, TestLabel "Test8" test8, TestLabel "Test9" test9]
42
+
43
+ -- Running the tests
44
+ main :: IO Counts
45
+ main = runTestTT tests
adjacent_increasing_subarrays_detection_i/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(true, hasIncreasingSubarrays(new ArrayList<>(Arrays.asList(2,5,7,8,9,2,3,4,3,1)), 3));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals(fals, hasIncreasingSubarrays(new ArrayList<>(Arrays.asList(1,2,3,4,4,4,4,5,6,7)), 5));
19
+ }
20
+
21
+ }
adjacent_increasing_subarrays_detection_i/meta.json ADDED
@@ -0,0 +1,603 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "id": 3612,
3
+ "name": "adjacent_increasing_subarrays_detection_i",
4
+ "difficulty": "Easy",
5
+ "link": "https://leetcode.com/problems/adjacent-increasing-subarrays-detection-i/",
6
+ "date": "2024-11-03 00:00:00",
7
+ "task_description": "Given an array `nums` of `n` integers and an integer `k`, determine whether there exist **two** **adjacent** subarrays of length `k` such that both subarrays are **strictly** **increasing**. Specifically, check if there are **two** subarrays starting at indices `a` and `b` (`a < b`), where: Both subarrays `nums[a..a + k - 1]` and `nums[b..b + k - 1]` are **strictly increasing**. The subarrays must be **adjacent**, meaning `b = a + k`. Return `true` if it is _possible_ to find **two **such subarrays, and `false` otherwise. **Example 1:** **Input:** nums = [2,5,7,8,9,2,3,4,3,1], k = 3 **Output:** true **Explanation:** The subarray starting at index `2` is `[7, 8, 9]`, which is strictly increasing. The subarray starting at index `5` is `[2, 3, 4]`, which is also strictly increasing. These two subarrays are adjacent, so the result is `true`. **Example 2:** **Input:** nums = [1,2,3,4,4,4,4,5,6,7], k = 5 **Output:** false **Constraints:** `2 <= nums.length <= 100` `1 < 2 * k <= nums.length` `-1000 <= nums[i] <= 1000`",
8
+ "public_test_cases": [
9
+ {
10
+ "label": "Example 1",
11
+ "input": "nums = [2,5,7,8,9,2,3,4,3,1], k = 3",
12
+ "output": "true "
13
+ },
14
+ {
15
+ "label": "Example 2",
16
+ "input": "nums = [1,2,3,4,4,4,4,5,6,7], k = 5",
17
+ "output": "false"
18
+ }
19
+ ],
20
+ "private_test_cases": [
21
+ {
22
+ "input": [
23
+ [
24
+ -669,
25
+ 939,
26
+ -671,
27
+ -764,
28
+ -122,
29
+ 65,
30
+ 433,
31
+ -158,
32
+ 532,
33
+ -539,
34
+ 634,
35
+ -912,
36
+ -271,
37
+ 596,
38
+ 397,
39
+ 732,
40
+ -474,
41
+ 665,
42
+ 518,
43
+ 851,
44
+ 3,
45
+ 290,
46
+ -172,
47
+ -303,
48
+ -856,
49
+ 594,
50
+ -99,
51
+ 265,
52
+ -948,
53
+ -66,
54
+ 381,
55
+ -217,
56
+ 765,
57
+ 992,
58
+ -799,
59
+ -962,
60
+ -359,
61
+ -116,
62
+ -737,
63
+ -271,
64
+ 441,
65
+ 552,
66
+ -845,
67
+ -663,
68
+ -415,
69
+ 23,
70
+ 987
71
+ ],
72
+ 20
73
+ ],
74
+ "output": false
75
+ },
76
+ {
77
+ "input": [
78
+ [
79
+ 846,
80
+ -627,
81
+ 915,
82
+ -300,
83
+ -391,
84
+ -505,
85
+ 507
86
+ ],
87
+ 2
88
+ ],
89
+ "output": false
90
+ },
91
+ {
92
+ "input": [
93
+ [
94
+ 871,
95
+ -896,
96
+ -232,
97
+ 537,
98
+ 464,
99
+ 728,
100
+ -10,
101
+ -927,
102
+ -539,
103
+ -113,
104
+ 928,
105
+ 555,
106
+ 775,
107
+ -900,
108
+ -289,
109
+ 795,
110
+ -849,
111
+ 450,
112
+ 253,
113
+ 450,
114
+ -308,
115
+ -589,
116
+ -563,
117
+ 848,
118
+ 119,
119
+ -780,
120
+ -381
121
+ ],
122
+ 5
123
+ ],
124
+ "output": false
125
+ },
126
+ {
127
+ "input": [
128
+ [
129
+ 0,
130
+ -807,
131
+ 367,
132
+ 485,
133
+ 105,
134
+ 174,
135
+ -444,
136
+ -479,
137
+ -440,
138
+ -626,
139
+ -645,
140
+ 422,
141
+ 608,
142
+ 881,
143
+ -2,
144
+ 147,
145
+ -796,
146
+ -752,
147
+ 799,
148
+ -782,
149
+ -281,
150
+ -955,
151
+ -700,
152
+ -946,
153
+ -175,
154
+ 134,
155
+ 738,
156
+ -983,
157
+ 441,
158
+ 284,
159
+ 545,
160
+ -597,
161
+ -168,
162
+ -53,
163
+ 702,
164
+ -845,
165
+ -34,
166
+ 126,
167
+ -351,
168
+ 842,
169
+ 257,
170
+ 59,
171
+ 821,
172
+ -974,
173
+ 546,
174
+ -628,
175
+ -55,
176
+ -452,
177
+ 203,
178
+ -793,
179
+ -251,
180
+ -515,
181
+ 284
182
+ ],
183
+ 16
184
+ ],
185
+ "output": false
186
+ },
187
+ {
188
+ "input": [
189
+ [
190
+ -256,
191
+ -176,
192
+ 324,
193
+ -573,
194
+ -964,
195
+ -489,
196
+ -141,
197
+ 884,
198
+ -44,
199
+ 137,
200
+ 492,
201
+ 813,
202
+ -442,
203
+ 608,
204
+ -455,
205
+ 971,
206
+ -200,
207
+ 940,
208
+ 772,
209
+ 359,
210
+ -886,
211
+ -454,
212
+ -148,
213
+ -473,
214
+ -344,
215
+ 18,
216
+ 292,
217
+ 137,
218
+ -893,
219
+ 238,
220
+ -706,
221
+ 974,
222
+ -980,
223
+ -639,
224
+ -51,
225
+ 267
226
+ ],
227
+ 6
228
+ ],
229
+ "output": false
230
+ },
231
+ {
232
+ "input": [
233
+ [
234
+ -744,
235
+ 380,
236
+ 344,
237
+ 139,
238
+ 841,
239
+ 750,
240
+ 102,
241
+ -653,
242
+ -428,
243
+ -138,
244
+ 104,
245
+ 987,
246
+ 604,
247
+ -83,
248
+ -428,
249
+ -414,
250
+ 664,
251
+ -601,
252
+ 663,
253
+ -907,
254
+ 190,
255
+ 180,
256
+ 926,
257
+ -533,
258
+ -872
259
+ ],
260
+ 3
261
+ ],
262
+ "output": false
263
+ },
264
+ {
265
+ "input": [
266
+ [
267
+ 945,
268
+ -656,
269
+ 548,
270
+ -31,
271
+ 150,
272
+ 186,
273
+ 646,
274
+ -910,
275
+ 998,
276
+ 336,
277
+ 297,
278
+ -267,
279
+ 255,
280
+ 748,
281
+ -171,
282
+ 488,
283
+ -426,
284
+ 826,
285
+ -497,
286
+ -228,
287
+ 558,
288
+ -875,
289
+ 606,
290
+ -372,
291
+ -83,
292
+ -63,
293
+ -639,
294
+ 195,
295
+ 747,
296
+ -795,
297
+ -198,
298
+ 102,
299
+ 187,
300
+ -546,
301
+ -325,
302
+ 414,
303
+ 839,
304
+ 890,
305
+ 959,
306
+ -581,
307
+ -662,
308
+ 365,
309
+ 369,
310
+ 12,
311
+ -955,
312
+ -657,
313
+ -199,
314
+ 56,
315
+ -141,
316
+ 382,
317
+ -892,
318
+ -461,
319
+ 259,
320
+ -574,
321
+ -677,
322
+ -211,
323
+ -170,
324
+ 889,
325
+ -221,
326
+ 462,
327
+ 901,
328
+ 291,
329
+ 588,
330
+ 863,
331
+ 193,
332
+ 376,
333
+ -358,
334
+ -677,
335
+ 620,
336
+ -717,
337
+ 782,
338
+ 813,
339
+ -329,
340
+ -424,
341
+ -901
342
+ ],
343
+ 18
344
+ ],
345
+ "output": false
346
+ },
347
+ {
348
+ "input": [
349
+ [
350
+ -344,
351
+ 743,
352
+ 491,
353
+ 216,
354
+ 42,
355
+ -955,
356
+ -472,
357
+ -736,
358
+ 582,
359
+ -552,
360
+ 814,
361
+ 538,
362
+ 35,
363
+ -988,
364
+ 971,
365
+ 362,
366
+ 227,
367
+ -42,
368
+ 709,
369
+ -704,
370
+ -529,
371
+ -537,
372
+ 172,
373
+ 609,
374
+ 217,
375
+ -73,
376
+ -444,
377
+ 67,
378
+ -820,
379
+ -687,
380
+ -158,
381
+ 738,
382
+ 605,
383
+ 804,
384
+ -779,
385
+ 463,
386
+ -677,
387
+ 491,
388
+ -459,
389
+ -479,
390
+ -856,
391
+ 680,
392
+ -499,
393
+ -349,
394
+ -864,
395
+ -462,
396
+ 359,
397
+ 119,
398
+ -916,
399
+ 43,
400
+ 699,
401
+ -488,
402
+ 325,
403
+ 559,
404
+ 487,
405
+ 151,
406
+ 595,
407
+ 425,
408
+ -785,
409
+ 706,
410
+ 390,
411
+ 215,
412
+ -883,
413
+ -693,
414
+ 446
415
+ ],
416
+ 3
417
+ ],
418
+ "output": true
419
+ },
420
+ {
421
+ "input": [
422
+ [
423
+ -996,
424
+ 361,
425
+ -258,
426
+ -631,
427
+ -979,
428
+ 897,
429
+ -327,
430
+ -292,
431
+ 337,
432
+ -78,
433
+ -520,
434
+ 219,
435
+ -781,
436
+ 543,
437
+ 337,
438
+ -380,
439
+ -594,
440
+ 890,
441
+ 364,
442
+ 384,
443
+ -513,
444
+ 144,
445
+ -925,
446
+ 315,
447
+ 273,
448
+ 363,
449
+ -984,
450
+ 170,
451
+ -841,
452
+ -78,
453
+ -801,
454
+ 892,
455
+ -630,
456
+ 193,
457
+ 212,
458
+ 157,
459
+ 403,
460
+ 238,
461
+ -718,
462
+ -641,
463
+ 944,
464
+ 219,
465
+ -227,
466
+ -986,
467
+ -432,
468
+ 165,
469
+ 629,
470
+ -137,
471
+ -696,
472
+ 865,
473
+ 776,
474
+ 117,
475
+ 890,
476
+ 627,
477
+ -135,
478
+ 667,
479
+ -507,
480
+ -103,
481
+ 34,
482
+ 455,
483
+ -905,
484
+ -773,
485
+ 90,
486
+ -340,
487
+ -606,
488
+ -129,
489
+ -215,
490
+ 437,
491
+ -61,
492
+ 308,
493
+ -264,
494
+ 306,
495
+ -253,
496
+ -399,
497
+ -677,
498
+ 912,
499
+ -274,
500
+ 71
501
+ ],
502
+ 15
503
+ ],
504
+ "output": false
505
+ },
506
+ {
507
+ "input": [
508
+ [
509
+ 188,
510
+ 642,
511
+ -770,
512
+ -52,
513
+ -48,
514
+ 858,
515
+ -237,
516
+ 449,
517
+ -619,
518
+ 40,
519
+ -469,
520
+ 852,
521
+ 836,
522
+ 40,
523
+ -944,
524
+ -275,
525
+ 69,
526
+ -951,
527
+ -455,
528
+ 822,
529
+ -255,
530
+ 417,
531
+ -139,
532
+ -546,
533
+ -978,
534
+ 200,
535
+ 378,
536
+ 545,
537
+ 306,
538
+ 710,
539
+ 617,
540
+ 585,
541
+ -653,
542
+ 463,
543
+ 474,
544
+ 732,
545
+ 98,
546
+ 541,
547
+ -47,
548
+ -23,
549
+ -550,
550
+ -972,
551
+ -50,
552
+ 361,
553
+ 675,
554
+ -365,
555
+ 673,
556
+ -866,
557
+ -522,
558
+ -879,
559
+ 752,
560
+ -893,
561
+ -458,
562
+ -673,
563
+ 774,
564
+ -721,
565
+ 498,
566
+ -212,
567
+ 801,
568
+ 654,
569
+ 886,
570
+ -257,
571
+ 489,
572
+ -367,
573
+ -57,
574
+ -155,
575
+ -139,
576
+ -693,
577
+ 875,
578
+ 299,
579
+ -426,
580
+ -566,
581
+ 250,
582
+ -121,
583
+ 677,
584
+ -65,
585
+ 523,
586
+ 439,
587
+ 119,
588
+ 407,
589
+ -715,
590
+ 915,
591
+ 674
592
+ ],
593
+ 38
594
+ ],
595
+ "output": false
596
+ }
597
+ ],
598
+ "haskell_template": "hasIncreasingSubarrays :: [Int] -> Int -> Bool\nhasIncreasingSubarrays nums k ",
599
+ "ocaml_template": "let hasIncreasingSubarrays (nums: int list) (k: int) : bool = ",
600
+ "scala_template": "def hasIncreasingSubarrays(nums: List[Int],k: Int): Boolean = { \n \n}",
601
+ "java_template": "class Solution {\n public boolean hasIncreasingSubarrays(List<Integer> nums, int k) {\n \n }\n}",
602
+ "python_template": "class Solution(object):\n def hasIncreasingSubarrays(self, nums, k):\n \"\"\"\n :type nums: List[int]\n :type k: int\n :rtype: bool\n \"\"\"\n "
603
+ }
adjacent_increasing_subarrays_detection_i/ocaml_tests/main.ml ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ module Main = struct
3
+ open OUnit2
4
+
5
+ (* Program start *)
6
+
7
+ (* Program end *)
8
+
9
+ (* Test cases *)
10
+
11
+ let test1 _ = assert_equal true (hasIncreasingSubarrays [2;5;7;8;9;2;3;4;3;1] 3)
12
+
13
+ let test2 _ = assert_equal false (hasIncreasingSubarrays [1;2;3;4;4;4;4;5;6;7] 5)
14
+
15
+ let test3 _ = assert_equal false (hasIncreasingSubarrays [-669; 939; ( -671); ( -764); ( -122); 65; 433; ( -158); 532; ( -539); 634; ( -912); ( -271); 596; 397; 732; ( -474); 665; 518; 851; 3; 290; ( -172); ( -303); ( -856); 594; ( -99); 265; ( -948); ( -66); 381; ( -217); 765; 992; ( -799); ( -962); ( -359); ( -116); ( -737); ( -271); 441; 552; ( -845); ( -663); ( -415); 23; 987] 20)
16
+
17
+ let test4 _ = assert_equal false (hasIncreasingSubarrays [846; ( -627); 915; ( -300); ( -391); ( -505); 507] 2)
18
+
19
+ let test5 _ = assert_equal false (hasIncreasingSubarrays [871; ( -896); ( -232); 537; 464; 728; ( -10); ( -927); ( -539); ( -113); 928; 555; 775; ( -900); ( -289); 795; ( -849); 450; 253; 450; ( -308); ( -589); ( -563); 848; 119; ( -780); ( -381)] 5)
20
+
21
+ let test6 _ = assert_equal false (hasIncreasingSubarrays [0; ( -807); 367; 485; 105; 174; ( -444); ( -479); ( -440); ( -626); ( -645); 422; 608; 881; ( -2); 147; ( -796); ( -752); 799; ( -782); ( -281); ( -955); ( -700); ( -946); ( -175); 134; 738; ( -983); 441; 284; 545; ( -597); ( -168); ( -53); 702; ( -845); ( -34); 126; ( -351); 842; 257; 59; 821; ( -974); 546; ( -628); ( -55); ( -452); 203; ( -793); ( -251); ( -515); 284] 16)
22
+
23
+ let test7 _ = assert_equal false (hasIncreasingSubarrays [-256; ( -176); 324; ( -573); ( -964); ( -489); ( -141); 884; ( -44); 137; 492; 813; ( -442); 608; ( -455); 971; ( -200); 940; 772; 359; ( -886); ( -454); ( -148); ( -473); ( -344); 18; 292; 137; ( -893); 238; ( -706); 974; ( -980); ( -639); ( -51); 267] 6)
24
+
25
+ let test8 _ = assert_equal false (hasIncreasingSubarrays [-744; 380; 344; 139; 841; 750; 102; ( -653); ( -428); ( -138); 104; 987; 604; ( -83); ( -428); ( -414); 664; ( -601); 663; ( -907); 190; 180; 926; ( -533); ( -872)] 3)
26
+
27
+ let test9 _ = assert_equal false (hasIncreasingSubarrays [945; ( -656); 548; ( -31); 150; 186; 646; ( -910); 998; 336; 297; ( -267); 255; 748; ( -171); 488; ( -426); 826; ( -497); ( -228); 558; ( -875); 606; ( -372); ( -83); ( -63); ( -639); 195; 747; ( -795); ( -198); 102; 187; ( -546); ( -325); 414; 839; 890; 959; ( -581); ( -662); 365; 369; 12; ( -955); ( -657); ( -199); 56; ( -141); 382; ( -892); ( -461); 259; ( -574); ( -677); ( -211); ( -170); 889; ( -221); 462; 901; 291; 588; 863; 193; 376; ( -358); ( -677); 620; ( -717); 782; 813; ( -329); ( -424); ( -901)] 18)
28
+
29
+ let test10 _ = assert_equal true (hasIncreasingSubarrays [-344; 743; 491; 216; 42; ( -955); ( -472); ( -736); 582; ( -552); 814; 538; 35; ( -988); 971; 362; 227; ( -42); 709; ( -704); ( -529); ( -537); 172; 609; 217; ( -73); ( -444); 67; ( -820); ( -687); ( -158); 738; 605; 804; ( -779); 463; ( -677); 491; ( -459); ( -479); ( -856); 680; ( -499); ( -349); ( -864); ( -462); 359; 119; ( -916); 43; 699; ( -488); 325; 559; 487; 151; 595; 425; ( -785); 706; 390; 215; ( -883); ( -693); 446] 3)
30
+
31
+
32
+ (* Grouping test cases *)
33
+ let suite = "Test Suite for hasIncreasingSubarrays" >::: [
34
+
35
+ "test1" >:: test1;
36
+ "test2" >:: test2;
37
+ "test3" >:: test3;
38
+ "test4" >:: test4;
39
+ "test5" >:: test5;
40
+ "test6" >:: test6;
41
+ "test7" >:: test7;
42
+ "test8" >:: test8;
43
+ "test9" >:: test9;
44
+ "test10" >:: test10;
45
+ ]
46
+
47
+
48
+ (* Running the tests *)
49
+ let () = run_test_tt_main suite
50
+ end
adjacent_increasing_subarrays_detection_i/scala_tests/MySuite.scala ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ class MySuite extends munit.FunSuite {
3
+
4
+ test("test1") {
5
+ assertEquals(Main.hasIncreasingSubarrays(List(2,5,7,8,9,2,3,4,3,1),3), true)
6
+ }
7
+
8
+ test("test2") {
9
+ assertEquals(Main.hasIncreasingSubarrays(List(1,2,3,4,4,4,4,5,6,7),5), false)
10
+ }
11
+
12
+ test("test3") {
13
+ assertEquals(Main.hasIncreasingSubarrays(List(-669, 939, -671, -764, -122, 65, 433, -158, 532, -539, 634, -912, -271, 596, 397, 732, -474, 665, 518, 851, 3, 290, -172, -303, -856, 594, -99, 265, -948, -66, 381, -217, 765, 992, -799, -962, -359, -116, -737, -271, 441, 552, -845, -663, -415, 23, 987),20), false)
14
+ }
15
+
16
+ test("test4") {
17
+ assertEquals(Main.hasIncreasingSubarrays(List(846, -627, 915, -300, -391, -505, 507),2), false)
18
+ }
19
+
20
+ test("test5") {
21
+ assertEquals(Main.hasIncreasingSubarrays(List(871, -896, -232, 537, 464, 728, -10, -927, -539, -113, 928, 555, 775, -900, -289, 795, -849, 450, 253, 450, -308, -589, -563, 848, 119, -780, -381),5), false)
22
+ }
23
+
24
+ test("test6") {
25
+ assertEquals(Main.hasIncreasingSubarrays(List(0, -807, 367, 485, 105, 174, -444, -479, -440, -626, -645, 422, 608, 881, -2, 147, -796, -752, 799, -782, -281, -955, -700, -946, -175, 134, 738, -983, 441, 284, 545, -597, -168, -53, 702, -845, -34, 126, -351, 842, 257, 59, 821, -974, 546, -628, -55, -452, 203, -793, -251, -515, 284),16), false)
26
+ }
27
+
28
+ test("test7") {
29
+ assertEquals(Main.hasIncreasingSubarrays(List(-256, -176, 324, -573, -964, -489, -141, 884, -44, 137, 492, 813, -442, 608, -455, 971, -200, 940, 772, 359, -886, -454, -148, -473, -344, 18, 292, 137, -893, 238, -706, 974, -980, -639, -51, 267),6), false)
30
+ }
31
+
32
+ test("test8") {
33
+ assertEquals(Main.hasIncreasingSubarrays(List(-744, 380, 344, 139, 841, 750, 102, -653, -428, -138, 104, 987, 604, -83, -428, -414, 664, -601, 663, -907, 190, 180, 926, -533, -872),3), false)
34
+ }
35
+
36
+ test("test9") {
37
+ assertEquals(Main.hasIncreasingSubarrays(List(945, -656, 548, -31, 150, 186, 646, -910, 998, 336, 297, -267, 255, 748, -171, 488, -426, 826, -497, -228, 558, -875, 606, -372, -83, -63, -639, 195, 747, -795, -198, 102, 187, -546, -325, 414, 839, 890, 959, -581, -662, 365, 369, 12, -955, -657, -199, 56, -141, 382, -892, -461, 259, -574, -677, -211, -170, 889, -221, 462, 901, 291, 588, 863, 193, 376, -358, -677, 620, -717, 782, 813, -329, -424, -901),18), false)
38
+ }
39
+
40
+ test("test10") {
41
+ assertEquals(Main.hasIncreasingSubarrays(List(-344, 743, 491, 216, 42, -955, -472, -736, 582, -552, 814, 538, 35, -988, 971, 362, 227, -42, 709, -704, -529, -537, 172, 609, 217, -73, -444, 67, -820, -687, -158, 738, 605, 804, -779, 463, -677, 491, -459, -479, -856, 680, -499, -349, -864, -462, 359, 119, -916, 43, 699, -488, 325, 559, 487, 151, 595, 425, -785, 706, 390, 215, -883, -693, 446),3), true)
42
+ }
43
+
44
+ }
alice_and_bob_playing_flower_game/haskell_tests/Main.hs ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ module Main where
3
+ import Test.HUnit
4
+
5
+ --Program start
6
+
7
+ --Program end
8
+
9
+ -- Test cases
10
+
11
+ test1 :: Test
12
+ test1 = TestCase (assertEqual "for (flowerGame 3 2)," 3 (flowerGame 3 2))
13
+
14
+ test2 :: Test
15
+ test2 = TestCase (assertEqual "for (flowerGame 1 1)," 0 (flowerGame 1 1))
16
+
17
+ test3 :: Test
18
+ test3 = TestCase (assertEqual "for (flowerGame 76449 82807)," 3165256171 (flowerGame 76449 82807))
19
+
20
+ test4 :: Test
21
+ test4 = TestCase (assertEqual "for (flowerGame 37149 7947)," 147611551 (flowerGame 37149 7947))
22
+
23
+ test5 :: Test
24
+ test5 = TestCase (assertEqual "for (flowerGame 65876 54651)," 1800094638 (flowerGame 65876 54651))
25
+
26
+ test6 :: Test
27
+ test6 = TestCase (assertEqual "for (flowerGame 83462 43930)," 1833242830 (flowerGame 83462 43930))
28
+
29
+ test7 :: Test
30
+ test7 = TestCase (assertEqual "for (flowerGame 85778 70262)," 3013466918 (flowerGame 85778 70262))
31
+
32
+ test8 :: Test
33
+ test8 = TestCase (assertEqual "for (flowerGame 85146 43396)," 1847497908 (flowerGame 85146 43396))
34
+
35
+ test9 :: Test
36
+ test9 = TestCase (assertEqual "for (flowerGame 31445 22823)," 358834617 (flowerGame 31445 22823))
37
+
38
+
39
+ -- Grouping test cases
40
+ tests :: Test
41
+ tests = TestList [TestLabel "Test1" test1, TestLabel "Test2" test2, TestLabel "Test3" test3, TestLabel "Test4" test4, TestLabel "Test5" test5, TestLabel "Test6" test6, TestLabel "Test7" test7, TestLabel "Test8" test8, TestLabel "Test9" test9]
42
+
43
+ -- Running the tests
44
+ main :: IO Counts
45
+ main = runTestTT tests
alice_and_bob_playing_flower_game/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, flowerGame(3, 2));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals(0, flowerGame(1, 1));
19
+ }
20
+
21
+ }
alice_and_bob_playing_flower_game/meta.json ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "id": 3279,
3
+ "name": "alice_and_bob_playing_flower_game",
4
+ "difficulty": "Medium",
5
+ "link": "https://leetcode.com/problems/alice-and-bob-playing-flower-game/",
6
+ "date": "2024-01-21 00:00:00",
7
+ "task_description": "Alice and Bob are playing a turn-based game on a circular field surrounded by flowers. The circle represents the field, and there are `x` flowers in the clockwise direction between Alice and Bob, and `y` flowers in the anti-clockwise direction between them. The game proceeds as follows: Alice takes the first turn. In each turn, a player must choose either the clockwise or anti-clockwise direction and pick one flower from that side. At the end of the turn, if there are no flowers left at all, the **current** player captures their opponent and wins the game. Given two integers, `n` and `m`, the task is to compute the number of possible pairs `(x, y)` that satisfy the conditions: Alice must win the game according to the described rules. The number of flowers `x` in the clockwise direction must be in the range `[1,n]`. The number of flowers `y` in the anti-clockwise direction must be in the range `[1,m]`. Return _the number of possible pairs_ `(x, y)` _that satisfy the conditions mentioned in the statement_. **Example 1:** ``` **Input:** n = 3, m = 2 **Output:** 3 **Explanation:** The following pairs satisfy conditions described in the statement: (1,2), (3,2), (2,1). ``` **Example 2:** ``` **Input:** n = 1, m = 1 **Output:** 0 **Explanation:** No pairs satisfy the conditions described in the statement. ``` **Constraints:** `1 <= n, m <= 105`",
8
+ "public_test_cases": [
9
+ {
10
+ "label": "Example 1",
11
+ "input": "n = 3, m = 2",
12
+ "output": "3 "
13
+ },
14
+ {
15
+ "label": "Example 2",
16
+ "input": "n = 1, m = 1",
17
+ "output": "0 "
18
+ }
19
+ ],
20
+ "private_test_cases": [
21
+ {
22
+ "input": [
23
+ 76449,
24
+ 82807
25
+ ],
26
+ "output": 3165256171
27
+ },
28
+ {
29
+ "input": [
30
+ 37149,
31
+ 7947
32
+ ],
33
+ "output": 147611551
34
+ },
35
+ {
36
+ "input": [
37
+ 65876,
38
+ 54651
39
+ ],
40
+ "output": 1800094638
41
+ },
42
+ {
43
+ "input": [
44
+ 83462,
45
+ 43930
46
+ ],
47
+ "output": 1833242830
48
+ },
49
+ {
50
+ "input": [
51
+ 85778,
52
+ 70262
53
+ ],
54
+ "output": 3013466918
55
+ },
56
+ {
57
+ "input": [
58
+ 85146,
59
+ 43396
60
+ ],
61
+ "output": 1847497908
62
+ },
63
+ {
64
+ "input": [
65
+ 31445,
66
+ 22823
67
+ ],
68
+ "output": 358834617
69
+ },
70
+ {
71
+ "input": [
72
+ 15704,
73
+ 32979
74
+ ],
75
+ "output": 258951108
76
+ },
77
+ {
78
+ "input": [
79
+ 74462,
80
+ 73807
81
+ ],
82
+ "output": 2747908417
83
+ },
84
+ {
85
+ "input": [
86
+ 53354,
87
+ 74360
88
+ ],
89
+ "output": 1983701720
90
+ }
91
+ ],
92
+ "haskell_template": "flowerGame :: Int -> Int -> Int\nflowerGame n m ",
93
+ "ocaml_template": "let flowerGame (n: int) (m: int) : int = ",
94
+ "scala_template": "def flowerGame(n: Int,m: Int): Int = { \n \n}",
95
+ "java_template": "class Solution {\n public long flowerGame(int n, int m) {\n \n }\n}",
96
+ "python_template": "class Solution(object):\n def flowerGame(self, n, m):\n \"\"\"\n :type n: int\n :type m: int\n :rtype: int\n \"\"\"\n "
97
+ }
alice_and_bob_playing_flower_game/ocaml_tests/main.ml ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ module Main = struct
3
+ open OUnit2
4
+
5
+ (* Program start *)
6
+
7
+ (* Program end *)
8
+
9
+ (* Test cases *)
10
+
11
+ let test1 _ = assert_equal 3 (flowerGame 3 2)
12
+
13
+ let test2 _ = assert_equal 0 (flowerGame 1 1)
14
+
15
+ let test3 _ = assert_equal 3165256171 (flowerGame 76449 82807)
16
+
17
+ let test4 _ = assert_equal 147611551 (flowerGame 37149 7947)
18
+
19
+ let test5 _ = assert_equal 1800094638 (flowerGame 65876 54651)
20
+
21
+ let test6 _ = assert_equal 1833242830 (flowerGame 83462 43930)
22
+
23
+ let test7 _ = assert_equal 3013466918 (flowerGame 85778 70262)
24
+
25
+ let test8 _ = assert_equal 1847497908 (flowerGame 85146 43396)
26
+
27
+ let test9 _ = assert_equal 358834617 (flowerGame 31445 22823)
28
+
29
+ let test10 _ = assert_equal 258951108 (flowerGame 15704 32979)
30
+
31
+
32
+ (* Grouping test cases *)
33
+ let suite = "Test Suite for flowerGame" >::: [
34
+
35
+ "test1" >:: test1;
36
+ "test2" >:: test2;
37
+ "test3" >:: test3;
38
+ "test4" >:: test4;
39
+ "test5" >:: test5;
40
+ "test6" >:: test6;
41
+ "test7" >:: test7;
42
+ "test8" >:: test8;
43
+ "test9" >:: test9;
44
+ "test10" >:: test10;
45
+ ]
46
+
47
+
48
+ (* Running the tests *)
49
+ let () = run_test_tt_main suite
50
+ end
alice_and_bob_playing_flower_game/scala_tests/MySuite.scala ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ class MySuite extends munit.FunSuite {
3
+
4
+ test("test1") {
5
+ assertEquals(Main.flowerGame(3,2), 3)
6
+ }
7
+
8
+ test("test2") {
9
+ assertEquals(Main.flowerGame(1,1), 0)
10
+ }
11
+
12
+ test("test3") {
13
+ assertEquals(Main.flowerGame(76449,82807), BigInt("3165256171"))
14
+ }
15
+
16
+ test("test4") {
17
+ assertEquals(Main.flowerGame(37149,7947), 147611551)
18
+ }
19
+
20
+ test("test5") {
21
+ assertEquals(Main.flowerGame(65876,54651), 1800094638)
22
+ }
23
+
24
+ test("test6") {
25
+ assertEquals(Main.flowerGame(83462,43930), 1833242830)
26
+ }
27
+
28
+ test("test7") {
29
+ assertEquals(Main.flowerGame(85778,70262), BigInt("3013466918"))
30
+ }
31
+
32
+ test("test8") {
33
+ assertEquals(Main.flowerGame(85146,43396), 1847497908)
34
+ }
35
+
36
+ test("test9") {
37
+ assertEquals(Main.flowerGame(31445,22823), 358834617)
38
+ }
39
+
40
+ test("test10") {
41
+ assertEquals(Main.flowerGame(15704,32979), 258951108)
42
+ }
43
+
44
+ }
all_divisions_with_the_highest_score_of_a_binary_array/.DS_Store ADDED
Binary file (6.15 kB). View file
 
all_divisions_with_the_highest_score_of_a_binary_array/haskell_tests/Main.hs ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ module Main where
3
+ import Test.HUnit
4
+
5
+ --Program start
6
+
7
+ --Program end
8
+
9
+ -- Test cases
10
+
11
+ test1 :: Test
12
+ test1 = TestCase (assertEqual "for (maxScoreIndices [0,0,1,0])," [2,4] (maxScoreIndices [0,0,1,0]))
13
+
14
+ test2 :: Test
15
+ test2 = TestCase (assertEqual "for (maxScoreIndices [0,0,0])," [3] (maxScoreIndices [0,0,0]))
16
+
17
+ test3 :: Test
18
+ test3 = TestCase (assertEqual "for (maxScoreIndices [1,1])," [0] (maxScoreIndices [1,1]))
19
+
20
+
21
+ -- Grouping test cases
22
+ tests :: Test
23
+ tests = TestList [TestLabel "Test1" test1, TestLabel "Test2" test2]
24
+
25
+ -- Running the tests
26
+ main :: IO Counts
27
+ main = runTestTT tests
all_divisions_with_the_highest_score_of_a_binary_array/java_tests/Main.java ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import static org.junit.jupiter.api.Assertions.*;
3
+ import org.junit.jupiter.api.Test;
4
+ import java.util.List;
5
+ import java.util.Arrays;
6
+ import java.util.ArrayList;
7
+ public class Main {
8
+ //Program start
9
+
10
+ //Program end
11
+
12
+ @Test
13
+ public void test1() {
14
+ assertEquals(new ArrayList<>(Arrays.asList(2,4)), maxScoreIndices(new ArrayList<>(Arrays.asList(0,0,1,0))));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals(new ArrayList<>(Arrays.asList(3)), maxScoreIndices(new ArrayList<>(Arrays.asList(0,0,0))));
19
+ }
20
+ @Test
21
+ public void test3() {
22
+ assertEquals(new ArrayList<>(Arrays.asList(0)), maxScoreIndices(new ArrayList<>(Arrays.asList(1,1))));
23
+ }
24
+
25
+ }
all_divisions_with_the_highest_score_of_a_binary_array/meta.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:caa21b2b9270e6fba599ae2a4f0386444b2dd465a5a98e9c14689194513427cb
3
+ size 11483445
all_divisions_with_the_highest_score_of_a_binary_array/ocaml_tests/main.ml ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ module Main = struct
3
+ open OUnit2
4
+
5
+ (* Program start *)
6
+
7
+ (* Program end *)
8
+
9
+ (* Test cases *)
10
+
11
+ let test1 _ = assert_equal [2;4] (maxScoreIndices [0;0;1;0])
12
+
13
+ let test2 _ = assert_equal [3] (maxScoreIndices [0;0;0])
14
+
15
+ let test3 _ = assert_equal [0] (maxScoreIndices [1;1])
16
+
17
+
18
+ (* Grouping test cases *)
19
+ let suite = "Test Suite for maxScoreIndices" >::: [
20
+
21
+ "test1" >:: test1;
22
+ "test2" >:: test2;
23
+ "test3" >:: test3;
24
+ ]
25
+
26
+
27
+ (* Running the tests *)
28
+ let () = run_test_tt_main suite
29
+ end
all_divisions_with_the_highest_score_of_a_binary_array/scala_tests/MySuite.scala ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ class MySuite extends munit.FunSuite {
3
+
4
+ test("test1") {
5
+ assertEquals(Main.maxScoreIndices(List(0,0,1,0)), List(2,4))
6
+ }
7
+
8
+ test("test2") {
9
+ assertEquals(Main.maxScoreIndices(List(0,0,0)), List(3))
10
+ }
11
+
12
+ test("test3") {
13
+ assertEquals(Main.maxScoreIndices(List(1,1)), List(0))
14
+ }
15
+
16
+ }
alternating_groups_i/haskell_tests/Main.hs ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ module Main where
3
+ import Test.HUnit
4
+
5
+ --Program start
6
+ numberOfAlternatingGroups :: [Int] -> Int
7
+ numberOfAlternatingGroups colors = undefined
8
+
9
+ --Program end
10
+
11
+ -- Test cases
12
+
13
+ test1 :: Test
14
+ test1 = TestCase (assertEqual "for (numberOfAlternatingGroups [1,1,1])," 0 (numberOfAlternatingGroups [1,1,1]))
15
+
16
+ test2 :: Test
17
+ test2 = TestCase (assertEqual "for (numberOfAlternatingGroups [0,1,0,0,1])," 3 (numberOfAlternatingGroups [0,1,0,0,1]))
18
+
19
+ test3 :: Test
20
+ test3 = TestCase (assertEqual "for (numberOfAlternatingGroups [1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0])," 11 (numberOfAlternatingGroups [1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0]))
21
+
22
+ test4 :: Test
23
+ test4 = TestCase (assertEqual "for (numberOfAlternatingGroups [0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 0, 1, 1])," 30 (numberOfAlternatingGroups [0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 0, 1, 1]))
24
+
25
+ test5 :: Test
26
+ test5 = TestCase (assertEqual "for (numberOfAlternatingGroups [1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 1])," 5 (numberOfAlternatingGroups [1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 1]))
27
+
28
+ test6 :: Test
29
+ test6 = TestCase (assertEqual "for (numberOfAlternatingGroups [1, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0])," 19 (numberOfAlternatingGroups [1, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0]))
30
+
31
+ test7 :: Test
32
+ test7 = TestCase (assertEqual "for (numberOfAlternatingGroups [0, 1, 0, 0, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0])," 11 (numberOfAlternatingGroups [0, 1, 0, 0, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0]))
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
alternating_groups_i/java_tests/Main.java ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import static org.junit.jupiter.api.Assertions.*;
3
+ import org.junit.jupiter.api.Test;
4
+ import java.util.List;
5
+ import java.util.Arrays;
6
+ public class Main {
7
+ //Program start
8
+
9
+ //Program end
10
+
11
+ @Test
12
+ public void test1() {
13
+ assertEquals(0, numberOfAlternatingGroups(Arrays.asList(1,1,1)));
14
+ }
15
+ @Test
16
+ public void test2() {
17
+ assertEquals(3, numberOfAlternatingGroups(Arrays.asList(0,1,0,0,1)));
18
+ }
19
+
20
+ }
alternating_groups_i/meta.json ADDED
@@ -0,0 +1,333 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "id": 3463,
3
+ "name": "alternating_groups_i",
4
+ "difficulty": "Easy",
5
+ "link": "https://leetcode.com/problems/alternating-groups-i/",
6
+ "date": "2024-06-22 00:00:00",
7
+ "task_description": "There is a circle of red and blue tiles. You are given an array of integers `colors`. The color of tile `i` is represented by `colors[i]`: `colors[i] == 0` means that tile `i` is **red**. `colors[i] == 1` means that tile `i` is **blue**. Every 3 contiguous tiles in the circle with **alternating** colors (the middle tile has a different color from its **left** and **right** tiles) is called an **alternating** group. Return the number of **alternating** groups. **Note** that since `colors` represents a **circle**, the **first** and the **last** tiles are considered to be next to each other. **Example 1:** **Input:** colors = [1,1,1] **Output:** 0 **Explanation:** **Example 2:** **Input:** colors = [0,1,0,0,1] **Output:** 3 **Explanation:** Alternating groups: ******** **Constraints:** `3 <= colors.length <= 100` `0 <= colors[i] <= 1`",
8
+ "public_test_cases": [
9
+ {
10
+ "label": "Example 1",
11
+ "input": "colors = [1,1,1]",
12
+ "output": "0 "
13
+ },
14
+ {
15
+ "label": "Example 2",
16
+ "input": "colors = [0,1,0,0,1]",
17
+ "output": "3 "
18
+ }
19
+ ],
20
+ "private_test_cases": [
21
+ {
22
+ "input": [
23
+ 1,
24
+ 0,
25
+ 1,
26
+ 1,
27
+ 0,
28
+ 0,
29
+ 0,
30
+ 1,
31
+ 1,
32
+ 0,
33
+ 0,
34
+ 1,
35
+ 0,
36
+ 1,
37
+ 0,
38
+ 0,
39
+ 1,
40
+ 1,
41
+ 0,
42
+ 0,
43
+ 1,
44
+ 0,
45
+ 0,
46
+ 0,
47
+ 0,
48
+ 0,
49
+ 1,
50
+ 0,
51
+ 1,
52
+ 0,
53
+ 1,
54
+ 0,
55
+ 0
56
+ ],
57
+ "output": 11
58
+ },
59
+ {
60
+ "input": [
61
+ 0,
62
+ 1,
63
+ 0,
64
+ 1,
65
+ 1,
66
+ 1,
67
+ 1,
68
+ 1,
69
+ 1,
70
+ 1,
71
+ 0,
72
+ 0,
73
+ 0,
74
+ 1,
75
+ 1,
76
+ 1,
77
+ 1,
78
+ 1,
79
+ 1,
80
+ 1,
81
+ 0,
82
+ 1,
83
+ 0,
84
+ 0,
85
+ 1,
86
+ 0,
87
+ 1,
88
+ 0,
89
+ 0,
90
+ 1,
91
+ 1,
92
+ 0,
93
+ 1,
94
+ 0,
95
+ 0,
96
+ 0,
97
+ 0,
98
+ 0,
99
+ 1,
100
+ 0,
101
+ 1,
102
+ 0,
103
+ 0,
104
+ 1,
105
+ 0,
106
+ 0,
107
+ 1,
108
+ 1,
109
+ 1,
110
+ 1,
111
+ 0,
112
+ 1,
113
+ 0,
114
+ 1,
115
+ 0,
116
+ 0,
117
+ 0,
118
+ 1,
119
+ 0,
120
+ 0,
121
+ 1,
122
+ 1,
123
+ 1,
124
+ 1,
125
+ 1,
126
+ 1,
127
+ 0,
128
+ 1,
129
+ 1,
130
+ 1,
131
+ 0,
132
+ 1,
133
+ 1,
134
+ 1,
135
+ 1,
136
+ 1,
137
+ 1,
138
+ 1,
139
+ 0,
140
+ 1,
141
+ 0,
142
+ 1,
143
+ 0,
144
+ 1,
145
+ 1,
146
+ 1,
147
+ 0,
148
+ 1,
149
+ 0,
150
+ 1,
151
+ 1,
152
+ 1,
153
+ 1,
154
+ 0,
155
+ 1,
156
+ 1
157
+ ],
158
+ "output": 30
159
+ },
160
+ {
161
+ "input": [
162
+ 1,
163
+ 0,
164
+ 0,
165
+ 0,
166
+ 0,
167
+ 0,
168
+ 1,
169
+ 0,
170
+ 1,
171
+ 0,
172
+ 1,
173
+ 1,
174
+ 0,
175
+ 0,
176
+ 0,
177
+ 0,
178
+ 1,
179
+ 1,
180
+ 1,
181
+ 0,
182
+ 0,
183
+ 1,
184
+ 0,
185
+ 0,
186
+ 1,
187
+ 1,
188
+ 0,
189
+ 0,
190
+ 1,
191
+ 1
192
+ ],
193
+ "output": 5
194
+ },
195
+ {
196
+ "input": [
197
+ 1,
198
+ 1,
199
+ 0,
200
+ 0,
201
+ 1,
202
+ 0,
203
+ 1,
204
+ 0,
205
+ 0,
206
+ 1,
207
+ 0,
208
+ 0,
209
+ 1,
210
+ 1,
211
+ 1,
212
+ 1,
213
+ 0,
214
+ 1,
215
+ 1,
216
+ 0,
217
+ 1,
218
+ 1,
219
+ 0,
220
+ 1,
221
+ 1,
222
+ 1,
223
+ 0,
224
+ 1,
225
+ 0,
226
+ 0,
227
+ 1,
228
+ 0,
229
+ 1,
230
+ 1,
231
+ 0,
232
+ 0,
233
+ 1,
234
+ 0,
235
+ 1,
236
+ 0,
237
+ 1,
238
+ 1,
239
+ 1,
240
+ 1,
241
+ 1,
242
+ 0,
243
+ 0,
244
+ 1,
245
+ 0,
246
+ 1,
247
+ 1,
248
+ 0,
249
+ 0,
250
+ 0,
251
+ 0,
252
+ 0,
253
+ 1,
254
+ 1,
255
+ 1,
256
+ 0,
257
+ 0,
258
+ 1,
259
+ 0,
260
+ 0,
261
+ 1,
262
+ 1,
263
+ 1,
264
+ 0
265
+ ],
266
+ "output": 19
267
+ },
268
+ {
269
+ "input": [
270
+ 0,
271
+ 1,
272
+ 0,
273
+ 0,
274
+ 1,
275
+ 1,
276
+ 1,
277
+ 1,
278
+ 0,
279
+ 1,
280
+ 0,
281
+ 1,
282
+ 1,
283
+ 1,
284
+ 0,
285
+ 0,
286
+ 1,
287
+ 0,
288
+ 0,
289
+ 0,
290
+ 1,
291
+ 1,
292
+ 0,
293
+ 1,
294
+ 0,
295
+ 0,
296
+ 1,
297
+ 1,
298
+ 1,
299
+ 1,
300
+ 1,
301
+ 1,
302
+ 0,
303
+ 1,
304
+ 1,
305
+ 0,
306
+ 0,
307
+ 0,
308
+ 1,
309
+ 1,
310
+ 0,
311
+ 1,
312
+ 0,
313
+ 0,
314
+ 0,
315
+ 0,
316
+ 1,
317
+ 1,
318
+ 0,
319
+ 0,
320
+ 0,
321
+ 0,
322
+ 1,
323
+ 0
324
+ ],
325
+ "output": 11
326
+ }
327
+ ],
328
+ "haskell_template": "numberOfAlternatingGroups :: [Int] -> Int\nnumberOfAlternatingGroups colors ",
329
+ "ocaml_template": "let numberOfAlternatingGroups (colors: int list) : int = ",
330
+ "scala_template": "def numberOfAlternatingGroups(colors: List[Int]): Int = { \n \n}",
331
+ "java_template": "class Solution {\n public int numberOfAlternatingGroups(int[] colors) {\n \n }\n}",
332
+ "python_template": "class Solution(object):\n def numberOfAlternatingGroups(self, colors):\n \"\"\"\n :type colors: List[int]\n :rtype: int\n \"\"\"\n "
333
+ }
alternating_groups_i/ocaml_tests/main.ml ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ module Main = struct
3
+ open OUnit2
4
+
5
+ (* Program start *)
6
+ let numberOfAlternatingGroups (colors: int list) : int = failwith "Not implemented"
7
+
8
+ (* Program end *)
9
+
10
+ (* Test cases *)
11
+
12
+ let test1 _ = assert_equal 0 (numberOfAlternatingGroups [1;1;1])
13
+
14
+ let test2 _ = assert_equal 3 (numberOfAlternatingGroups [0;1;0;0;1])
15
+
16
+ let test3 _ = assert_equal 3 (numberOfAlternatingGroups [1; 0; 1; 1; 0; 0; 0; 1; 1; 0; 0; 1; 0; 1; 0; 0; 1; 1; 0; 0; 1; 0; 0; 0; 0; 0; 1; 0; 1; 0; 1; 0; 0])
17
+
18
+ let test4 _ = assert_equal 3 (numberOfAlternatingGroups [0; 1; 0; 1; 1; 1; 1; 1; 1; 1; 0; 0; 0; 1; 1; 1; 1; 1; 1; 1; 0; 1; 0; 0; 1; 0; 1; 0; 0; 1; 1; 0; 1; 0; 0; 0; 0; 0; 1; 0; 1; 0; 0; 1; 0; 0; 1; 1; 1; 1; 0; 1; 0; 1; 0; 0; 0; 1; 0; 0; 1; 1; 1; 1; 1; 1; 0; 1; 1; 1; 0; 1; 1; 1; 1; 1; 1; 1; 0; 1; 0; 1; 0; 1; 1; 1; 0; 1; 0; 1; 1; 1; 1; 0; 1; 1])
19
+
20
+ let test5 _ = assert_equal 3 (numberOfAlternatingGroups [1; 0; 0; 0; 0; 0; 1; 0; 1; 0; 1; 1; 0; 0; 0; 0; 1; 1; 1; 0; 0; 1; 0; 0; 1; 1; 0; 0; 1; 1])
21
+
22
+ let test6 _ = assert_equal 3 (numberOfAlternatingGroups [1; 1; 0; 0; 1; 0; 1; 0; 0; 1; 0; 0; 1; 1; 1; 1; 0; 1; 1; 0; 1; 1; 0; 1; 1; 1; 0; 1; 0; 0; 1; 0; 1; 1; 0; 0; 1; 0; 1; 0; 1; 1; 1; 1; 1; 0; 0; 1; 0; 1; 1; 0; 0; 0; 0; 0; 1; 1; 1; 0; 0; 1; 0; 0; 1; 1; 1; 0])
23
+
24
+ let test7 _ = assert_equal 3 (numberOfAlternatingGroups [0; 1; 0; 0; 1; 1; 1; 1; 0; 1; 0; 1; 1; 1; 0; 0; 1; 0; 0; 0; 1; 1; 0; 1; 0; 0; 1; 1; 1; 1; 1; 1; 0; 1; 1; 0; 0; 0; 1; 1; 0; 1; 0; 0; 0; 0; 1; 1; 0; 0; 0; 0; 1; 0])
25
+
26
+
27
+ (* Grouping test cases *)
28
+ let suite = "Test Suite for numberOfAlternatingGroups" >::: [
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
alternating_groups_i/scala_tests/MySuite.scala ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ class MySuite extends munit.FunSuite {
3
+
4
+ test("test1") {
5
+ assertEquals(Main.numberOfAlternatingGroups(List(1,1,1)), 0)
6
+ }
7
+
8
+ test("test2") {
9
+ assertEquals(Main.numberOfAlternatingGroups(List(0,1,0,0,1)), 3)
10
+ }
11
+
12
+ test("test3") {
13
+ assertEquals(Main.numberOfAlternatingGroups(1,0,1,1,0,0,0,1,1,0,0,1,0,1,0,0,1,1,0,0,1,0,0,0,0,0,1,0,1,0,1,0,0), 11)
14
+ }
15
+
16
+ test("test4") {
17
+ assertEquals(Main.numberOfAlternatingGroups(0,1,0,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,0,1,0,0,1,0,1,0,0,1,1,0,1,0,0,0,0,0,1,0,1,0,0,1,0,0,1,1,1,1,0,1,0,1,0,0,0,1,0,0,1,1,1,1,1,1,0,1,1,1,0,1,1,1,1,1,1,1,0,1,0,1,0,1,1,1,0,1,0,1,1,1,1,0,1,1), 30)
18
+ }
19
+
20
+ test("test5") {
21
+ assertEquals(Main.numberOfAlternatingGroups(1,0,0,0,0,0,1,0,1,0,1,1,0,0,0,0,1,1,1,0,0,1,0,0,1,1,0,0,1,1), 5)
22
+ }
23
+
24
+ test("test6") {
25
+ assertEquals(Main.numberOfAlternatingGroups(1,1,0,0,1,0,1,0,0,1,0,0,1,1,1,1,0,1,1,0,1,1,0,1,1,1,0,1,0,0,1,0,1,1,0,0,1,0,1,0,1,1,1,1,1,0,0,1,0,1,1,0,0,0,0,0,1,1,1,0,0,1,0,0,1,1,1,0), 19)
26
+ }
27
+
28
+ test("test7") {
29
+ assertEquals(Main.numberOfAlternatingGroups(0,1,0,0,1,1,1,1,0,1,0,1,1,1,0,0,1,0,0,0,1,1,0,1,0,0,1,1,1,1,1,1,0,1,1,0,0,0,1,1,0,1,0,0,0,0,1,1,0,0,0,0,1,0), 11)
30
+ }
31
+
32
+ }
alternating_groups_ii/haskell_tests/Main.hs ADDED
The diff for this file is too large to render. See raw diff
 
alternating_groups_ii/java_tests/Main.java ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import static org.junit.jupiter.api.Assertions.*;
3
+ import org.junit.jupiter.api.Test;
4
+ import java.util.List;
5
+ import java.util.Arrays;
6
+ import java.util.ArrayList;
7
+ public class Main {
8
+ //Program start
9
+
10
+ //Program end
11
+
12
+ @Test
13
+ public void test1() {
14
+ assertEquals(3, numberOfAlternatingGroups(new ArrayList<>(Arrays.asList(0,1,0,1,0)), 3));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals(2, numberOfAlternatingGroups(new ArrayList<>(Arrays.asList(0,1,0,0,1,0,1)), 6));
19
+ }
20
+ @Test
21
+ public void test3() {
22
+ assertEquals(0, numberOfAlternatingGroups(new ArrayList<>(Arrays.asList(1,1,0,1)), 4));
23
+ }
24
+
25
+ }
alternating_groups_ii/meta.json ADDED
The diff for this file is too large to render. See raw diff
 
alternating_groups_ii/ocaml_tests/main.ml ADDED
The diff for this file is too large to render. See raw diff
 
alternating_groups_ii/scala_tests/MySuite.scala ADDED
The diff for this file is too large to render. See raw diff
 
alternating_groups_iii/haskell_tests/Main.hs ADDED
The diff for this file is too large to render. See raw diff
 
alternating_groups_iii/java_tests/Main.java ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import static org.junit.jupiter.api.Assertions.*;
3
+ import org.junit.jupiter.api.Test;
4
+ import java.util.List;
5
+ import java.util.Arrays;
6
+ import java.util.ArrayList;
7
+ public class Main {
8
+ //Program start
9
+
10
+ //Program end
11
+
12
+ @Test
13
+ public void test1() {
14
+ assertEquals(new ArrayList<>(Arrays.asList(2)), numberOfAlternatingGroups(new ArrayList<>(Arrays.asList(0,1,1,0,1)), new ArrayList<>(Arrays.asList(new ArrayList<>(Arrays.asList(2,1,0)),new ArrayList<>(Arrays.asList(1,4))))));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals(new ArrayList<>(Arrays.asList(2,0)), numberOfAlternatingGroups(new ArrayList<>(Arrays.asList(0,0,1,0,1,1)), new ArrayList<>(Arrays.asList(new ArrayList<>(Arrays.asList(1,3)),new ArrayList<>(Arrays.asList(2,3,0)),new ArrayList<>(Arrays.asList(1,5))))));
19
+ }
20
+
21
+ }
alternating_groups_iii/meta.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c2dfb4ad6017e4522029cc12f97ed5a3d68568525e67cbcf6dcd9bb2e2cb3818
3
+ size 17190671
alternating_groups_iii/ocaml_tests/main.ml ADDED
The diff for this file is too large to render. See raw diff
 
alternating_groups_iii/scala_tests/MySuite.scala ADDED
The diff for this file is too large to render. See raw diff
 
ant_on_the_boundary/haskell_tests/Main.hs ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ module Main where
3
+ import Test.HUnit
4
+
5
+ --Program start
6
+ returnToBoundaryCount :: [Int] -> Int
7
+ returnToBoundaryCount nums = undefined
8
+
9
+ --Program end
10
+
11
+ -- Test cases
12
+
13
+ test1 :: Test
14
+ test1 = TestCase (assertEqual "for (returnToBoundaryCount [2,3,-5])," 1 (returnToBoundaryCount [2,3,-5]))
15
+
16
+ test2 :: Test
17
+ test2 = TestCase (assertEqual "for (returnToBoundaryCount [3,2,-3,-4])," 0 (returnToBoundaryCount [3,2,-3,-4]))
18
+
19
+ test3 :: Test
20
+ test3 = TestCase (assertEqual "for (returnToBoundaryCount [-10, 9, ( -10), 10, 1, ( -8), 5, 9, ( -7), ( -9), 2, ( -8), ( -1), ( -5), ( -7), 7, ( -5), ( -2), ( -3), 9, ( -9), ( -9), 9, ( -3), ( -7), ( -6), ( -9), ( -7), 0, 4, ( -1), ( -10), 0, 8, 8, ( -7), ( -1), 3, 8, ( -3), ( -1), ( -6)])," 1 (returnToBoundaryCount [-10, 9, -10, 10, 1, -8, 5, 9, -7, -9, 2, -8, -1, -5, -7, 7, -5, -2, -3, 9, -9, -9, 9, -3, -7, -6, -9, -7, 0, 4, -1, -10, 0, 8, 8, -7, -1, 3, 8, -3, -1, -6]))
21
+
22
+ test4 :: Test
23
+ test4 = TestCase (assertEqual "for (returnToBoundaryCount [-6, 0, 7, ( -4), ( -2), 5, 3, 4, 3, ( -7), 4, ( -6), 7, 8, ( -1), 5, 1, 10, ( -7), ( -6), 1, ( -5), 3, 8, ( -6), 5, ( -8), 10, ( -4), 3, ( -10), ( -3), ( -1), 10, 9, 10, ( -9), 10, ( -3), ( -3), ( -6), 0, 7, 4, 2, 0, 7, 2, ( -6)])," 1 (returnToBoundaryCount [-6, 0, 7, -4, -2, 5, 3, 4, 3, -7, 4, -6, 7, 8, -1, 5, 1, 10, -7, -6, 1, -5, 3, 8, -6, 5, -8, 10, -4, 3, -10, -3, -1, 10, 9, 10, -9, 10, -3, -3, -6, 0, 7, 4, 2, 0, 7, 2, -6]))
24
+
25
+ test5 :: Test
26
+ test5 = TestCase (assertEqual "for (returnToBoundaryCount [-2, 5, 1, ( -2), 7, ( -6), 6, 2, ( -2), ( -10), 10, 8, ( -3), 6])," 0 (returnToBoundaryCount [-2, 5, 1, -2, 7, -6, 6, 2, -2, -10, 10, 8, -3, 6]))
27
+
28
+ test6 :: Test
29
+ test6 = TestCase (assertEqual "for (returnToBoundaryCount [-2, ( -7), ( -7), ( -10), ( -10)])," 0 (returnToBoundaryCount [-2, -7, -7, -10, -10]))
30
+
31
+ test7 :: Test
32
+ test7 = TestCase (assertEqual "for (returnToBoundaryCount [-10, ( -9), 0])," 0 (returnToBoundaryCount [-10, -9, 0]))
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
ant_on_the_boundary/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(1, returnToBoundaryCount(Arrays.asList(2,3,-5)));
14
+ }
15
+ @Test
16
+ public void test2() {
17
+ assertEquals(0, returnToBoundaryCount(Arrays.asList(3,2,-3,-4)));
18
+ }
19
+
20
+ }
ant_on_the_boundary/meta.json ADDED
@@ -0,0 +1,165 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "id": 3311,
3
+ "name": "ant_on_the_boundary",
4
+ "difficulty": "Easy",
5
+ "link": "https://leetcode.com/problems/ant-on-the-boundary/",
6
+ "date": "2024-01-28 00:00:00",
7
+ "task_description": "An ant is on a boundary. It sometimes goes **left** and sometimes **right**. You are given an array of **non-zero** integers `nums`. The ant starts reading `nums` from the first element of it to its end. At each step, it moves according to the value of the current element: If `nums[i] < 0`, it moves **left** by `-nums[i]` units. If `nums[i] > 0`, it moves **right** by `nums[i]` units. Return _the number of times the ant **returns** to the boundary._ **Notes:** There is an infinite space on both sides of the boundary. We check whether the ant is on the boundary only after it has moved `|nums[i]|` units. In other words, if the ant crosses the boundary during its movement, it does not count. **Example 1:** ``` **Input:** nums = [2,3,-5] **Output:** 1 **Explanation:** After the first step, the ant is 2 steps to the right of the boundary. After the second step, the ant is 5 steps to the right of the boundary. After the third step, the ant is on the boundary. So the answer is 1. ``` **Example 2:** ``` **Input:** nums = [3,2,-3,-4] **Output:** 0 **Explanation:** After the first step, the ant is 3 steps to the right of the boundary. After the second step, the ant is 5 steps to the right of the boundary. After the third step, the ant is 2 steps to the right of the boundary. After the fourth step, the ant is 2 steps to the left of the boundary. The ant never returned to the boundary, so the answer is 0. ``` **Constraints:** `1 <= nums.length <= 100` `-10 <= nums[i] <= 10` `nums[i] != 0`",
8
+ "public_test_cases": [
9
+ {
10
+ "label": "Example 1",
11
+ "input": "nums = [2,3,-5]",
12
+ "output": "1 "
13
+ },
14
+ {
15
+ "label": "Example 2",
16
+ "input": "nums = [3,2,-3,-4]",
17
+ "output": "0 "
18
+ }
19
+ ],
20
+ "private_test_cases": [
21
+ {
22
+ "input": [
23
+ -10,
24
+ 9,
25
+ -10,
26
+ 10,
27
+ 1,
28
+ -8,
29
+ 5,
30
+ 9,
31
+ -7,
32
+ -9,
33
+ 2,
34
+ -8,
35
+ -1,
36
+ -5,
37
+ -7,
38
+ 7,
39
+ -5,
40
+ -2,
41
+ -3,
42
+ 9,
43
+ -9,
44
+ -9,
45
+ 9,
46
+ -3,
47
+ -7,
48
+ -6,
49
+ -9,
50
+ -7,
51
+ 0,
52
+ 4,
53
+ -1,
54
+ -10,
55
+ 0,
56
+ 8,
57
+ 8,
58
+ -7,
59
+ -1,
60
+ 3,
61
+ 8,
62
+ -3,
63
+ -1,
64
+ -6
65
+ ],
66
+ "output": 1
67
+ },
68
+ {
69
+ "input": [
70
+ -6,
71
+ 0,
72
+ 7,
73
+ -4,
74
+ -2,
75
+ 5,
76
+ 3,
77
+ 4,
78
+ 3,
79
+ -7,
80
+ 4,
81
+ -6,
82
+ 7,
83
+ 8,
84
+ -1,
85
+ 5,
86
+ 1,
87
+ 10,
88
+ -7,
89
+ -6,
90
+ 1,
91
+ -5,
92
+ 3,
93
+ 8,
94
+ -6,
95
+ 5,
96
+ -8,
97
+ 10,
98
+ -4,
99
+ 3,
100
+ -10,
101
+ -3,
102
+ -1,
103
+ 10,
104
+ 9,
105
+ 10,
106
+ -9,
107
+ 10,
108
+ -3,
109
+ -3,
110
+ -6,
111
+ 0,
112
+ 7,
113
+ 4,
114
+ 2,
115
+ 0,
116
+ 7,
117
+ 2,
118
+ -6
119
+ ],
120
+ "output": 1
121
+ },
122
+ {
123
+ "input": [
124
+ -2,
125
+ 5,
126
+ 1,
127
+ -2,
128
+ 7,
129
+ -6,
130
+ 6,
131
+ 2,
132
+ -2,
133
+ -10,
134
+ 10,
135
+ 8,
136
+ -3,
137
+ 6
138
+ ],
139
+ "output": 0
140
+ },
141
+ {
142
+ "input": [
143
+ -2,
144
+ -7,
145
+ -7,
146
+ -10,
147
+ -10
148
+ ],
149
+ "output": 0
150
+ },
151
+ {
152
+ "input": [
153
+ -10,
154
+ -9,
155
+ 0
156
+ ],
157
+ "output": 0
158
+ }
159
+ ],
160
+ "haskell_template": "returnToBoundaryCount :: [Int] -> Int\nreturnToBoundaryCount nums ",
161
+ "ocaml_template": "let returnToBoundaryCount (nums: int list) : int = ",
162
+ "scala_template": "def returnToBoundaryCount(nums: List[Int]): Int = { \n \n}",
163
+ "java_template": "class Solution {\n public int returnToBoundaryCount(int[] nums) {\n \n }\n}",
164
+ "python_template": "class Solution(object):\n def returnToBoundaryCount(self, nums):\n \"\"\"\n :type nums: List[int]\n :rtype: int\n \"\"\"\n "
165
+ }
ant_on_the_boundary/ocaml_tests/main.ml ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ module Main = struct
3
+ open OUnit2
4
+
5
+ (* Program start *)
6
+ let returnToBoundaryCount (nums: int list) : int = failwith "Not implemented"
7
+
8
+ (* Program end *)
9
+
10
+ (* Test cases *)
11
+
12
+ let test1 _ = assert_equal 1 (returnToBoundaryCount [2;3;-5])
13
+
14
+ let test2 _ = assert_equal 0 (returnToBoundaryCount [3;2;-3;-4])
15
+
16
+ let test3 _ = assert_equal 0 (returnToBoundaryCount [-10; 9; -10; 10; 1; -8; 5; 9; -7; -9; 2; -8; -1; -5; -7; 7; -5; -2; -3; 9; -9; -9; 9; -3; -7; -6; -9; -7; 0; 4; -1; -10; 0; 8; 8; -7; -1; 3; 8; -3; -1; -6])
17
+
18
+ let test4 _ = assert_equal 0 (returnToBoundaryCount [-6; 0; 7; -4; -2; 5; 3; 4; 3; -7; 4; -6; 7; 8; -1; 5; 1; 10; -7; -6; 1; -5; 3; 8; -6; 5; -8; 10; -4; 3; -10; -3; -1; 10; 9; 10; -9; 10; -3; -3; -6; 0; 7; 4; 2; 0; 7; 2; -6])
19
+
20
+ let test5 _ = assert_equal 0 (returnToBoundaryCount [-2; 5; 1; -2; 7; -6; 6; 2; -2; -10; 10; 8; -3; 6])
21
+
22
+ let test6 _ = assert_equal 0 (returnToBoundaryCount [-2; -7; -7; -10; -10])
23
+
24
+ let test7 _ = assert_equal 0 (returnToBoundaryCount [-10; -9; 0])
25
+
26
+
27
+ (* Grouping test cases *)
28
+ let suite = "Test Suite for returnToBoundaryCount" >::: [
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
ant_on_the_boundary/scala_tests/MySuite.scala ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ class MySuite extends munit.FunSuite {
3
+
4
+ test("test1") {
5
+ assertEquals(Main.returnToBoundaryCount(List(2,3,-5)), 1)
6
+ }
7
+
8
+ test("test2") {
9
+ assertEquals(Main.returnToBoundaryCount(List(3,2,-3,-4)), 0)
10
+ }
11
+
12
+ test("test3") {
13
+ assertEquals(Main.returnToBoundaryCount(-10,9,-10,10,1,-8,5,9,-7,-9,2,-8,-1,-5,-7,7,-5,-2,-3,9,-9,-9,9,-3,-7,-6,-9,-7,0,4,-1,-10,0,8,8,-7,-1,3,8,-3,-1,-6), 1)
14
+ }
15
+
16
+ test("test4") {
17
+ assertEquals(Main.returnToBoundaryCount(-6,0,7,-4,-2,5,3,4,3,-7,4,-6,7,8,-1,5,1,10,-7,-6,1,-5,3,8,-6,5,-8,10,-4,3,-10,-3,-1,10,9,10,-9,10,-3,-3,-6,0,7,4,2,0,7,2,-6), 1)
18
+ }
19
+
20
+ test("test5") {
21
+ assertEquals(Main.returnToBoundaryCount(-2,5,1,-2,7,-6,6,2,-2,-10,10,8,-3,6), 0)
22
+ }
23
+
24
+ test("test6") {
25
+ assertEquals(Main.returnToBoundaryCount(-2,-7,-7,-10,-10), 0)
26
+ }
27
+
28
+ test("test7") {
29
+ assertEquals(Main.returnToBoundaryCount(-10,-9,0), 0)
30
+ }
31
+
32
+ }
append_characters_to_string_to_make_subsequence/.DS_Store ADDED
Binary file (6.15 kB). View file
 
append_characters_to_string_to_make_subsequence/haskell_tests/Main.hs ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ module Main where
3
+ import Test.HUnit
4
+
5
+ --Program start
6
+
7
+ --Program end
8
+
9
+ -- Test cases
10
+
11
+ test1 :: Test
12
+ test1 = TestCase (assertEqual "for (appendCharacters \"coaching \" \"coding \")," 4 (appendCharacters "coaching" "coding"))
13
+
14
+ test2 :: Test
15
+ test2 = TestCase (assertEqual "for (appendCharacters \"abcde \" \"a \")," 0 (appendCharacters "abcde" "a"))
16
+
17
+ test3 :: Test
18
+ test3 = TestCase (assertEqual "for (appendCharacters \"z \" \"abcde \")," 5 (appendCharacters "z" "abcde"))
19
+
20
+
21
+ -- Grouping test cases
22
+ tests :: Test
23
+ tests = TestList [TestLabel "Test1" test1, TestLabel "Test2" test2]
24
+
25
+ -- Running the tests
26
+ main :: IO Counts
27
+ main = runTestTT tests
append_characters_to_string_to_make_subsequence/java_tests/Main.java ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import static org.junit.jupiter.api.Assertions.*;
3
+ import org.junit.jupiter.api.Test;
4
+ import java.util.List;
5
+ import java.util.Arrays;
6
+ import java.util.ArrayList;
7
+ public class Main {
8
+ //Program start
9
+
10
+ //Program end
11
+
12
+ @Test
13
+ public void test1() {
14
+ assertEquals(4, appendCharacters("coaching", "coding"));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals(0, appendCharacters("abcde", "a"));
19
+ }
20
+ @Test
21
+ public void test3() {
22
+ assertEquals(5, appendCharacters("z", "abcde"));
23
+ }
24
+
25
+ }
append_characters_to_string_to_make_subsequence/meta.json ADDED
The diff for this file is too large to render. See raw diff
 
append_characters_to_string_to_make_subsequence/ocaml_tests/main.ml ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ module Main = struct
3
+ open OUnit2
4
+
5
+ (* Program start *)
6
+
7
+ (* Program end *)
8
+
9
+ (* Test cases *)
10
+
11
+ let test1 _ = assert_equal 4 (appendCharacters "coaching" "coding")
12
+
13
+ let test2 _ = assert_equal 0 (appendCharacters "abcde" "a")
14
+
15
+ let test3 _ = assert_equal 5 (appendCharacters "z" "abcde")
16
+
17
+
18
+ (* Grouping test cases *)
19
+ let suite = "Test Suite for appendCharacters" >::: [
20
+
21
+ "test1" >:: test1;
22
+ "test2" >:: test2;
23
+ "test3" >:: test3;
24
+ ]
25
+
26
+
27
+ (* Running the tests *)
28
+ let () = run_test_tt_main suite
29
+ end
append_characters_to_string_to_make_subsequence/scala_tests/MySuite.scala ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ class MySuite extends munit.FunSuite {
3
+
4
+ test("test1") {
5
+ assertEquals(Main.appendCharacters("coaching","coding"), 4)
6
+ }
7
+
8
+ test("test2") {
9
+ assertEquals(Main.appendCharacters("abcde","a"), 0)
10
+ }
11
+
12
+ test("test3") {
13
+ assertEquals(Main.appendCharacters("z","abcde"), 5)
14
+ }
15
+
16
+ }