25c0f9f8e1f27f727e2ed32c449c9b0cb94ec5d2a15b8da916e63b13d895e141
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- .gitattributes +8 -0
- maximum_value_of_an_ordered_triplet_ii/scala_tests/MySuite.scala +0 -0
- maximum_white_tiles_covered_by_a_carpet/.DS_Store +0 -0
- maximum_white_tiles_covered_by_a_carpet/haskell_tests/Main.hs +24 -0
- maximum_white_tiles_covered_by_a_carpet/java_tests/Main.java +21 -0
- maximum_white_tiles_covered_by_a_carpet/meta.json +0 -0
- maximum_white_tiles_covered_by_a_carpet/ocaml_tests/main.ml +26 -0
- maximum_white_tiles_covered_by_a_carpet/scala_tests/MySuite.scala +12 -0
- maximum_xor_after_operations/haskell_tests/Main.hs +0 -0
- maximum_xor_after_operations/java_tests/Main.java +20 -0
- maximum_xor_after_operations/meta.json +0 -0
- maximum_xor_after_operations/ocaml_tests/main.ml +0 -0
- maximum_xor_after_operations/scala_tests/MySuite.scala +0 -0
- maximum_xor_product/java_tests/Main.java +25 -0
- maximum_xor_score_subarray_queries/haskell_tests/Main.hs +3 -0
- maximum_xor_score_subarray_queries/java_tests/Main.java +21 -0
- maximum_xor_score_subarray_queries/meta.json +3 -0
- maximum_xor_score_subarray_queries/ocaml_tests/main.ml +0 -0
- maximum_xor_score_subarray_queries/scala_tests/MySuite.scala +3 -0
- meeting_rooms_iii/.DS_Store +0 -0
- meeting_rooms_iii/haskell_tests/Main.hs +24 -0
- meeting_rooms_iii/java_tests/Main.java +21 -0
- meeting_rooms_iii/meta.json +3 -0
- meeting_rooms_iii/ocaml_tests/main.ml +26 -0
- meeting_rooms_iii/scala_tests/MySuite.scala +12 -0
- merge_similar_items/.DS_Store +0 -0
- merge_similar_items/haskell_tests/Main.hs +27 -0
- merge_similar_items/java_tests/Main.java +25 -0
- merge_similar_items/meta.json +31 -0
- merge_similar_items/ocaml_tests/main.ml +29 -0
- merge_similar_items/scala_tests/MySuite.scala +16 -0
- merge_two_2d_arrays_by_summing_values/.DS_Store +0 -0
- merge_two_2d_arrays_by_summing_values/haskell_tests/Main.hs +24 -0
- merge_two_2d_arrays_by_summing_values/java_tests/Main.java +21 -0
- merge_two_2d_arrays_by_summing_values/meta.json +0 -0
- merge_two_2d_arrays_by_summing_values/ocaml_tests/main.ml +26 -0
- merge_two_2d_arrays_by_summing_values/scala_tests/MySuite.scala +12 -0
- meta2/.DS_Store +3 -0
- meta2/add_edges_to_make_degrees_of_all_nodes_even/meta.json +3 -0
- meta2/all_divisions_with_the_highest_score_of_a_binary_array/meta.json +3 -0
- meta2/append_characters_to_string_to_make_subsequence/meta.json +0 -0
- mice_and_cheese/.DS_Store +0 -0
- mice_and_cheese/haskell_tests/Main.hs +24 -0
- mice_and_cheese/java_tests/Main.java +21 -0
- mice_and_cheese/meta.json +3 -0
- mice_and_cheese/ocaml_tests/main.ml +26 -0
- mice_and_cheese/scala_tests/MySuite.scala +12 -0
- min_max_game/haskell_tests/Main.hs +41 -0
- min_max_game/java_tests/Main.java +20 -0
- min_max_game/meta.json +448 -0
.gitattributes
CHANGED
|
@@ -200,3 +200,11 @@ maximum_sum_queries/scala_tests/MySuite.scala filter=lfs diff=lfs merge=lfs -tex
|
|
| 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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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
|
maximum_value_of_an_ordered_triplet_ii/scala_tests/MySuite.scala
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
maximum_white_tiles_covered_by_a_carpet/.DS_Store
ADDED
|
Binary file (6.15 kB). View file
|
|
|
maximum_white_tiles_covered_by_a_carpet/haskell_tests/Main.hs
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
module Main where
|
| 3 |
+
import Test.HUnit
|
| 4 |
+
|
| 5 |
+
--Program start
|
| 6 |
+
|
| 7 |
+
--Program end
|
| 8 |
+
|
| 9 |
+
-- Test cases
|
| 10 |
+
|
| 11 |
+
test1 :: Test
|
| 12 |
+
test1 = TestCase (assertEqual "for (maximumWhiteTiles [[1,5],[10,11],[12,18],[20,25],[30,32]] 10)," 9 (maximumWhiteTiles [[1,5],[10,11],[12,18],[20,25],[30,32]] 10))
|
| 13 |
+
|
| 14 |
+
test2 :: Test
|
| 15 |
+
test2 = TestCase (assertEqual "for (maximumWhiteTiles [[10,11],[1,1]] 2)," 2 (maximumWhiteTiles [[10,11],[1,1]] 2))
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
-- Grouping test cases
|
| 19 |
+
tests :: Test
|
| 20 |
+
tests = TestList [TestLabel "Test1" test1]
|
| 21 |
+
|
| 22 |
+
-- Running the tests
|
| 23 |
+
main :: IO Counts
|
| 24 |
+
main = runTestTT tests
|
maximum_white_tiles_covered_by_a_carpet/java_tests/Main.java
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
import static org.junit.jupiter.api.Assertions.*;
|
| 3 |
+
import org.junit.jupiter.api.Test;
|
| 4 |
+
import java.util.List;
|
| 5 |
+
import java.util.Arrays;
|
| 6 |
+
import java.util.ArrayList;
|
| 7 |
+
public class Main {
|
| 8 |
+
//Program start
|
| 9 |
+
|
| 10 |
+
//Program end
|
| 11 |
+
|
| 12 |
+
@Test
|
| 13 |
+
public void test1() {
|
| 14 |
+
assertEquals(9, maximumWhiteTiles(new ArrayList<>(Arrays.asList(new ArrayList<>(Arrays.asList(1,5)),new ArrayList<>(Arrays.asList(10,11)),new ArrayList<>(Arrays.asList(12,18)),new ArrayList<>(Arrays.asList(20,25)),new ArrayList<>(Arrays.asList(30,32)))), 10));
|
| 15 |
+
}
|
| 16 |
+
@Test
|
| 17 |
+
public void test2() {
|
| 18 |
+
assertEquals(2, maximumWhiteTiles(new ArrayList<>(Arrays.asList(new ArrayList<>(Arrays.asList(10,11)),new ArrayList<>(Arrays.asList(1,1)))), 2));
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
}
|
maximum_white_tiles_covered_by_a_carpet/meta.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
maximum_white_tiles_covered_by_a_carpet/ocaml_tests/main.ml
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
module Main = struct
|
| 3 |
+
open OUnit2
|
| 4 |
+
|
| 5 |
+
(* Program start *)
|
| 6 |
+
|
| 7 |
+
(* Program end *)
|
| 8 |
+
|
| 9 |
+
(* Test cases *)
|
| 10 |
+
|
| 11 |
+
let test1 _ = assert_equal 9 (maximumWhiteTiles [[1;5];[10;11];[12;18];[20;25];[30;32]] 10)
|
| 12 |
+
|
| 13 |
+
let test2 _ = assert_equal 2 (maximumWhiteTiles [[10;11];[1;1]] 2)
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
(* Grouping test cases *)
|
| 17 |
+
let suite = "Test Suite for maximumWhiteTiles" >::: [
|
| 18 |
+
|
| 19 |
+
"test1" >:: test1;
|
| 20 |
+
"test2" >:: test2;
|
| 21 |
+
]
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
(* Running the tests *)
|
| 25 |
+
let () = run_test_tt_main suite
|
| 26 |
+
end
|
maximum_white_tiles_covered_by_a_carpet/scala_tests/MySuite.scala
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
class MySuite extends munit.FunSuite {
|
| 3 |
+
|
| 4 |
+
test("test1") {
|
| 5 |
+
assertEquals(Main.maximumWhiteTiles(List(List(1,5),List(10,11),List(12,18),List(20,25),List(30,32)),10), 9)
|
| 6 |
+
}
|
| 7 |
+
|
| 8 |
+
test("test2") {
|
| 9 |
+
assertEquals(Main.maximumWhiteTiles(List(List(10,11),List(1,1)),2), 2)
|
| 10 |
+
}
|
| 11 |
+
|
| 12 |
+
}
|
maximum_xor_after_operations/haskell_tests/Main.hs
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
maximum_xor_after_operations/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(7, maximumXOR(Arrays.asList(3,2,4,6)));
|
| 14 |
+
}
|
| 15 |
+
@Test
|
| 16 |
+
public void test2() {
|
| 17 |
+
assertEquals(11, maximumXOR(Arrays.asList(1,2,3,9,2)));
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
}
|
maximum_xor_after_operations/meta.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
maximum_xor_after_operations/ocaml_tests/main.ml
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
maximum_xor_after_operations/scala_tests/MySuite.scala
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
maximum_xor_product/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(98, maximumXorProduct(12, 5, 4));
|
| 15 |
+
}
|
| 16 |
+
@Test
|
| 17 |
+
public void test2() {
|
| 18 |
+
assertEquals(930, maximumXorProduct(6, null, 5));
|
| 19 |
+
}
|
| 20 |
+
@Test
|
| 21 |
+
public void test3() {
|
| 22 |
+
assertEquals(12, maximumXorProduct(1, 6, 3));
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
}
|
maximum_xor_score_subarray_queries/haskell_tests/Main.hs
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:4e266ec00d710ea45451068d3ee04f949800b5360b8b140063dd6d86ba563008
|
| 3 |
+
size 11582852
|
maximum_xor_score_subarray_queries/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(12,60,60)), maximumSubarrayXor(new ArrayList<>(Arrays.asList(2,8,4,32,16,1)), new ArrayList<>(Arrays.asList(new ArrayList<>(Arrays.asList(0,2)),new ArrayList<>(Arrays.asList(1,4)),new ArrayList<>(Arrays.asList(0,5))))));
|
| 15 |
+
}
|
| 16 |
+
@Test
|
| 17 |
+
public void test2() {
|
| 18 |
+
assertEquals(new ArrayList<>(Arrays.asList(7,14,11,14,5)), maximumSubarrayXor(new ArrayList<>(Arrays.asList(0,7,3,2,8,5,1)), new ArrayList<>(Arrays.asList(new ArrayList<>(Arrays.asList(0,3)),new ArrayList<>(Arrays.asList(1,5)),new ArrayList<>(Arrays.asList(2,4)),new ArrayList<>(Arrays.asList(2,6)),new ArrayList<>(Arrays.asList(5,6))))));
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
}
|
maximum_xor_score_subarray_queries/meta.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f983ab61f31a4a41d437e5ecd1e0f7332b1739b97735c6a41a1c27c190f2d55e
|
| 3 |
+
size 76094991
|
maximum_xor_score_subarray_queries/ocaml_tests/main.ml
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
maximum_xor_score_subarray_queries/scala_tests/MySuite.scala
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ad595d65e8025ab242f5d5d285b58260a34591184927934091f88dfa7d4e4ccb
|
| 3 |
+
size 11599193
|
meeting_rooms_iii/.DS_Store
ADDED
|
Binary file (6.15 kB). View file
|
|
|
meeting_rooms_iii/haskell_tests/Main.hs
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
module Main where
|
| 3 |
+
import Test.HUnit
|
| 4 |
+
|
| 5 |
+
--Program start
|
| 6 |
+
|
| 7 |
+
--Program end
|
| 8 |
+
|
| 9 |
+
-- Test cases
|
| 10 |
+
|
| 11 |
+
test1 :: Test
|
| 12 |
+
test1 = TestCase (assertEqual "for (mostBooked 2 [[0,10],[1,5],[2,7],[3,4]])," 0 (mostBooked 2 [[0,10],[1,5],[2,7],[3,4]]))
|
| 13 |
+
|
| 14 |
+
test2 :: Test
|
| 15 |
+
test2 = TestCase (assertEqual "for (mostBooked 3 [[1,20],[2,10],[3,5],[4,9],[6,8]])," 1 (mostBooked 3 [[1,20],[2,10],[3,5],[4,9],[6,8]]))
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
-- Grouping test cases
|
| 19 |
+
tests :: Test
|
| 20 |
+
tests = TestList [TestLabel "Test1" test1]
|
| 21 |
+
|
| 22 |
+
-- Running the tests
|
| 23 |
+
main :: IO Counts
|
| 24 |
+
main = runTestTT tests
|
meeting_rooms_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(0, mostBooked(2, new ArrayList<>(Arrays.asList(new ArrayList<>(Arrays.asList(0,10)),new ArrayList<>(Arrays.asList(1,5)),new ArrayList<>(Arrays.asList(2,7)),new ArrayList<>(Arrays.asList(3,4))))));
|
| 15 |
+
}
|
| 16 |
+
@Test
|
| 17 |
+
public void test2() {
|
| 18 |
+
assertEquals(1, mostBooked(3, new ArrayList<>(Arrays.asList(new ArrayList<>(Arrays.asList(1,20)),new ArrayList<>(Arrays.asList(2,10)),new ArrayList<>(Arrays.asList(3,5)),new ArrayList<>(Arrays.asList(4,9)),new ArrayList<>(Arrays.asList(6,8))))));
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
}
|
meeting_rooms_iii/meta.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e006de142a20c68807c096ef7c488a80ff5e55ea3a681f7f114161d38fa598c2
|
| 3 |
+
size 63174616
|
meeting_rooms_iii/ocaml_tests/main.ml
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
module Main = struct
|
| 3 |
+
open OUnit2
|
| 4 |
+
|
| 5 |
+
(* Program start *)
|
| 6 |
+
|
| 7 |
+
(* Program end *)
|
| 8 |
+
|
| 9 |
+
(* Test cases *)
|
| 10 |
+
|
| 11 |
+
let test1 _ = assert_equal 0 (mostBooked 2 [[0;10];[1;5];[2;7];[3;4]])
|
| 12 |
+
|
| 13 |
+
let test2 _ = assert_equal 1 (mostBooked 3 [[1;20];[2;10];[3;5];[4;9];[6;8]])
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
(* Grouping test cases *)
|
| 17 |
+
let suite = "Test Suite for mostBooked" >::: [
|
| 18 |
+
|
| 19 |
+
"test1" >:: test1;
|
| 20 |
+
"test2" >:: test2;
|
| 21 |
+
]
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
(* Running the tests *)
|
| 25 |
+
let () = run_test_tt_main suite
|
| 26 |
+
end
|
meeting_rooms_iii/scala_tests/MySuite.scala
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
class MySuite extends munit.FunSuite {
|
| 3 |
+
|
| 4 |
+
test("test1") {
|
| 5 |
+
assertEquals(Main.mostBooked(2,List(List(0,10),List(1,5),List(2,7),List(3,4))), 0)
|
| 6 |
+
}
|
| 7 |
+
|
| 8 |
+
test("test2") {
|
| 9 |
+
assertEquals(Main.mostBooked(3,List(List(1,20),List(2,10),List(3,5),List(4,9),List(6,8))), 1)
|
| 10 |
+
}
|
| 11 |
+
|
| 12 |
+
}
|
merge_similar_items/.DS_Store
ADDED
|
Binary file (6.15 kB). View file
|
|
|
merge_similar_items/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 (mergeSimilarItems [[1,1],[4,5],[3,8]] [[3,1],[1,5]])," [[1,6],[3,9],[4,5]] (mergeSimilarItems [[1,1],[4,5],[3,8]] [[3,1],[1,5]]))
|
| 13 |
+
|
| 14 |
+
test2 :: Test
|
| 15 |
+
test2 = TestCase (assertEqual "for (mergeSimilarItems [[1,1],[3,2],[2,3]] [[2,1],[3,2],[1,3]])," [[1,4],[2,4],[3,4]] (mergeSimilarItems [[1,1],[3,2],[2,3]] [[2,1],[3,2],[1,3]]))
|
| 16 |
+
|
| 17 |
+
test3 :: Test
|
| 18 |
+
test3 = TestCase (assertEqual "for (mergeSimilarItems [[1,3],[2,2]] [[7,1],[2,2],[1,4]])," [[1,7],[2,4],[7,1]] (mergeSimilarItems [[1,3],[2,2]] [[7,1],[2,2],[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
|
merge_similar_items/java_tests/Main.java
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
import static org.junit.jupiter.api.Assertions.*;
|
| 3 |
+
import org.junit.jupiter.api.Test;
|
| 4 |
+
import java.util.List;
|
| 5 |
+
import java.util.Arrays;
|
| 6 |
+
import java.util.ArrayList;
|
| 7 |
+
public class Main {
|
| 8 |
+
//Program start
|
| 9 |
+
|
| 10 |
+
//Program end
|
| 11 |
+
|
| 12 |
+
@Test
|
| 13 |
+
public void test1() {
|
| 14 |
+
assertEquals(new ArrayList<>(Arrays.asList(new ArrayList<>(Arrays.asList(1,6)),new ArrayList<>(Arrays.asList(3,9)),new ArrayList<>(Arrays.asList(4,5)))), mergeSimilarItems(new ArrayList<>(Arrays.asList(new ArrayList<>(Arrays.asList(1,1)),new ArrayList<>(Arrays.asList(4,5)),new ArrayList<>(Arrays.asList(3,8)))), new ArrayList<>(Arrays.asList(new ArrayList<>(Arrays.asList(3,1)),new ArrayList<>(Arrays.asList(1,5))))));
|
| 15 |
+
}
|
| 16 |
+
@Test
|
| 17 |
+
public void test2() {
|
| 18 |
+
assertEquals(new ArrayList<>(Arrays.asList(new ArrayList<>(Arrays.asList(1,4)),new ArrayList<>(Arrays.asList(2,4)),new ArrayList<>(Arrays.asList(3,4)))), mergeSimilarItems(new ArrayList<>(Arrays.asList(new ArrayList<>(Arrays.asList(1,1)),new ArrayList<>(Arrays.asList(3,2)),new ArrayList<>(Arrays.asList(2,3)))), new ArrayList<>(Arrays.asList(new ArrayList<>(Arrays.asList(2,1)),new ArrayList<>(Arrays.asList(3,2)),new ArrayList<>(Arrays.asList(1,3))))));
|
| 19 |
+
}
|
| 20 |
+
@Test
|
| 21 |
+
public void test3() {
|
| 22 |
+
assertEquals(new ArrayList<>(Arrays.asList(new ArrayList<>(Arrays.asList(1,7)),new ArrayList<>(Arrays.asList(2,4)),new ArrayList<>(Arrays.asList(7,1)))), mergeSimilarItems(new ArrayList<>(Arrays.asList(new ArrayList<>(Arrays.asList(1,3)),new ArrayList<>(Arrays.asList(2,2)))), new ArrayList<>(Arrays.asList(new ArrayList<>(Arrays.asList(7,1)),new ArrayList<>(Arrays.asList(2,2)),new ArrayList<>(Arrays.asList(1,4))))));
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
}
|
merge_similar_items/meta.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"id": 2447,
|
| 3 |
+
"name": "merge_similar_items",
|
| 4 |
+
"difficulty": "Easy",
|
| 5 |
+
"link": "https://leetcode.com/problems/merge-similar-items/",
|
| 6 |
+
"date": "1658534400000",
|
| 7 |
+
"task_description": "You are given two 2D integer arrays, `items1` and `items2`, representing two sets of items. Each array `items` has the following properties: `items[i] = [valuei, weighti]` where `valuei` represents the **value** and `weighti` represents the **weight **of the `ith` item. The value of each item in `items` is **unique**. Return _a 2D integer array_ `ret` _where_ `ret[i] = [valuei, weighti]`_,_ _with_ `weighti` _being the **sum of weights** of all items with value_ `valuei`. **Note:** `ret` should be returned in **ascending** order by value. **Example 1:** ``` **Input:** items1 = [[1,1],[4,5],[3,8]], items2 = [[3,1],[1,5]] **Output:** [[1,6],[3,9],[4,5]] **Explanation:** The item with value = 1 occurs in items1 with weight = 1 and in items2 with weight = 5, total weight = 1 + 5 = 6. The item with value = 3 occurs in items1 with weight = 8 and in items2 with weight = 1, total weight = 8 + 1 = 9. The item with value = 4 occurs in items1 with weight = 5, total weight = 5. Therefore, we return [[1,6],[3,9],[4,5]]. ``` **Example 2:** ``` **Input:** items1 = [[1,1],[3,2],[2,3]], items2 = [[2,1],[3,2],[1,3]] **Output:** [[1,4],[2,4],[3,4]] **Explanation:** The item with value = 1 occurs in items1 with weight = 1 and in items2 with weight = 3, total weight = 1 + 3 = 4. The item with value = 2 occurs in items1 with weight = 3 and in items2 with weight = 1, total weight = 3 + 1 = 4. The item with value = 3 occurs in items1 with weight = 2 and in items2 with weight = 2, total weight = 2 + 2 = 4. Therefore, we return [[1,4],[2,4],[3,4]]. ``` **Example 3:** ``` **Input:** items1 = [[1,3],[2,2]], items2 = [[7,1],[2,2],[1,4]] **Output:** [[1,7],[2,4],[7,1]] **Explanation: **The item with value = 1 occurs in items1 with weight = 3 and in items2 with weight = 4, total weight = 3 + 4 = 7. The item with value = 2 occurs in items1 with weight = 2 and in items2 with weight = 2, total weight = 2 + 2 = 4. The item with value = 7 occurs in items2 with weight = 1, total weight = 1. Therefore, we return [[1,7],[2,4],[7,1]]. ``` **Constraints:** `1 <= items1.length, items2.length <= 1000` `items1[i].length == items2[i].length == 2` `1 <= valuei, weighti <= 1000` Each `valuei` in `items1` is **unique**. Each `valuei` in `items2` is **unique**.",
|
| 8 |
+
"public_test_cases": [
|
| 9 |
+
{
|
| 10 |
+
"label": "Example 1",
|
| 11 |
+
"input": "items1 = [[1,1],[4,5],[3,8]], items2 = [[3,1],[1,5]]",
|
| 12 |
+
"output": "[[1,6],[3,9],[4,5]] "
|
| 13 |
+
},
|
| 14 |
+
{
|
| 15 |
+
"label": "Example 2",
|
| 16 |
+
"input": "items1 = [[1,1],[3,2],[2,3]], items2 = [[2,1],[3,2],[1,3]]",
|
| 17 |
+
"output": "[[1,4],[2,4],[3,4]] "
|
| 18 |
+
},
|
| 19 |
+
{
|
| 20 |
+
"label": "Example 3",
|
| 21 |
+
"input": "items1 = [[1,3],[2,2]], items2 = [[7,1],[2,2],[1,4]]",
|
| 22 |
+
"output": "[[1,7],[2,4],[7,1]] "
|
| 23 |
+
}
|
| 24 |
+
],
|
| 25 |
+
"private_test_cases": [],
|
| 26 |
+
"haskell_template": "mergeSimilarItems :: [[Int]] -> [[Int]] -> [[Int]]\nmergeSimilarItems items1 items2 ",
|
| 27 |
+
"ocaml_template": "let mergeSimilarItems (items1: int list list) (items2: int list list) : int list list = ",
|
| 28 |
+
"scala_template": "def mergeSimilarItems(items1: List[List[Int]],items2: List[List[Int]]): List[List[Int]] = { \n \n}",
|
| 29 |
+
"java_template": "public static List<List<Integer>> mergeSimilarItems(List<List<Integer>> items1, List<List<Integer>> items2) {\n\n}",
|
| 30 |
+
"python_template": "class Solution(object):\n def mergeSimilarItems(self, items1, items2):\n \"\"\"\n :type items1: List[List[int]]\n :type items2: List[List[int]]\n :rtype: List[List[int]]\n \"\"\"\n "
|
| 31 |
+
}
|
merge_similar_items/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 [[1;6];[3;9];[4;5]] (mergeSimilarItems [[1;1];[4;5];[3;8]] [[3;1];[1;5]])
|
| 12 |
+
|
| 13 |
+
let test2 _ = assert_equal [[1;4];[2;4];[3;4]] (mergeSimilarItems [[1;1];[3;2];[2;3]] [[2;1];[3;2];[1;3]])
|
| 14 |
+
|
| 15 |
+
let test3 _ = assert_equal [[1;7];[2;4];[7;1]] (mergeSimilarItems [[1;3];[2;2]] [[7;1];[2;2];[1;4]])
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
(* Grouping test cases *)
|
| 19 |
+
let suite = "Test Suite for mergeSimilarItems" >::: [
|
| 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
|
merge_similar_items/scala_tests/MySuite.scala
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
class MySuite extends munit.FunSuite {
|
| 3 |
+
|
| 4 |
+
test("test1") {
|
| 5 |
+
assertEquals(Main.mergeSimilarItems(List(List(1,1),List(4,5),List(3,8)),List(List(3,1),List(1,5))), List(List(1,6),List(3,9),List(4,5)))
|
| 6 |
+
}
|
| 7 |
+
|
| 8 |
+
test("test2") {
|
| 9 |
+
assertEquals(Main.mergeSimilarItems(List(List(1,1),List(3,2),List(2,3)),List(List(2,1),List(3,2),List(1,3))), List(List(1,4),List(2,4),List(3,4)))
|
| 10 |
+
}
|
| 11 |
+
|
| 12 |
+
test("test3") {
|
| 13 |
+
assertEquals(Main.mergeSimilarItems(List(List(1,3),List(2,2)),List(List(7,1),List(2,2),List(1,4))), List(List(1,7),List(2,4),List(7,1)))
|
| 14 |
+
}
|
| 15 |
+
|
| 16 |
+
}
|
merge_two_2d_arrays_by_summing_values/.DS_Store
ADDED
|
Binary file (6.15 kB). View file
|
|
|
merge_two_2d_arrays_by_summing_values/haskell_tests/Main.hs
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
module Main where
|
| 3 |
+
import Test.HUnit
|
| 4 |
+
|
| 5 |
+
--Program start
|
| 6 |
+
|
| 7 |
+
--Program end
|
| 8 |
+
|
| 9 |
+
-- Test cases
|
| 10 |
+
|
| 11 |
+
test1 :: Test
|
| 12 |
+
test1 = TestCase (assertEqual "for (mergeArrays [[1,2],[2,3],[4,5]] [[1,4],[3,2],[4,1]])," [[1,6],[2,3],[3,2],[4,6]] (mergeArrays [[1,2],[2,3],[4,5]] [[1,4],[3,2],[4,1]]))
|
| 13 |
+
|
| 14 |
+
test2 :: Test
|
| 15 |
+
test2 = TestCase (assertEqual "for (mergeArrays [[2,4],[3,6],[5,5]] [[1,3],[4,3]])," [[1,3],[2,4],[3,6],[4,3],[5,5]] (mergeArrays [[2,4],[3,6],[5,5]] [[1,3],[4,3]]))
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
-- Grouping test cases
|
| 19 |
+
tests :: Test
|
| 20 |
+
tests = TestList [TestLabel "Test1" test1]
|
| 21 |
+
|
| 22 |
+
-- Running the tests
|
| 23 |
+
main :: IO Counts
|
| 24 |
+
main = runTestTT tests
|
merge_two_2d_arrays_by_summing_values/java_tests/Main.java
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
import static org.junit.jupiter.api.Assertions.*;
|
| 3 |
+
import org.junit.jupiter.api.Test;
|
| 4 |
+
import java.util.List;
|
| 5 |
+
import java.util.Arrays;
|
| 6 |
+
import java.util.ArrayList;
|
| 7 |
+
public class Main {
|
| 8 |
+
//Program start
|
| 9 |
+
|
| 10 |
+
//Program end
|
| 11 |
+
|
| 12 |
+
@Test
|
| 13 |
+
public void test1() {
|
| 14 |
+
assertEquals(new ArrayList<>(Arrays.asList(new ArrayList<>(Arrays.asList(1,6)),new ArrayList<>(Arrays.asList(2,3)),new ArrayList<>(Arrays.asList(3,2)),new ArrayList<>(Arrays.asList(4,6)))), mergeArrays(new ArrayList<>(Arrays.asList(new ArrayList<>(Arrays.asList(1,2)),new ArrayList<>(Arrays.asList(2,3)),new ArrayList<>(Arrays.asList(4,5)))), new ArrayList<>(Arrays.asList(new ArrayList<>(Arrays.asList(1,4)),new ArrayList<>(Arrays.asList(3,2)),new ArrayList<>(Arrays.asList(4,1))))));
|
| 15 |
+
}
|
| 16 |
+
@Test
|
| 17 |
+
public void test2() {
|
| 18 |
+
assertEquals(new ArrayList<>(Arrays.asList(new ArrayList<>(Arrays.asList(1,3)),new ArrayList<>(Arrays.asList(2,4)),new ArrayList<>(Arrays.asList(3,6)),new ArrayList<>(Arrays.asList(4,3)),new ArrayList<>(Arrays.asList(5,5)))), mergeArrays(new ArrayList<>(Arrays.asList(new ArrayList<>(Arrays.asList(2,4)),new ArrayList<>(Arrays.asList(3,6)),new ArrayList<>(Arrays.asList(5,5)))), new ArrayList<>(Arrays.asList(new ArrayList<>(Arrays.asList(1,3)),new ArrayList<>(Arrays.asList(4,3))))));
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
}
|
merge_two_2d_arrays_by_summing_values/meta.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
merge_two_2d_arrays_by_summing_values/ocaml_tests/main.ml
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
module Main = struct
|
| 3 |
+
open OUnit2
|
| 4 |
+
|
| 5 |
+
(* Program start *)
|
| 6 |
+
|
| 7 |
+
(* Program end *)
|
| 8 |
+
|
| 9 |
+
(* Test cases *)
|
| 10 |
+
|
| 11 |
+
let test1 _ = assert_equal [[1;6];[2;3];[3;2];[4;6]] (mergeArrays [[1;2];[2;3];[4;5]] [[1;4];[3;2];[4;1]])
|
| 12 |
+
|
| 13 |
+
let test2 _ = assert_equal [[1;3];[2;4];[3;6];[4;3];[5;5]] (mergeArrays [[2;4];[3;6];[5;5]] [[1;3];[4;3]])
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
(* Grouping test cases *)
|
| 17 |
+
let suite = "Test Suite for mergeArrays" >::: [
|
| 18 |
+
|
| 19 |
+
"test1" >:: test1;
|
| 20 |
+
"test2" >:: test2;
|
| 21 |
+
]
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
(* Running the tests *)
|
| 25 |
+
let () = run_test_tt_main suite
|
| 26 |
+
end
|
merge_two_2d_arrays_by_summing_values/scala_tests/MySuite.scala
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
class MySuite extends munit.FunSuite {
|
| 3 |
+
|
| 4 |
+
test("test1") {
|
| 5 |
+
assertEquals(Main.mergeArrays(List(List(1,2),List(2,3),List(4,5)),List(List(1,4),List(3,2),List(4,1))), List(List(1,6),List(2,3),List(3,2),List(4,6)))
|
| 6 |
+
}
|
| 7 |
+
|
| 8 |
+
test("test2") {
|
| 9 |
+
assertEquals(Main.mergeArrays(List(List(2,4),List(3,6),List(5,5)),List(List(1,3),List(4,3))), List(List(1,3),List(2,4),List(3,6),List(4,3),List(5,5)))
|
| 10 |
+
}
|
| 11 |
+
|
| 12 |
+
}
|
meta2/.DS_Store
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d656bb7112e35bf5f0a11dc264669b1b8115ebf9fb85bed3d52b6810906ed470
|
| 3 |
+
size 161796
|
meta2/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
|
meta2/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
|
meta2/append_characters_to_string_to_make_subsequence/meta.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
mice_and_cheese/.DS_Store
ADDED
|
Binary file (6.15 kB). View file
|
|
|
mice_and_cheese/haskell_tests/Main.hs
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
module Main where
|
| 3 |
+
import Test.HUnit
|
| 4 |
+
|
| 5 |
+
--Program start
|
| 6 |
+
|
| 7 |
+
--Program end
|
| 8 |
+
|
| 9 |
+
-- Test cases
|
| 10 |
+
|
| 11 |
+
test1 :: Test
|
| 12 |
+
test1 = TestCase (assertEqual "for (miceAndCheese [1,1,3,4] [4,4,1,1] 2)," 15 (miceAndCheese [1,1,3,4] [4,4,1,1] 2))
|
| 13 |
+
|
| 14 |
+
test2 :: Test
|
| 15 |
+
test2 = TestCase (assertEqual "for (miceAndCheese [1,1] [1,1] 2)," 2 (miceAndCheese [1,1] [1,1] 2))
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
-- Grouping test cases
|
| 19 |
+
tests :: Test
|
| 20 |
+
tests = TestList [TestLabel "Test1" test1]
|
| 21 |
+
|
| 22 |
+
-- Running the tests
|
| 23 |
+
main :: IO Counts
|
| 24 |
+
main = runTestTT tests
|
mice_and_cheese/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(15, miceAndCheese(new ArrayList<>(Arrays.asList(1,1,3,4)), new ArrayList<>(Arrays.asList(4,4,1,1)), 2));
|
| 15 |
+
}
|
| 16 |
+
@Test
|
| 17 |
+
public void test2() {
|
| 18 |
+
assertEquals(2, miceAndCheese(new ArrayList<>(Arrays.asList(1,1)), new ArrayList<>(Arrays.asList(1,1)), 2));
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
}
|
mice_and_cheese/meta.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:853bc0cb52f147198ac93c56242802a69c394924c3beddba9f0fbd16e1e0d6d1
|
| 3 |
+
size 24826569
|
mice_and_cheese/ocaml_tests/main.ml
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
module Main = struct
|
| 3 |
+
open OUnit2
|
| 4 |
+
|
| 5 |
+
(* Program start *)
|
| 6 |
+
|
| 7 |
+
(* Program end *)
|
| 8 |
+
|
| 9 |
+
(* Test cases *)
|
| 10 |
+
|
| 11 |
+
let test1 _ = assert_equal 15 (miceAndCheese [1;1;3;4] [4;4;1;1] 2)
|
| 12 |
+
|
| 13 |
+
let test2 _ = assert_equal 2 (miceAndCheese [1;1] [1;1] 2)
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
(* Grouping test cases *)
|
| 17 |
+
let suite = "Test Suite for miceAndCheese" >::: [
|
| 18 |
+
|
| 19 |
+
"test1" >:: test1;
|
| 20 |
+
"test2" >:: test2;
|
| 21 |
+
]
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
(* Running the tests *)
|
| 25 |
+
let () = run_test_tt_main suite
|
| 26 |
+
end
|
mice_and_cheese/scala_tests/MySuite.scala
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
class MySuite extends munit.FunSuite {
|
| 3 |
+
|
| 4 |
+
test("test1") {
|
| 5 |
+
assertEquals(Main.miceAndCheese(List(1,1,3,4),List(4,4,1,1),2), 15)
|
| 6 |
+
}
|
| 7 |
+
|
| 8 |
+
test("test2") {
|
| 9 |
+
assertEquals(Main.miceAndCheese(List(1,1),List(1,1),2), 2)
|
| 10 |
+
}
|
| 11 |
+
|
| 12 |
+
}
|
min_max_game/haskell_tests/Main.hs
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
module Main where
|
| 3 |
+
import Test.HUnit
|
| 4 |
+
|
| 5 |
+
--Program start
|
| 6 |
+
minMaxGame :: [Int] -> Int
|
| 7 |
+
minMaxGame nums = undefined
|
| 8 |
+
|
| 9 |
+
--Program end
|
| 10 |
+
|
| 11 |
+
-- Test cases
|
| 12 |
+
|
| 13 |
+
test1 :: Test
|
| 14 |
+
test1 = TestCase (assertEqual "for (minMaxGame [1,3,5,2,4,8,2,2])," 1 (minMaxGame [1,3,5,2,4,8,2,2]))
|
| 15 |
+
|
| 16 |
+
test2 :: Test
|
| 17 |
+
test2 = TestCase (assertEqual "for (minMaxGame [3])," 3 (minMaxGame [3]))
|
| 18 |
+
|
| 19 |
+
test3 :: Test
|
| 20 |
+
test3 = TestCase (assertEqual "for (minMaxGame [115040532, 691122985, 74905644, 691122985, 74905644, 488737920, 409049507, 691122985, 74905644, 424016316, 139550887, 488737920, 409049507, 778486804, 581936863, 691122985, 74905644, 898320970, 424016316, 316332152, 322747948, 139550887, 10127500, 488737920, 409049507, 714000633, 529661213, 778486804, 581936863, 766268468, 256616097, 691122985, 893168349, 74905644, 898320970, 562091841, 623374598, 424016316, 316332152, 175024652, 322747948, 421471664, 139550887, 27323869, 10127500, 285386703, 54510532, 488737920, 920450369, 409049507, 714000633, 376483632, 529661213, 689244382, 749711836, 778486804, 581936863, 952610726, 46933645, 766268468, 256616097, 930245976, 109029077, 691122985])," 115040532 (minMaxGame [115040532, 691122985, 74905644, 691122985, 74905644, 488737920, 409049507, 691122985, 74905644, 424016316, 139550887, 488737920, 409049507, 778486804, 581936863, 691122985, 74905644, 898320970, 424016316, 316332152, 322747948, 139550887, 10127500, 488737920, 409049507, 714000633, 529661213, 778486804, 581936863, 766268468, 256616097, 691122985, 893168349, 74905644, 898320970, 562091841, 623374598, 424016316, 316332152, 175024652, 322747948, 421471664, 139550887, 27323869, 10127500, 285386703, 54510532, 488737920, 920450369, 409049507, 714000633, 376483632, 529661213, 689244382, 749711836, 778486804, 581936863, 952610726, 46933645, 766268468, 256616097, 930245976, 109029077, 691122985]))
|
| 21 |
+
|
| 22 |
+
test4 :: Test
|
| 23 |
+
test4 = TestCase (assertEqual "for (minMaxGame [422752264, 444626536, 383451709, 444626536, 964694290, 383451709, 444626536, 354937044])," 422752264 (minMaxGame [422752264, 444626536, 383451709, 444626536, 964694290, 383451709, 444626536, 354937044]))
|
| 24 |
+
|
| 25 |
+
test5 :: Test
|
| 26 |
+
test5 = TestCase (assertEqual "for (minMaxGame [347432181, 347432181, 347432181, 253225415])," 347432181 (minMaxGame [347432181, 347432181, 347432181, 253225415]))
|
| 27 |
+
|
| 28 |
+
test6 :: Test
|
| 29 |
+
test6 = TestCase (assertEqual "for (minMaxGame [277872296, 945927896, 351536846, 945927896, 351536846, 505308252, 355276338, 945927896, 351536846, 740924939, 38550376, 505308252, 355276338, 720623023, 50265300, 945927896, 351536846, 818710986, 268024035, 740924939, 38550376, 917469833, 218828997, 505308252, 355276338, 675186659, 272427923, 720623023, 50265300, 349134637, 197930247, 945927896, 351536846, 933128750, 89429569, 818710986, 268024035, 630711263, 740924939, 442693871, 38550376, 987228952, 110075355, 917469833, 218828997, 825822362, 168084080, 505308252, 355276338, 930388442, 188207825, 675186659, 272427923, 816044008, 613681487, 720623023, 50265300, 918806830, 349134637, 278273618, 197930247, 846327293, 114080947, 945927896, 351536846, 962339954, 153247899, 933128750, 89429569, 949890359, 736501846, 818710986, 268024035, 936649815, 630711263, 623451241, 740924939, 784006358, 364968461, 442693871, 38550376, 827637389, 775002894, 987228952, 110075355, 898363618, 496412781, 917469833, 218828997, 775423695, 299108265, 825822362, 168084080, 655056704, 55736741, 505308252, 355276338, 822549513, 165382074, 930388442, 188207825, 623202735, 97039735, 675186659, 272427923, 899139750, 58820112, 816044008, 613681487, 692107265, 446140510, 720623023, 50265300, 786653476, 631607382, 918806830, 738179041, 349134637, 3081800, 278273618, 197930247, 814391196, 846327293, 839751160, 114080947, 766307757, 394016082, 945927896, 842046573, 351536846, 581539229, 962339954, 153247899, 893052643, 933128750, 886264387, 237453609, 89429569, 168548190, 949890359, 736501846, 874536926, 390388306, 818710986, 268024035, 930890158, 936649815, 787292160, 630711263, 790680442, 623451241, 528577751, 757668896, 740924939, 540340338, 784006358, 364968461, 634924643, 442693871, 402084206, 38550376, 50388559, 486527953, 827637389, 889740846, 775002894, 987228952, 711758512, 110075355, 554558129, 898363618, 430338156, 855273022, 496412781, 917469833, 513275787, 287567580, 218828997, 775423695, 544183099, 960564854, 299108265, 403334797, 825822362, 168084080, 420433761, 257316455, 655056704, 614047974, 55736741, 55437983, 505308252, 355276338, 829117431, 425539800, 822549513, 473149306, 165382074, 930388442, 219356010, 188207825, 221601673, 339915824, 623202735, 97039735, 643265311, 675186659, 302235312, 801212847, 272427923, 899139750, 473530827, 701114055, 58820112, 103017505, 816044008, 613681487, 819740209, 623887143, 692107265, 446140510, 818007276, 45103587, 720623023, 50265300, 236708934, 646052908, 786653476, 631607382, 943759801, 918806830, 256451102, 738179041, 798967010, 56615261, 349134637, 3081800, 585996046, 278273618, 187195679, 365793711, 197930247, 814391196, 1711047, 846327293, 989073716, 454322636, 839751160, 803562099, 114080947, 656466739, 766307757, 829671791, 394016082, 945927896, 556552137])," 277872296 (minMaxGame [277872296, 945927896, 351536846, 945927896, 351536846, 505308252, 355276338, 945927896, 351536846, 740924939, 38550376, 505308252, 355276338, 720623023, 50265300, 945927896, 351536846, 818710986, 268024035, 740924939, 38550376, 917469833, 218828997, 505308252, 355276338, 675186659, 272427923, 720623023, 50265300, 349134637, 197930247, 945927896, 351536846, 933128750, 89429569, 818710986, 268024035, 630711263, 740924939, 442693871, 38550376, 987228952, 110075355, 917469833, 218828997, 825822362, 168084080, 505308252, 355276338, 930388442, 188207825, 675186659, 272427923, 816044008, 613681487, 720623023, 50265300, 918806830, 349134637, 278273618, 197930247, 846327293, 114080947, 945927896, 351536846, 962339954, 153247899, 933128750, 89429569, 949890359, 736501846, 818710986, 268024035, 936649815, 630711263, 623451241, 740924939, 784006358, 364968461, 442693871, 38550376, 827637389, 775002894, 987228952, 110075355, 898363618, 496412781, 917469833, 218828997, 775423695, 299108265, 825822362, 168084080, 655056704, 55736741, 505308252, 355276338, 822549513, 165382074, 930388442, 188207825, 623202735, 97039735, 675186659, 272427923, 899139750, 58820112, 816044008, 613681487, 692107265, 446140510, 720623023, 50265300, 786653476, 631607382, 918806830, 738179041, 349134637, 3081800, 278273618, 197930247, 814391196, 846327293, 839751160, 114080947, 766307757, 394016082, 945927896, 842046573, 351536846, 581539229, 962339954, 153247899, 893052643, 933128750, 886264387, 237453609, 89429569, 168548190, 949890359, 736501846, 874536926, 390388306, 818710986, 268024035, 930890158, 936649815, 787292160, 630711263, 790680442, 623451241, 528577751, 757668896, 740924939, 540340338, 784006358, 364968461, 634924643, 442693871, 402084206, 38550376, 50388559, 486527953, 827637389, 889740846, 775002894, 987228952, 711758512, 110075355, 554558129, 898363618, 430338156, 855273022, 496412781, 917469833, 513275787, 287567580, 218828997, 775423695, 544183099, 960564854, 299108265, 403334797, 825822362, 168084080, 420433761, 257316455, 655056704, 614047974, 55736741, 55437983, 505308252, 355276338, 829117431, 425539800, 822549513, 473149306, 165382074, 930388442, 219356010, 188207825, 221601673, 339915824, 623202735, 97039735, 643265311, 675186659, 302235312, 801212847, 272427923, 899139750, 473530827, 701114055, 58820112, 103017505, 816044008, 613681487, 819740209, 623887143, 692107265, 446140510, 818007276, 45103587, 720623023, 50265300, 236708934, 646052908, 786653476, 631607382, 943759801, 918806830, 256451102, 738179041, 798967010, 56615261, 349134637, 3081800, 585996046, 278273618, 187195679, 365793711, 197930247, 814391196, 1711047, 846327293, 989073716, 454322636, 839751160, 803562099, 114080947, 656466739, 766307757, 829671791, 394016082, 945927896, 556552137]))
|
| 30 |
+
|
| 31 |
+
test7 :: Test
|
| 32 |
+
test7 = TestCase (assertEqual "for (minMaxGame [439363306, 983086361, 18639521, 983086361, 18639521, 926360015, 429073836, 983086361, 18639521, 618347797, 331389171, 926360015, 429073836, 823614485, 206463919, 983086361, 18639521, 551614501, 528697263, 618347797, 729566617, 331389171, 806609119, 926360015, 429073836, 906955449, 28743328, 823614485, 575701114, 206463919, 430845510, 983086361, 18639521, 476762353, 551614501, 483033277, 528697263, 757187572, 618347797, 289394534, 930884662, 729566617, 331389171, 248606565, 828364048, 806609119, 104101301, 926360015, 586131558, 429073836, 124381100, 906955449, 871344524, 28743328, 372630435, 823614485, 575701114, 898787203, 206463919, 11428664, 430845510, 479380797, 101634865, 983086361])," 439363306 (minMaxGame [439363306, 983086361, 18639521, 983086361, 18639521, 926360015, 429073836, 983086361, 18639521, 618347797, 331389171, 926360015, 429073836, 823614485, 206463919, 983086361, 18639521, 551614501, 528697263, 618347797, 729566617, 331389171, 806609119, 926360015, 429073836, 906955449, 28743328, 823614485, 575701114, 206463919, 430845510, 983086361, 18639521, 476762353, 551614501, 483033277, 528697263, 757187572, 618347797, 289394534, 930884662, 729566617, 331389171, 248606565, 828364048, 806609119, 104101301, 926360015, 586131558, 429073836, 124381100, 906955449, 871344524, 28743328, 372630435, 823614485, 575701114, 898787203, 206463919, 11428664, 430845510, 479380797, 101634865, 983086361]))
|
| 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
|
min_max_game/java_tests/Main.java
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
import static org.junit.jupiter.api.Assertions.*;
|
| 3 |
+
import org.junit.jupiter.api.Test;
|
| 4 |
+
import java.util.List;
|
| 5 |
+
import java.util.Arrays;
|
| 6 |
+
public class Main {
|
| 7 |
+
//Program start
|
| 8 |
+
|
| 9 |
+
//Program end
|
| 10 |
+
|
| 11 |
+
@Test
|
| 12 |
+
public void test1() {
|
| 13 |
+
assertEquals(1, minMaxGame(Arrays.asList(1,3,5,2,4,8,2,2)));
|
| 14 |
+
}
|
| 15 |
+
@Test
|
| 16 |
+
public void test2() {
|
| 17 |
+
assertEquals(3, minMaxGame(Arrays.asList(3)));
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
}
|
min_max_game/meta.json
ADDED
|
@@ -0,0 +1,448 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"id": 2386,
|
| 3 |
+
"name": "min_max_game",
|
| 4 |
+
"difficulty": "Easy",
|
| 5 |
+
"link": "https://leetcode.com/problems/min-max-game/",
|
| 6 |
+
"date": "2022-05-29 00:00:00",
|
| 7 |
+
"task_description": "You are given a **0-indexed** integer array `nums` whose length is a power of `2`. Apply the following algorithm on `nums`: Let `n` be the length of `nums`. If `n == 1`, **end** the process. Otherwise, **create** a new **0-indexed** integer array `newNums` of length `n / 2`. For every **even** index `i` where `0 <= i < n / 2`, **assign** the value of `newNums[i]` as `min(nums[2 * i], nums[2 * i + 1])`. For every **odd** index `i` where `0 <= i < n / 2`, **assign** the value of `newNums[i]` as `max(nums[2 * i], nums[2 * i + 1])`. **Replace** the array `nums` with `newNums`. **Repeat** the entire process starting from step 1. Return _the last number that remains in _`nums`_ after applying the algorithm._ **Example 1:** ``` **Input:** nums = [1,3,5,2,4,8,2,2] **Output:** 1 **Explanation:** The following arrays are the results of applying the algorithm repeatedly. First: nums = [1,5,4,2] Second: nums = [1,4] Third: nums = [1] 1 is the last remaining number, so we return 1. ``` **Example 2:** ``` **Input:** nums = [3] **Output:** 3 **Explanation:** 3 is already the last remaining number, so we return 3. ``` **Constraints:** `1 <= nums.length <= 1024` `1 <= nums[i] <= 109` `nums.length` is a power of `2`.",
|
| 8 |
+
"public_test_cases": [
|
| 9 |
+
{
|
| 10 |
+
"label": "Example 1",
|
| 11 |
+
"input": "nums = [1,3,5,2,4,8,2,2]",
|
| 12 |
+
"output": "1 "
|
| 13 |
+
},
|
| 14 |
+
{
|
| 15 |
+
"label": "Example 2",
|
| 16 |
+
"input": "nums = [3]",
|
| 17 |
+
"output": "3 "
|
| 18 |
+
}
|
| 19 |
+
],
|
| 20 |
+
"private_test_cases": [
|
| 21 |
+
{
|
| 22 |
+
"input": [
|
| 23 |
+
115040532,
|
| 24 |
+
691122985,
|
| 25 |
+
74905644,
|
| 26 |
+
691122985,
|
| 27 |
+
74905644,
|
| 28 |
+
488737920,
|
| 29 |
+
409049507,
|
| 30 |
+
691122985,
|
| 31 |
+
74905644,
|
| 32 |
+
424016316,
|
| 33 |
+
139550887,
|
| 34 |
+
488737920,
|
| 35 |
+
409049507,
|
| 36 |
+
778486804,
|
| 37 |
+
581936863,
|
| 38 |
+
691122985,
|
| 39 |
+
74905644,
|
| 40 |
+
898320970,
|
| 41 |
+
424016316,
|
| 42 |
+
316332152,
|
| 43 |
+
322747948,
|
| 44 |
+
139550887,
|
| 45 |
+
10127500,
|
| 46 |
+
488737920,
|
| 47 |
+
409049507,
|
| 48 |
+
714000633,
|
| 49 |
+
529661213,
|
| 50 |
+
778486804,
|
| 51 |
+
581936863,
|
| 52 |
+
766268468,
|
| 53 |
+
256616097,
|
| 54 |
+
691122985,
|
| 55 |
+
893168349,
|
| 56 |
+
74905644,
|
| 57 |
+
898320970,
|
| 58 |
+
562091841,
|
| 59 |
+
623374598,
|
| 60 |
+
424016316,
|
| 61 |
+
316332152,
|
| 62 |
+
175024652,
|
| 63 |
+
322747948,
|
| 64 |
+
421471664,
|
| 65 |
+
139550887,
|
| 66 |
+
27323869,
|
| 67 |
+
10127500,
|
| 68 |
+
285386703,
|
| 69 |
+
54510532,
|
| 70 |
+
488737920,
|
| 71 |
+
920450369,
|
| 72 |
+
409049507,
|
| 73 |
+
714000633,
|
| 74 |
+
376483632,
|
| 75 |
+
529661213,
|
| 76 |
+
689244382,
|
| 77 |
+
749711836,
|
| 78 |
+
778486804,
|
| 79 |
+
581936863,
|
| 80 |
+
952610726,
|
| 81 |
+
46933645,
|
| 82 |
+
766268468,
|
| 83 |
+
256616097,
|
| 84 |
+
930245976,
|
| 85 |
+
109029077,
|
| 86 |
+
691122985
|
| 87 |
+
],
|
| 88 |
+
"output": 115040532
|
| 89 |
+
},
|
| 90 |
+
{
|
| 91 |
+
"input": [
|
| 92 |
+
422752264,
|
| 93 |
+
444626536,
|
| 94 |
+
383451709,
|
| 95 |
+
444626536,
|
| 96 |
+
964694290,
|
| 97 |
+
383451709,
|
| 98 |
+
444626536,
|
| 99 |
+
354937044
|
| 100 |
+
],
|
| 101 |
+
"output": 422752264
|
| 102 |
+
},
|
| 103 |
+
{
|
| 104 |
+
"input": [
|
| 105 |
+
347432181,
|
| 106 |
+
347432181,
|
| 107 |
+
347432181,
|
| 108 |
+
253225415
|
| 109 |
+
],
|
| 110 |
+
"output": 347432181
|
| 111 |
+
},
|
| 112 |
+
{
|
| 113 |
+
"input": [
|
| 114 |
+
277872296,
|
| 115 |
+
945927896,
|
| 116 |
+
351536846,
|
| 117 |
+
945927896,
|
| 118 |
+
351536846,
|
| 119 |
+
505308252,
|
| 120 |
+
355276338,
|
| 121 |
+
945927896,
|
| 122 |
+
351536846,
|
| 123 |
+
740924939,
|
| 124 |
+
38550376,
|
| 125 |
+
505308252,
|
| 126 |
+
355276338,
|
| 127 |
+
720623023,
|
| 128 |
+
50265300,
|
| 129 |
+
945927896,
|
| 130 |
+
351536846,
|
| 131 |
+
818710986,
|
| 132 |
+
268024035,
|
| 133 |
+
740924939,
|
| 134 |
+
38550376,
|
| 135 |
+
917469833,
|
| 136 |
+
218828997,
|
| 137 |
+
505308252,
|
| 138 |
+
355276338,
|
| 139 |
+
675186659,
|
| 140 |
+
272427923,
|
| 141 |
+
720623023,
|
| 142 |
+
50265300,
|
| 143 |
+
349134637,
|
| 144 |
+
197930247,
|
| 145 |
+
945927896,
|
| 146 |
+
351536846,
|
| 147 |
+
933128750,
|
| 148 |
+
89429569,
|
| 149 |
+
818710986,
|
| 150 |
+
268024035,
|
| 151 |
+
630711263,
|
| 152 |
+
740924939,
|
| 153 |
+
442693871,
|
| 154 |
+
38550376,
|
| 155 |
+
987228952,
|
| 156 |
+
110075355,
|
| 157 |
+
917469833,
|
| 158 |
+
218828997,
|
| 159 |
+
825822362,
|
| 160 |
+
168084080,
|
| 161 |
+
505308252,
|
| 162 |
+
355276338,
|
| 163 |
+
930388442,
|
| 164 |
+
188207825,
|
| 165 |
+
675186659,
|
| 166 |
+
272427923,
|
| 167 |
+
816044008,
|
| 168 |
+
613681487,
|
| 169 |
+
720623023,
|
| 170 |
+
50265300,
|
| 171 |
+
918806830,
|
| 172 |
+
349134637,
|
| 173 |
+
278273618,
|
| 174 |
+
197930247,
|
| 175 |
+
846327293,
|
| 176 |
+
114080947,
|
| 177 |
+
945927896,
|
| 178 |
+
351536846,
|
| 179 |
+
962339954,
|
| 180 |
+
153247899,
|
| 181 |
+
933128750,
|
| 182 |
+
89429569,
|
| 183 |
+
949890359,
|
| 184 |
+
736501846,
|
| 185 |
+
818710986,
|
| 186 |
+
268024035,
|
| 187 |
+
936649815,
|
| 188 |
+
630711263,
|
| 189 |
+
623451241,
|
| 190 |
+
740924939,
|
| 191 |
+
784006358,
|
| 192 |
+
364968461,
|
| 193 |
+
442693871,
|
| 194 |
+
38550376,
|
| 195 |
+
827637389,
|
| 196 |
+
775002894,
|
| 197 |
+
987228952,
|
| 198 |
+
110075355,
|
| 199 |
+
898363618,
|
| 200 |
+
496412781,
|
| 201 |
+
917469833,
|
| 202 |
+
218828997,
|
| 203 |
+
775423695,
|
| 204 |
+
299108265,
|
| 205 |
+
825822362,
|
| 206 |
+
168084080,
|
| 207 |
+
655056704,
|
| 208 |
+
55736741,
|
| 209 |
+
505308252,
|
| 210 |
+
355276338,
|
| 211 |
+
822549513,
|
| 212 |
+
165382074,
|
| 213 |
+
930388442,
|
| 214 |
+
188207825,
|
| 215 |
+
623202735,
|
| 216 |
+
97039735,
|
| 217 |
+
675186659,
|
| 218 |
+
272427923,
|
| 219 |
+
899139750,
|
| 220 |
+
58820112,
|
| 221 |
+
816044008,
|
| 222 |
+
613681487,
|
| 223 |
+
692107265,
|
| 224 |
+
446140510,
|
| 225 |
+
720623023,
|
| 226 |
+
50265300,
|
| 227 |
+
786653476,
|
| 228 |
+
631607382,
|
| 229 |
+
918806830,
|
| 230 |
+
738179041,
|
| 231 |
+
349134637,
|
| 232 |
+
3081800,
|
| 233 |
+
278273618,
|
| 234 |
+
197930247,
|
| 235 |
+
814391196,
|
| 236 |
+
846327293,
|
| 237 |
+
839751160,
|
| 238 |
+
114080947,
|
| 239 |
+
766307757,
|
| 240 |
+
394016082,
|
| 241 |
+
945927896,
|
| 242 |
+
842046573,
|
| 243 |
+
351536846,
|
| 244 |
+
581539229,
|
| 245 |
+
962339954,
|
| 246 |
+
153247899,
|
| 247 |
+
893052643,
|
| 248 |
+
933128750,
|
| 249 |
+
886264387,
|
| 250 |
+
237453609,
|
| 251 |
+
89429569,
|
| 252 |
+
168548190,
|
| 253 |
+
949890359,
|
| 254 |
+
736501846,
|
| 255 |
+
874536926,
|
| 256 |
+
390388306,
|
| 257 |
+
818710986,
|
| 258 |
+
268024035,
|
| 259 |
+
930890158,
|
| 260 |
+
936649815,
|
| 261 |
+
787292160,
|
| 262 |
+
630711263,
|
| 263 |
+
790680442,
|
| 264 |
+
623451241,
|
| 265 |
+
528577751,
|
| 266 |
+
757668896,
|
| 267 |
+
740924939,
|
| 268 |
+
540340338,
|
| 269 |
+
784006358,
|
| 270 |
+
364968461,
|
| 271 |
+
634924643,
|
| 272 |
+
442693871,
|
| 273 |
+
402084206,
|
| 274 |
+
38550376,
|
| 275 |
+
50388559,
|
| 276 |
+
486527953,
|
| 277 |
+
827637389,
|
| 278 |
+
889740846,
|
| 279 |
+
775002894,
|
| 280 |
+
987228952,
|
| 281 |
+
711758512,
|
| 282 |
+
110075355,
|
| 283 |
+
554558129,
|
| 284 |
+
898363618,
|
| 285 |
+
430338156,
|
| 286 |
+
855273022,
|
| 287 |
+
496412781,
|
| 288 |
+
917469833,
|
| 289 |
+
513275787,
|
| 290 |
+
287567580,
|
| 291 |
+
218828997,
|
| 292 |
+
775423695,
|
| 293 |
+
544183099,
|
| 294 |
+
960564854,
|
| 295 |
+
299108265,
|
| 296 |
+
403334797,
|
| 297 |
+
825822362,
|
| 298 |
+
168084080,
|
| 299 |
+
420433761,
|
| 300 |
+
257316455,
|
| 301 |
+
655056704,
|
| 302 |
+
614047974,
|
| 303 |
+
55736741,
|
| 304 |
+
55437983,
|
| 305 |
+
505308252,
|
| 306 |
+
355276338,
|
| 307 |
+
829117431,
|
| 308 |
+
425539800,
|
| 309 |
+
822549513,
|
| 310 |
+
473149306,
|
| 311 |
+
165382074,
|
| 312 |
+
930388442,
|
| 313 |
+
219356010,
|
| 314 |
+
188207825,
|
| 315 |
+
221601673,
|
| 316 |
+
339915824,
|
| 317 |
+
623202735,
|
| 318 |
+
97039735,
|
| 319 |
+
643265311,
|
| 320 |
+
675186659,
|
| 321 |
+
302235312,
|
| 322 |
+
801212847,
|
| 323 |
+
272427923,
|
| 324 |
+
899139750,
|
| 325 |
+
473530827,
|
| 326 |
+
701114055,
|
| 327 |
+
58820112,
|
| 328 |
+
103017505,
|
| 329 |
+
816044008,
|
| 330 |
+
613681487,
|
| 331 |
+
819740209,
|
| 332 |
+
623887143,
|
| 333 |
+
692107265,
|
| 334 |
+
446140510,
|
| 335 |
+
818007276,
|
| 336 |
+
45103587,
|
| 337 |
+
720623023,
|
| 338 |
+
50265300,
|
| 339 |
+
236708934,
|
| 340 |
+
646052908,
|
| 341 |
+
786653476,
|
| 342 |
+
631607382,
|
| 343 |
+
943759801,
|
| 344 |
+
918806830,
|
| 345 |
+
256451102,
|
| 346 |
+
738179041,
|
| 347 |
+
798967010,
|
| 348 |
+
56615261,
|
| 349 |
+
349134637,
|
| 350 |
+
3081800,
|
| 351 |
+
585996046,
|
| 352 |
+
278273618,
|
| 353 |
+
187195679,
|
| 354 |
+
365793711,
|
| 355 |
+
197930247,
|
| 356 |
+
814391196,
|
| 357 |
+
1711047,
|
| 358 |
+
846327293,
|
| 359 |
+
989073716,
|
| 360 |
+
454322636,
|
| 361 |
+
839751160,
|
| 362 |
+
803562099,
|
| 363 |
+
114080947,
|
| 364 |
+
656466739,
|
| 365 |
+
766307757,
|
| 366 |
+
829671791,
|
| 367 |
+
394016082,
|
| 368 |
+
945927896,
|
| 369 |
+
556552137
|
| 370 |
+
],
|
| 371 |
+
"output": 277872296
|
| 372 |
+
},
|
| 373 |
+
{
|
| 374 |
+
"input": [
|
| 375 |
+
439363306,
|
| 376 |
+
983086361,
|
| 377 |
+
18639521,
|
| 378 |
+
983086361,
|
| 379 |
+
18639521,
|
| 380 |
+
926360015,
|
| 381 |
+
429073836,
|
| 382 |
+
983086361,
|
| 383 |
+
18639521,
|
| 384 |
+
618347797,
|
| 385 |
+
331389171,
|
| 386 |
+
926360015,
|
| 387 |
+
429073836,
|
| 388 |
+
823614485,
|
| 389 |
+
206463919,
|
| 390 |
+
983086361,
|
| 391 |
+
18639521,
|
| 392 |
+
551614501,
|
| 393 |
+
528697263,
|
| 394 |
+
618347797,
|
| 395 |
+
729566617,
|
| 396 |
+
331389171,
|
| 397 |
+
806609119,
|
| 398 |
+
926360015,
|
| 399 |
+
429073836,
|
| 400 |
+
906955449,
|
| 401 |
+
28743328,
|
| 402 |
+
823614485,
|
| 403 |
+
575701114,
|
| 404 |
+
206463919,
|
| 405 |
+
430845510,
|
| 406 |
+
983086361,
|
| 407 |
+
18639521,
|
| 408 |
+
476762353,
|
| 409 |
+
551614501,
|
| 410 |
+
483033277,
|
| 411 |
+
528697263,
|
| 412 |
+
757187572,
|
| 413 |
+
618347797,
|
| 414 |
+
289394534,
|
| 415 |
+
930884662,
|
| 416 |
+
729566617,
|
| 417 |
+
331389171,
|
| 418 |
+
248606565,
|
| 419 |
+
828364048,
|
| 420 |
+
806609119,
|
| 421 |
+
104101301,
|
| 422 |
+
926360015,
|
| 423 |
+
586131558,
|
| 424 |
+
429073836,
|
| 425 |
+
124381100,
|
| 426 |
+
906955449,
|
| 427 |
+
871344524,
|
| 428 |
+
28743328,
|
| 429 |
+
372630435,
|
| 430 |
+
823614485,
|
| 431 |
+
575701114,
|
| 432 |
+
898787203,
|
| 433 |
+
206463919,
|
| 434 |
+
11428664,
|
| 435 |
+
430845510,
|
| 436 |
+
479380797,
|
| 437 |
+
101634865,
|
| 438 |
+
983086361
|
| 439 |
+
],
|
| 440 |
+
"output": 439363306
|
| 441 |
+
}
|
| 442 |
+
],
|
| 443 |
+
"haskell_template": "minMaxGame :: [Int] -> Int\nminMaxGame nums ",
|
| 444 |
+
"ocaml_template": "let minMaxGame (nums: int list) : int = ",
|
| 445 |
+
"scala_template": "def minMaxGame(nums: List[Int]): Int = { \n \n}",
|
| 446 |
+
"java_template": "class Solution {\n public int minMaxGame(int[] nums) {\n \n }\n}",
|
| 447 |
+
"python_template": "class Solution(object):\n def minMaxGame(self, nums):\n \"\"\"\n :type nums: List[int]\n :rtype: int\n \"\"\"\n "
|
| 448 |
+
}
|