DatasetRepo commited on
Commit
20fd1ed
·
verified ·
1 Parent(s): 5788af8

0892eccfdf4e4f7d48b352527ffeedf8c34461476667e6f1db00f4459a1c9303

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +6 -0
  2. rearranging_fruits/.DS_Store +0 -0
  3. rearranging_fruits/haskell_tests/Main.hs +24 -0
  4. rearranging_fruits/java_tests/Main.java +21 -0
  5. rearranging_fruits/meta.json +3 -0
  6. rearranging_fruits/ocaml_tests/main.ml +26 -0
  7. rearranging_fruits/scala_tests/MySuite.scala +12 -0
  8. recover_the_original_array/.DS_Store +0 -0
  9. recover_the_original_array/haskell_tests/Main.hs +27 -0
  10. recover_the_original_array/java_tests/Main.java +25 -0
  11. recover_the_original_array/meta.json +0 -0
  12. recover_the_original_array/ocaml_tests/main.ml +29 -0
  13. recover_the_original_array/scala_tests/MySuite.scala +16 -0
  14. relocate_marbles/.DS_Store +0 -0
  15. relocate_marbles/haskell_tests/Main.hs +24 -0
  16. relocate_marbles/java_tests/Main.java +21 -0
  17. relocate_marbles/meta.json +26 -0
  18. relocate_marbles/ocaml_tests/main.ml +26 -0
  19. relocate_marbles/scala_tests/MySuite.scala +12 -0
  20. remove_adjacent_almost_equal_characters/haskell_tests/Main.hs +44 -0
  21. remove_adjacent_almost_equal_characters/java_tests/Main.java +24 -0
  22. remove_adjacent_almost_equal_characters/meta.json +52 -0
  23. remove_adjacent_almost_equal_characters/ocaml_tests/main.ml +45 -0
  24. remove_adjacent_almost_equal_characters/scala_tests/MySuite.scala +36 -0
  25. remove_digit_from_number_to_maximize_result/.DS_Store +0 -0
  26. remove_digit_from_number_to_maximize_result/haskell_tests/Main.hs +27 -0
  27. remove_digit_from_number_to_maximize_result/java_tests/Main.java +25 -0
  28. remove_digit_from_number_to_maximize_result/meta.json +102 -0
  29. remove_digit_from_number_to_maximize_result/ocaml_tests/main.ml +29 -0
  30. remove_digit_from_number_to_maximize_result/scala_tests/MySuite.scala +16 -0
  31. remove_letter_to_equalize_frequency/.DS_Store +0 -0
  32. remove_letter_to_equalize_frequency/haskell_tests/Main.hs +24 -0
  33. remove_letter_to_equalize_frequency/java_tests/Main.java +21 -0
  34. remove_letter_to_equalize_frequency/meta.json +67 -0
  35. remove_letter_to_equalize_frequency/ocaml_tests/main.ml +26 -0
  36. remove_letter_to_equalize_frequency/scala_tests/MySuite.scala +12 -0
  37. remove_methods_from_project/haskell_tests/Main.hs +3 -0
  38. remove_methods_from_project/java_tests/Main.java +25 -0
  39. remove_methods_from_project/meta.json +3 -0
  40. remove_methods_from_project/ocaml_tests/main.ml +3 -0
  41. remove_methods_from_project/scala_tests/MySuite.scala +3 -0
  42. remove_trailing_zeros_from_a_string/haskell_tests/Main.hs +41 -0
  43. remove_trailing_zeros_from_a_string/java_tests/Main.java +20 -0
  44. remove_trailing_zeros_from_a_string/meta.json +47 -0
  45. remove_trailing_zeros_from_a_string/ocaml_tests/main.ml +42 -0
  46. remove_trailing_zeros_from_a_string/scala_tests/MySuite.scala +32 -0
  47. removing_minimum_number_of_magic_beans/.DS_Store +0 -0
  48. removing_minimum_number_of_magic_beans/haskell_tests/Main.hs +24 -0
  49. removing_minimum_number_of_magic_beans/java_tests/Main.java +21 -0
  50. removing_minimum_number_of_magic_beans/meta.json +3 -0
.gitattributes CHANGED
@@ -265,3 +265,9 @@ partition_array_such_that_maximum_difference_is_k/meta.json filter=lfs diff=lfs
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
 
 
 
 
 
 
 
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
rearranging_fruits/.DS_Store ADDED
Binary file (6.15 kB). View file
 
rearranging_fruits/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 (minCost [4,2,2,2] [1,4,1,2])," 1 (minCost [4,2,2,2] [1,4,1,2]))
13
+
14
+ test2 :: Test
15
+ test2 = TestCase (assertEqual "for (minCost [2,3,4,1] [3,2,5,1])," (-1) (minCost [2,3,4,1] [3,2,5,1]))
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
rearranging_fruits/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(1, minCost(new ArrayList<>(Arrays.asList(4,2,2,2)), new ArrayList<>(Arrays.asList(1,4,1,2))));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals(-1, minCost(new ArrayList<>(Arrays.asList(2,3,4,1)), new ArrayList<>(Arrays.asList(3,2,5,1))));
19
+ }
20
+
21
+ }
rearranging_fruits/meta.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b2bcc97d1e30b972adbcba8f073ea0a29a4b4ea1aa541d2d9183274395e7dd05
3
+ size 29333192
rearranging_fruits/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 (minCost [4;2;2;2] [1;4;1;2])
12
+
13
+ let test2 _ = assert_equal (-1) (minCost [2;3;4;1] [3;2;5;1])
14
+
15
+
16
+ (* Grouping test cases *)
17
+ let suite = "Test Suite for minCost" >::: [
18
+
19
+ "test1" >:: test1;
20
+ "test2" >:: test2;
21
+ ]
22
+
23
+
24
+ (* Running the tests *)
25
+ let () = run_test_tt_main suite
26
+ end
rearranging_fruits/scala_tests/MySuite.scala ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ class MySuite extends munit.FunSuite {
3
+
4
+ test("test1") {
5
+ assertEquals(Main.minCost(List(4,2,2,2),List(1,4,1,2)), 1)
6
+ }
7
+
8
+ test("test2") {
9
+ assertEquals(Main.minCost(List(2,3,4,1),List(3,2,5,1)), -1)
10
+ }
11
+
12
+ }
recover_the_original_array/.DS_Store ADDED
Binary file (6.15 kB). View file
 
recover_the_original_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 (recoverArray [2,10,6,4,8,12])," [3,7,11] (recoverArray [2,10,6,4,8,12]))
13
+
14
+ test2 :: Test
15
+ test2 = TestCase (assertEqual "for (recoverArray [1,1,3,3])," [2,2] (recoverArray [1,1,3,3]))
16
+
17
+ test3 :: Test
18
+ test3 = TestCase (assertEqual "for (recoverArray [5,435])," [220] (recoverArray [5,435]))
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
recover_the_original_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(3,7,11)), recoverArray(new ArrayList<>(Arrays.asList(2,10,6,4,8,12))));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals(new ArrayList<>(Arrays.asList(2,2)), recoverArray(new ArrayList<>(Arrays.asList(1,1,3,3))));
19
+ }
20
+ @Test
21
+ public void test3() {
22
+ assertEquals(new ArrayList<>(Arrays.asList(220)), recoverArray(new ArrayList<>(Arrays.asList(5,435))));
23
+ }
24
+
25
+ }
recover_the_original_array/meta.json ADDED
The diff for this file is too large to render. See raw diff
 
recover_the_original_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 [3;7;11] (recoverArray [2;10;6;4;8;12])
12
+
13
+ let test2 _ = assert_equal [2;2] (recoverArray [1;1;3;3])
14
+
15
+ let test3 _ = assert_equal [220] (recoverArray [5;435])
16
+
17
+
18
+ (* Grouping test cases *)
19
+ let suite = "Test Suite for recoverArray" >::: [
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
recover_the_original_array/scala_tests/MySuite.scala ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ class MySuite extends munit.FunSuite {
3
+
4
+ test("test1") {
5
+ assertEquals(Main.recoverArray(List(2,10,6,4,8,12)), List(3,7,11))
6
+ }
7
+
8
+ test("test2") {
9
+ assertEquals(Main.recoverArray(List(1,1,3,3)), List(2,2))
10
+ }
11
+
12
+ test("test3") {
13
+ assertEquals(Main.recoverArray(List(5,435)), List(220))
14
+ }
15
+
16
+ }
relocate_marbles/.DS_Store ADDED
Binary file (6.15 kB). View file
 
relocate_marbles/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 (relocateMarbles [1,6,7,8] [1,7,2] [2,9,5])," [5,6,8,9] (relocateMarbles [1,6,7,8] [1,7,2] [2,9,5]))
13
+
14
+ test2 :: Test
15
+ test2 = TestCase (assertEqual "for (relocateMarbles [1,1,3,3] [1,3] [2,2])," [2] (relocateMarbles [1,1,3,3] [1,3] [2,2]))
16
+
17
+
18
+ -- Grouping test cases
19
+ tests :: Test
20
+ tests = TestList [TestLabel "Test1" test1]
21
+
22
+ -- Running the tests
23
+ main :: IO Counts
24
+ main = runTestTT tests
relocate_marbles/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(5,6,8,9)), relocateMarbles(new ArrayList<>(Arrays.asList(1,6,7,8)), new ArrayList<>(Arrays.asList(1,7,2)), new ArrayList<>(Arrays.asList(2,9,5))));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals(new ArrayList<>(Arrays.asList(2)), relocateMarbles(new ArrayList<>(Arrays.asList(1,1,3,3)), new ArrayList<>(Arrays.asList(1,3)), new ArrayList<>(Arrays.asList(2,2))));
19
+ }
20
+
21
+ }
relocate_marbles/meta.json ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "id": 2834,
3
+ "name": "relocate_marbles",
4
+ "difficulty": "Medium",
5
+ "link": "https://leetcode.com/problems/relocate-marbles/",
6
+ "date": "1687564800000",
7
+ "task_description": "You are given a **0-indexed** integer array `nums` representing the initial positions of some marbles. You are also given two **0-indexed **integer arrays `moveFrom` and `moveTo` of **equal** length. Throughout `moveFrom.length` steps, you will change the positions of the marbles. On the `ith` step, you will move **all** marbles at position `moveFrom[i]` to position `moveTo[i]`. After completing all the steps, return _the sorted list of **occupied** positions_. **Notes:** We call a position **occupied** if there is at least one marble in that position. There may be multiple marbles in a single position. **Example 1:** ``` **Input:** nums = [1,6,7,8], moveFrom = [1,7,2], moveTo = [2,9,5] **Output:** [5,6,8,9] **Explanation:** Initially, the marbles are at positions 1,6,7,8. At the i = 0th step, we move the marbles at position 1 to position 2. Then, positions 2,6,7,8 are occupied. At the i = 1st step, we move the marbles at position 7 to position 9. Then, positions 2,6,8,9 are occupied. At the i = 2nd step, we move the marbles at position 2 to position 5. Then, positions 5,6,8,9 are occupied. At the end, the final positions containing at least one marbles are [5,6,8,9]. ``` **Example 2:** ``` **Input:** nums = [1,1,3,3], moveFrom = [1,3], moveTo = [2,2] **Output:** [2] **Explanation:** Initially, the marbles are at positions [1,1,3,3]. At the i = 0th step, we move all the marbles at position 1 to position 2. Then, the marbles are at positions [2,2,3,3]. At the i = 1st step, we move all the marbles at position 3 to position 2. Then, the marbles are at positions [2,2,2,2]. Since 2 is the only occupied position, we return [2]. ``` **Constraints:** `1 <= nums.length <= 105` `1 <= moveFrom.length <= 105` `moveFrom.length == moveTo.length` `1 <= nums[i], moveFrom[i], moveTo[i] <= 109` The test cases are generated such that there is at least a marble in `moveFrom[i]` at the moment we want to apply the `ith` move.",
8
+ "public_test_cases": [
9
+ {
10
+ "label": "Example 1",
11
+ "input": "nums = [1,6,7,8], moveFrom = [1,7,2], moveTo = [2,9,5]",
12
+ "output": "[5,6,8,9] "
13
+ },
14
+ {
15
+ "label": "Example 2",
16
+ "input": "nums = [1,1,3,3], moveFrom = [1,3], moveTo = [2,2]",
17
+ "output": "[2] "
18
+ }
19
+ ],
20
+ "private_test_cases": [],
21
+ "haskell_template": "relocateMarbles :: [Int] -> [Int] -> [Int] -> [Int]\nrelocateMarbles nums moveFrom moveTo ",
22
+ "ocaml_template": "let relocateMarbles (nums: int list) (moveFrom: int list) (moveTo: int list) : int list = ",
23
+ "scala_template": "def relocateMarbles(nums: List[Int],moveFrom: List[Int],moveTo: List[Int]): List[Int] = { \n \n}",
24
+ "java_template": "public static List<Integer> relocateMarbles(List<Integer> nums, List<Integer> moveFrom, List<Integer> moveTo) {\n\n}",
25
+ "python_template": "class Solution(object):\n def relocateMarbles(self, nums, moveFrom, moveTo):\n \"\"\"\n :type nums: List[int]\n :type moveFrom: List[int]\n :type moveTo: List[int]\n :rtype: List[int]\n \"\"\"\n "
26
+ }
relocate_marbles/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 [5;6;8;9] (relocateMarbles [1;6;7;8] [1;7;2] [2;9;5])
12
+
13
+ let test2 _ = assert_equal [2] (relocateMarbles [1;1;3;3] [1;3] [2;2])
14
+
15
+
16
+ (* Grouping test cases *)
17
+ let suite = "Test Suite for relocateMarbles" >::: [
18
+
19
+ "test1" >:: test1;
20
+ "test2" >:: test2;
21
+ ]
22
+
23
+
24
+ (* Running the tests *)
25
+ let () = run_test_tt_main suite
26
+ end
relocate_marbles/scala_tests/MySuite.scala ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ class MySuite extends munit.FunSuite {
3
+
4
+ test("test1") {
5
+ assertEquals(Main.relocateMarbles(List(1,6,7,8),List(1,7,2),List(2,9,5)), List(5,6,8,9))
6
+ }
7
+
8
+ test("test2") {
9
+ assertEquals(Main.relocateMarbles(List(1,1,3,3),List(1,3),List(2,2)), List(2))
10
+ }
11
+
12
+ }
remove_adjacent_almost_equal_characters/haskell_tests/Main.hs ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ module Main where
3
+ import Test.HUnit
4
+
5
+ --Program start
6
+ removeAlmostEqualCharacters :: String -> Int
7
+ removeAlmostEqualCharacters word = undefined
8
+
9
+ --Program end
10
+
11
+ -- Test cases
12
+
13
+ test1 :: Test
14
+ test1 = TestCase (assertEqual "for (removeAlmostEqualCharacters \"aaaaa \")," 2 (removeAlmostEqualCharacters "aaaaa"))
15
+
16
+ test2 :: Test
17
+ test2 = TestCase (assertEqual "for (removeAlmostEqualCharacters \"abddez \")," 2 (removeAlmostEqualCharacters "abddez"))
18
+
19
+ test3 :: Test
20
+ test3 = TestCase (assertEqual "for (removeAlmostEqualCharacters \"zyxyxyz \")," 3 (removeAlmostEqualCharacters "zyxyxyz"))
21
+
22
+ test4 :: Test
23
+ test4 = TestCase (assertEqual "for (removeAlmostEqualCharacters \"egemspqbudprialxwsqfsbfebuuelyvzymevldlviaesalwhpaepxgxsspnmogegnozjintuq \")," 10 (removeAlmostEqualCharacters "egemspqbudprialxwsqfsbfebuuelyvzymevldlviaesalwhpaepxgxsspnmogegnozjintuq"))
24
+
25
+ test5 :: Test
26
+ test5 = TestCase (assertEqual "for (removeAlmostEqualCharacters \"pgp \")," 0 (removeAlmostEqualCharacters "pgp"))
27
+
28
+ test6 :: Test
29
+ test6 = TestCase (assertEqual "for (removeAlmostEqualCharacters \"nyblzqabcwjcyuzezzlzxshqqpecfekiugft \")," 5 (removeAlmostEqualCharacters "nyblzqabcwjcyuzezzlzxshqqpecfekiugft"))
30
+
31
+ test7 :: Test
32
+ test7 = TestCase (assertEqual "for (removeAlmostEqualCharacters \"omnbzkruaz \")," 1 (removeAlmostEqualCharacters "omnbzkruaz"))
33
+
34
+ test8 :: Test
35
+ test8 = TestCase (assertEqual "for (removeAlmostEqualCharacters \"mbrfpgvglbadahkokomrsydnbvoueolbawkteoxpxvaxdxgudiuvtlqgisiiptatjdkcsdsfntgvgq \")," 5 (removeAlmostEqualCharacters "mbrfpgvglbadahkokomrsydnbvoueolbawkteoxpxvaxdxgudiuvtlqgisiiptatjdkcsdsfntgvgq"))
36
+
37
+
38
+ -- Grouping test cases
39
+ tests :: Test
40
+ tests = TestList [TestLabel "Test1" test1, TestLabel "Test2" test2, TestLabel "Test3" test3, TestLabel "Test4" test4, TestLabel "Test5" test5, TestLabel "Test6" test6, TestLabel "Test7" test7]
41
+
42
+ -- Running the tests
43
+ main :: IO Counts
44
+ main = runTestTT tests
remove_adjacent_almost_equal_characters/java_tests/Main.java ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import static org.junit.jupiter.api.Assertions.*;
3
+ import org.junit.jupiter.api.Test;
4
+ import java.util.List;
5
+ import java.util.Arrays;
6
+ public class Main {
7
+ //Program start
8
+
9
+ //Program end
10
+
11
+ @Test
12
+ public void test1() {
13
+ assertEquals(2, removeAlmostEqualCharacters("aaaaa"));
14
+ }
15
+ @Test
16
+ public void test2() {
17
+ assertEquals(2, removeAlmostEqualCharacters("abddez"));
18
+ }
19
+ @Test
20
+ public void test3() {
21
+ assertEquals(3, removeAlmostEqualCharacters("zyxyxyz"));
22
+ }
23
+
24
+ }
remove_adjacent_almost_equal_characters/meta.json ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "id": 3230,
3
+ "name": "remove_adjacent_almost_equal_characters",
4
+ "difficulty": "Medium",
5
+ "link": "https://leetcode.com/problems/remove-adjacent-almost-equal-characters/",
6
+ "date": "2023-11-25 00:00:00",
7
+ "task_description": "You are given a **0-indexed** string `word`. In one operation, you can pick any index `i` of `word` and change `word[i]` to any lowercase English letter. Return _the **minimum** number of operations needed to remove all adjacent **almost-equal** characters from_ `word`. Two characters `a` and `b` are **almost-equal** if `a == b` or `a` and `b` are adjacent in the alphabet. **Example 1:** ``` **Input:** word = \"aaaaa\" **Output:** 2 **Explanation:** We can change word into \"a**c**a**c**a\" which does not have any adjacent almost-equal characters. It can be shown that the minimum number of operations needed to remove all adjacent almost-equal characters from word is 2. ``` **Example 2:** ``` **Input:** word = \"abddez\" **Output:** 2 **Explanation:** We can change word into \"**y**bd**o**ez\" which does not have any adjacent almost-equal characters. It can be shown that the minimum number of operations needed to remove all adjacent almost-equal characters from word is 2. ``` **Example 3:** ``` **Input:** word = \"zyxyxyz\" **Output:** 3 **Explanation:** We can change word into \"z**a**x**a**x**a**z\" which does not have any adjacent almost-equal characters. It can be shown that the minimum number of operations needed to remove all adjacent almost-equal characters from word is 3. ``` **Constraints:** `1 <= word.length <= 100` `word` consists only of lowercase English letters.",
8
+ "public_test_cases": [
9
+ {
10
+ "label": "Example 1",
11
+ "input": "word = \"aaaaa\"",
12
+ "output": "2 "
13
+ },
14
+ {
15
+ "label": "Example 2",
16
+ "input": "word = \"abddez\"",
17
+ "output": "2 "
18
+ },
19
+ {
20
+ "label": "Example 3",
21
+ "input": "word = \"zyxyxyz\"",
22
+ "output": "3 "
23
+ }
24
+ ],
25
+ "private_test_cases": [
26
+ {
27
+ "input": "egemspqbudprialxwsqfsbfebuuelyvzymevldlviaesalwhpaepxgxsspnmogegnozjintuq",
28
+ "output": 10
29
+ },
30
+ {
31
+ "input": "pgp",
32
+ "output": 0
33
+ },
34
+ {
35
+ "input": "nyblzqabcwjcyuzezzlzxshqqpecfekiugft",
36
+ "output": 5
37
+ },
38
+ {
39
+ "input": "omnbzkruaz",
40
+ "output": 1
41
+ },
42
+ {
43
+ "input": "mbrfpgvglbadahkokomrsydnbvoueolbawkteoxpxvaxdxgudiuvtlqgisiiptatjdkcsdsfntgvgq",
44
+ "output": 5
45
+ }
46
+ ],
47
+ "haskell_template": "removeAlmostEqualCharacters :: String -> Int\nremoveAlmostEqualCharacters word ",
48
+ "ocaml_template": "let removeAlmostEqualCharacters (word: string) : int = ",
49
+ "scala_template": "def removeAlmostEqualCharacters(word: String): Int = { \n \n}",
50
+ "java_template": "class Solution {\n public int removeAlmostEqualCharacters(String word) {\n \n }\n}",
51
+ "python_template": "class Solution(object):\n def removeAlmostEqualCharacters(self, word):\n \"\"\"\n :type word: str\n :rtype: int\n \"\"\"\n "
52
+ }
remove_adjacent_almost_equal_characters/ocaml_tests/main.ml ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ module Main = struct
3
+ open OUnit2
4
+
5
+ (* Program start *)
6
+ let removeAlmostEqualCharacters (word: string) : int = failwith "Not implemented"
7
+
8
+ (* Program end *)
9
+
10
+ (* Test cases *)
11
+
12
+ let test1 _ = assert_equal 2 (removeAlmostEqualCharacters "aaaaa")
13
+
14
+ let test2 _ = assert_equal 2 (removeAlmostEqualCharacters "abddez")
15
+
16
+ let test3 _ = assert_equal 3 (removeAlmostEqualCharacters "zyxyxyz")
17
+
18
+ let test4 _ = assert_equal 3 (removeAlmostEqualCharacters "egemspqbudprialxwsqfsbfebuuelyvzymevldlviaesalwhpaepxgxsspnmogegnozjintuq")
19
+
20
+ let test5 _ = assert_equal 3 (removeAlmostEqualCharacters "pgp")
21
+
22
+ let test6 _ = assert_equal 3 (removeAlmostEqualCharacters "nyblzqabcwjcyuzezzlzxshqqpecfekiugft")
23
+
24
+ let test7 _ = assert_equal 3 (removeAlmostEqualCharacters "omnbzkruaz")
25
+
26
+ let test8 _ = assert_equal 3 (removeAlmostEqualCharacters "mbrfpgvglbadahkokomrsydnbvoueolbawkteoxpxvaxdxgudiuvtlqgisiiptatjdkcsdsfntgvgq")
27
+
28
+
29
+ (* Grouping test cases *)
30
+ let suite = "Test Suite for removeAlmostEqualCharacters" >::: [
31
+
32
+ "test1" >:: test1;
33
+ "test2" >:: test2;
34
+ "test3" >:: test3;
35
+ "test4" >:: test4;
36
+ "test5" >:: test5;
37
+ "test6" >:: test6;
38
+ "test7" >:: test7;
39
+ "test8" >:: test8;
40
+ ]
41
+
42
+
43
+ (* Running the tests *)
44
+ let () = run_test_tt_main suite
45
+ end
remove_adjacent_almost_equal_characters/scala_tests/MySuite.scala ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ class MySuite extends munit.FunSuite {
3
+
4
+ test("test1") {
5
+ assertEquals(Main.removeAlmostEqualCharacters("aaaaa"), 2)
6
+ }
7
+
8
+ test("test2") {
9
+ assertEquals(Main.removeAlmostEqualCharacters("abddez"), 2)
10
+ }
11
+
12
+ test("test3") {
13
+ assertEquals(Main.removeAlmostEqualCharacters("zyxyxyz"), 3)
14
+ }
15
+
16
+ test("test4") {
17
+ assertEquals(Main.removeAlmostEqualCharacters(",e,g,e,m,s,p,q,b,u,d,p,r,i,a,l,x,w,s,q,f,s,b,f,e,b,u,u,e,l,y,v,z,y,m,e,v,l,d,l,v,i,a,e,s,a,l,w,h,p,a,e,p,x,g,x,s,s,p,n,m,o,g,e,g,n,o,z,j,i,n,t,u,q,"), 10)
18
+ }
19
+
20
+ test("test5") {
21
+ assertEquals(Main.removeAlmostEqualCharacters(",p,g,p,"), 0)
22
+ }
23
+
24
+ test("test6") {
25
+ assertEquals(Main.removeAlmostEqualCharacters(",n,y,b,l,z,q,a,b,c,w,j,c,y,u,z,e,z,z,l,z,x,s,h,q,q,p,e,c,f,e,k,i,u,g,f,t,"), 5)
26
+ }
27
+
28
+ test("test7") {
29
+ assertEquals(Main.removeAlmostEqualCharacters(",o,m,n,b,z,k,r,u,a,z,"), 1)
30
+ }
31
+
32
+ test("test8") {
33
+ assertEquals(Main.removeAlmostEqualCharacters(",m,b,r,f,p,g,v,g,l,b,a,d,a,h,k,o,k,o,m,r,s,y,d,n,b,v,o,u,e,o,l,b,a,w,k,t,e,o,x,p,x,v,a,x,d,x,g,u,d,i,u,v,t,l,q,g,i,s,i,i,p,t,a,t,j,d,k,c,s,d,s,f,n,t,g,v,g,q,"), 5)
34
+ }
35
+
36
+ }
remove_digit_from_number_to_maximize_result/.DS_Store ADDED
Binary file (6.15 kB). View file
 
remove_digit_from_number_to_maximize_result/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 (removeDigit \"123 \" \"3 \")," "12" (removeDigit "123" "3"))
13
+
14
+ test2 :: Test
15
+ test2 = TestCase (assertEqual "for (removeDigit \"1231 \" \"1 \")," "231" (removeDigit "1231" "1"))
16
+
17
+ test3 :: Test
18
+ test3 = TestCase (assertEqual "for (removeDigit \"551 \" \"5 \")," "51" (removeDigit "551" "5"))
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
remove_digit_from_number_to_maximize_result/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", removeDigit("123", "3"));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals("1", removeDigit("1231", "1"));
19
+ }
20
+ @Test
21
+ public void test3() {
22
+ assertEquals("5", removeDigit("551", "5"));
23
+ }
24
+
25
+ }
remove_digit_from_number_to_maximize_result/meta.json ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "id": 2337,
3
+ "name": "remove_digit_from_number_to_maximize_result",
4
+ "difficulty": "Easy",
5
+ "link": "https://leetcode.com/problems/remove-digit-from-number-to-maximize-result/",
6
+ "date": "1650758400000",
7
+ "task_description": "You are given a string `number` representing a **positive integer** and a character `digit`. Return _the resulting string after removing **exactly one occurrence** of _`digit`_ from _`number`_ such that the value of the resulting string in **decimal** form is **maximized**_. The test cases are generated such that `digit` occurs at least once in `number`. **Example 1:** ``` **Input:** number = \"123\", digit = \"3\" **Output:** \"12\" **Explanation:** There is only one '3' in \"123\". After removing '3', the result is \"12\". ``` **Example 2:** ``` **Input:** number = \"1231\", digit = \"1\" **Output:** \"231\" **Explanation:** We can remove the first '1' to get \"231\" or remove the second '1' to get \"123\". Since 231 > 123, we return \"231\". ``` **Example 3:** ``` **Input:** number = \"551\", digit = \"5\" **Output:** \"51\" **Explanation:** We can remove either the first or second '5' from \"551\". Both result in the string \"51\". ``` **Constraints:** `2 <= number.length <= 100` `number` consists of digits from `'1'` to `'9'`. `digit` is a digit from `'1'` to `'9'`. `digit` occurs at least once in `number`.",
8
+ "public_test_cases": [
9
+ {
10
+ "label": "Example 1",
11
+ "input": "number = \"123\", digit = \"3\"",
12
+ "output": "\"12\" "
13
+ },
14
+ {
15
+ "label": "Example 2",
16
+ "input": "number = \"1231\", digit = \"1\"",
17
+ "output": "\"231\" "
18
+ },
19
+ {
20
+ "label": "Example 3",
21
+ "input": "number = \"551\", digit = \"5\"",
22
+ "output": "\"51\" "
23
+ }
24
+ ],
25
+ "private_test_cases": [
26
+ {
27
+ "input": [
28
+ "\"2374539441156399471819254369495132\"",
29
+ "\"6\""
30
+ ],
31
+ "output": "237453944115639947181925439495132"
32
+ },
33
+ {
34
+ "input": [
35
+ "\"636978894914622392391618376488883813813127738671181386819783688775\"",
36
+ "\"3\""
37
+ ],
38
+ "output": "66978894914622392391618376488883813813127738671181386819783688775"
39
+ },
40
+ {
41
+ "input": [
42
+ "\"77448812663961\"",
43
+ "\"6\""
44
+ ],
45
+ "output": "7744881266391"
46
+ },
47
+ {
48
+ "input": [
49
+ "\"79387435792534198358183978554343923239548566731344594547149432687951348864418431584516\"",
50
+ "\"4\""
51
+ ],
52
+ "output": "7938743579253419835818397855434392323958566731344594547149432687951348864418431584516"
53
+ },
54
+ {
55
+ "input": [
56
+ "\"4416339414133189318131987381972318426856179993\"",
57
+ "\"1\""
58
+ ],
59
+ "output": "446339414133189318131987381972318426856179993"
60
+ },
61
+ {
62
+ "input": [
63
+ "\"483948427431225777289178433571992689847777823537268916929996628484814\"",
64
+ "\"9\""
65
+ ],
66
+ "output": "48394842743122577728917843357199268984777782353726891692996628484814"
67
+ },
68
+ {
69
+ "input": [
70
+ "97758465227183942137521949981298741519469",
71
+ "4"
72
+ ],
73
+ "output": "9775865227183942137521949981298741519469"
74
+ },
75
+ {
76
+ "input": [
77
+ "44417558266855567561",
78
+ "2"
79
+ ],
80
+ "output": "4441755866855567561"
81
+ },
82
+ {
83
+ "input": [
84
+ "466331799818782912361716945291944426",
85
+ "8"
86
+ ],
87
+ "output": "46633179981872912361716945291944426"
88
+ },
89
+ {
90
+ "input": [
91
+ "42544683911351747388551259868923268826812642163249444326969715294695755866936737848459765288",
92
+ "4"
93
+ ],
94
+ "output": "4254683911351747388551259868923268826812642163249444326969715294695755866936737848459765288"
95
+ }
96
+ ],
97
+ "haskell_template": "removeDigit :: String -> String -> String\nremoveDigit number digit ",
98
+ "ocaml_template": "let removeDigit (number: string) (digit: string) : string = ",
99
+ "scala_template": "def removeDigit(number: String,digit: String): String = { \n \n}",
100
+ "java_template": "public static String removeDigit(String number, String digit) {\n\n}",
101
+ "python_template": "class Solution(object):\n def removeDigit(self, number, digit):\n \"\"\"\n :type number: str\n :type digit: str\n :rtype: str\n \"\"\"\n "
102
+ }
remove_digit_from_number_to_maximize_result/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 "12" (removeDigit "123" "3")
12
+
13
+ let test2 _ = assert_equal "231" (removeDigit "1231" "1")
14
+
15
+ let test3 _ = assert_equal "51" (removeDigit "551" "5")
16
+
17
+
18
+ (* Grouping test cases *)
19
+ let suite = "Test Suite for removeDigit" >::: [
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
remove_digit_from_number_to_maximize_result/scala_tests/MySuite.scala ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ class MySuite extends munit.FunSuite {
3
+
4
+ test("test1") {
5
+ assertEquals(Main.removeDigit("123","3"), "12")
6
+ }
7
+
8
+ test("test2") {
9
+ assertEquals(Main.removeDigit("1231","1"), "231")
10
+ }
11
+
12
+ test("test3") {
13
+ assertEquals(Main.removeDigit("551","5"), "51")
14
+ }
15
+
16
+ }
remove_letter_to_equalize_frequency/.DS_Store ADDED
Binary file (6.15 kB). View file
 
remove_letter_to_equalize_frequency/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 (equalFrequency \"abcc \")," True (equalFrequency "abcc"))
13
+
14
+ test2 :: Test
15
+ test2 = TestCase (assertEqual "for (equalFrequency \"aazz \")," False (equalFrequency "aazz"))
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
remove_letter_to_equalize_frequency/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, equalFrequency("abcc"));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals(false, equalFrequency("aazz"));
19
+ }
20
+
21
+ }
remove_letter_to_equalize_frequency/meta.json ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "id": 2532,
3
+ "name": "remove_letter_to_equalize_frequency",
4
+ "difficulty": "Easy",
5
+ "link": "https://leetcode.com/problems/remove-letter-to-equalize-frequency/",
6
+ "date": "1663372800000",
7
+ "task_description": "You are given a **0-indexed** string `word`, consisting of lowercase English letters. You need to select **one** index and **remove** the letter at that index from `word` so that the **frequency** of every letter present in `word` is equal. Return_ _`true`_ if it is possible to remove one letter so that the frequency of all letters in _`word`_ are equal, and _`false`_ otherwise_. **Note:** The frequency of a letter `x` is the number of times it occurs in the string. You **must** remove exactly one letter and cannot choose to do nothing. **Example 1:** ``` **Input:** word = \"abcc\" **Output:** true **Explanation:** Select index 3 and delete it: word becomes \"abc\" and each character has a frequency of 1. ``` **Example 2:** ``` **Input:** word = \"aazz\" **Output:** false **Explanation:** We must delete a character, so either the frequency of \"a\" is 1 and the frequency of \"z\" is 2, or vice versa. It is impossible to make all present letters have equal frequency. ``` **Constraints:** `2 <= word.length <= 100` `word` consists of lowercase English letters only.",
8
+ "public_test_cases": [
9
+ {
10
+ "label": "Example 1",
11
+ "input": "word = \"abcc\"",
12
+ "output": "true "
13
+ },
14
+ {
15
+ "label": "Example 2",
16
+ "input": "word = \"aazz\"",
17
+ "output": "false "
18
+ }
19
+ ],
20
+ "private_test_cases": [
21
+ {
22
+ "input": "trvgjewrwhjyowlpufkffnsahxnjefyhtly",
23
+ "output": false
24
+ },
25
+ {
26
+ "input": "ytjzklqahkyacwgajbmamraavlcfpldgygwauzvvojobqkeuvpgxmzgswzlskfjxwmuxonzpffpsegbbrtxnwizdottb",
27
+ "output": false
28
+ },
29
+ {
30
+ "input": "bbdgqrazfakjvzdlj",
31
+ "output": false
32
+ },
33
+ {
34
+ "input": "jvblsapeffjfwqcsgpbhzkooqng",
35
+ "output": false
36
+ },
37
+ {
38
+ "input": "mhbutrqphctamehezfpdolirogihcfqisicjpvdzrhfvphshqtestgbgvjszojfkormijvcwxiqfhzpykjg",
39
+ "output": false
40
+ },
41
+ {
42
+ "input": "vhnufzaasiqtazljrtvhgsxmthconncjojqwcriohbwwn",
43
+ "output": false
44
+ },
45
+ {
46
+ "input": "hjuxmfeuffbsihrwlvaavitngeskenfzmxplbmlerxjlaayflvcvaovcrywsxkqmyud",
47
+ "output": false
48
+ },
49
+ {
50
+ "input": "sveyvtvroocsnoobjqtxydrnriulutyjkbbvfiazesdqfgbvzoneucwgrnvcyimootoyaefqsnouxvtuebbrxmqoohioahyjyaj",
51
+ "output": false
52
+ },
53
+ {
54
+ "input": "zplheoalkuxrueuichotb",
55
+ "output": false
56
+ },
57
+ {
58
+ "input": "boglbnsaxrzlwxzxkalxvpjuhduttelbjabziotuejffjjstbsu",
59
+ "output": false
60
+ }
61
+ ],
62
+ "haskell_template": "equalFrequency :: String -> Bool\nequalFrequency word ",
63
+ "ocaml_template": "let equalFrequency (word: string) : bool = ",
64
+ "scala_template": "def equalFrequency(word: String): Boolean = { \n \n}",
65
+ "java_template": "public static boolean equalFrequency(String word) {\n\n}",
66
+ "python_template": "class Solution(object):\n def equalFrequency(self, word):\n \"\"\"\n :type word: str\n :rtype: bool\n \"\"\"\n "
67
+ }
remove_letter_to_equalize_frequency/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 true (equalFrequency "abcc")
12
+
13
+ let test2 _ = assert_equal false (equalFrequency "aazz")
14
+
15
+
16
+ (* Grouping test cases *)
17
+ let suite = "Test Suite for equalFrequency" >::: [
18
+
19
+ "test1" >:: test1;
20
+ "test2" >:: test2;
21
+ ]
22
+
23
+
24
+ (* Running the tests *)
25
+ let () = run_test_tt_main suite
26
+ end
remove_letter_to_equalize_frequency/scala_tests/MySuite.scala ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ class MySuite extends munit.FunSuite {
3
+
4
+ test("test1") {
5
+ assertEquals(Main.equalFrequency("abcc"), true)
6
+ }
7
+
8
+ test("test2") {
9
+ assertEquals(Main.equalFrequency("aazz"), false)
10
+ }
11
+
12
+ }
remove_methods_from_project/haskell_tests/Main.hs ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b7c270e01e63bc3fbbfb4480c306909c16422ba7659563a3a85a3d521a9b02e6
3
+ size 11325867
remove_methods_from_project/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(0,1,2,3)), remainingMethods(4, 1, new ArrayList<>(Arrays.asList(new ArrayList<>(Arrays.asList(1,2)),new ArrayList<>(Arrays.asList(0,1)),new ArrayList<>(Arrays.asList(3,2))))));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals(new ArrayList<>(Arrays.asList(3,4)), remainingMethods(5, 0, new ArrayList<>(Arrays.asList(new ArrayList<>(Arrays.asList(1,2)),new ArrayList<>(Arrays.asList(0,2)),new ArrayList<>(Arrays.asList(0,1)),new ArrayList<>(Arrays.asList(3,4))))));
19
+ }
20
+ @Test
21
+ public void test3() {
22
+ assertEquals(new ArrayList<>(), remainingMethods(3, 2, new ArrayList<>(Arrays.asList(new ArrayList<>(Arrays.asList(1,2)),new ArrayList<>(Arrays.asList(0,1)),new ArrayList<>(Arrays.asList(2,0))))));
23
+ }
24
+
25
+ }
remove_methods_from_project/meta.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8058affec7e83f925664dfb24e8fc8b32e7bf464a048bc766f9a702090e95cec
3
+ size 123544277
remove_methods_from_project/ocaml_tests/main.ml ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b7c270e01e63bc3fbbfb4480c306909c16422ba7659563a3a85a3d521a9b02e6
3
+ size 11325867
remove_methods_from_project/scala_tests/MySuite.scala ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3e361ad07ee607bb5d830e8bdebd790b9ccf2a5736545d8722ebc5084a8baff4
3
+ size 14397010
remove_trailing_zeros_from_a_string/haskell_tests/Main.hs ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ module Main where
3
+ import Test.HUnit
4
+
5
+ --Program start
6
+ removeTrailingZeros :: String -> String
7
+ removeTrailingZeros num = undefined
8
+
9
+ --Program end
10
+
11
+ -- Test cases
12
+
13
+ test1 :: Test
14
+ test1 = TestCase (assertEqual "for (removeTrailingZeros \"51230100 \")," "512301" (removeTrailingZeros "51230100"))
15
+
16
+ test2 :: Test
17
+ test2 = TestCase (assertEqual "for (removeTrailingZeros \"123 \")," "123" (removeTrailingZeros "123"))
18
+
19
+ test3 :: Test
20
+ test3 = TestCase (assertEqual "for (removeTrailingZeros \"697530628828869803136441264184780828792169984376501085146074525279154469088573531713959371695137076980364082329318569589350452492847925526511762512791409484801096001801034629457629453409881780694334014562272399499050505518046505709311199289449824927379094967026234945967860122386880041907015304756322123822606485423887168394581828706043093287877604186277287134817761317466599795002977920142870565956527851968383019562246389030602159947684612061714428984314787813948792477574114229286682586044287445993580955501004192443839088855862305376552537660330300950008243068681713486598374658959546659943838161781240630504902017658457885704511608229755975044591843767564694394002164901271442528581772145501745112687848273552828693727043287630930320408753553456005755850677539654708225909343781458031312677265705352443329037005711952423385324649764903826 \")," "697530628828869803136441264184780828792169984376501085146074525279154469088573531713959371695137076980364082329318569589350452492847925526511762512791409484801096001801034629457629453409881780694334014562272399499050505518046505709311199289449824927379094967026234945967860122386880041907015304756322123822606485423887168394581828706043093287877604186277287134817761317466599795002977920142870565956527851968383019562246389030602159947684612061714428984314787813948792477574114229286682586044287445993580955501004192443839088855862305376552537660330300950008243068681713486598374658959546659943838161781240630504902017658457885704511608229755975044591843767564694394002164901271442528581772145501745112687848273552828693727043287630930320408753553456005755850677539654708225909343781458031312677265705352443329037005711952423385324649764903826" (removeTrailingZeros "697530628828869803136441264184780828792169984376501085146074525279154469088573531713959371695137076980364082329318569589350452492847925526511762512791409484801096001801034629457629453409881780694334014562272399499050505518046505709311199289449824927379094967026234945967860122386880041907015304756322123822606485423887168394581828706043093287877604186277287134817761317466599795002977920142870565956527851968383019562246389030602159947684612061714428984314787813948792477574114229286682586044287445993580955501004192443839088855862305376552537660330300950008243068681713486598374658959546659943838161781240630504902017658457885704511608229755975044591843767564694394002164901271442528581772145501745112687848273552828693727043287630930320408753553456005755850677539654708225909343781458031312677265705352443329037005711952423385324649764903826"))
21
+
22
+ test4 :: Test
23
+ test4 = TestCase (assertEqual "for (removeTrailingZeros \"25264410628881446038637256311455435318271149502521315805820709022073737276054746683125641665238599445445495459069671434815474622748859576975412337337287046981835356894335552279742807327367154024251598193532772476143074807492452383515722951998862 \")," "25264410628881446038637256311455435318271149502521315805820709022073737276054746683125641665238599445445495459069671434815474622748859576975412337337287046981835356894335552279742807327367154024251598193532772476143074807492452383515722951998862" (removeTrailingZeros "25264410628881446038637256311455435318271149502521315805820709022073737276054746683125641665238599445445495459069671434815474622748859576975412337337287046981835356894335552279742807327367154024251598193532772476143074807492452383515722951998862"))
24
+
25
+ test5 :: Test
26
+ test5 = TestCase (assertEqual "for (removeTrailingZeros \"562340783104644831449127863177560622574143985731762226442133813716011531995705838135284199381505121243806967398506820579693902861246031265402542019566656508932408195752869677337882799912659756942079680145643158497988252345621183620928372490066644622951805882800659309413049441542926938750972979407797992723646999945051872780256123386988546882740884490612381285744264095838761590300531058914423027563162131965057224599242612879833548628952609910844052125844924450145935793871482167229287019452938045468160622585106064455776951185744812134334587789538545239831918753384492958185223785813379524704946094043567983192728940576221614187323751382737310556951880193629000 \")," "562340783104644831449127863177560622574143985731762226442133813716011531995705838135284199381505121243806967398506820579693902861246031265402542019566656508932408195752869677337882799912659756942079680145643158497988252345621183620928372490066644622951805882800659309413049441542926938750972979407797992723646999945051872780256123386988546882740884490612381285744264095838761590300531058914423027563162131965057224599242612879833548628952609910844052125844924450145935793871482167229287019452938045468160622585106064455776951185744812134334587789538545239831918753384492958185223785813379524704946094043567983192728940576221614187323751382737310556951880193629" (removeTrailingZeros "562340783104644831449127863177560622574143985731762226442133813716011531995705838135284199381505121243806967398506820579693902861246031265402542019566656508932408195752869677337882799912659756942079680145643158497988252345621183620928372490066644622951805882800659309413049441542926938750972979407797992723646999945051872780256123386988546882740884490612381285744264095838761590300531058914423027563162131965057224599242612879833548628952609910844052125844924450145935793871482167229287019452938045468160622585106064455776951185744812134334587789538545239831918753384492958185223785813379524704946094043567983192728940576221614187323751382737310556951880193629000"))
27
+
28
+ test6 :: Test
29
+ test6 = TestCase (assertEqual "for (removeTrailingZeros \"31354259000 \")," "31354259" (removeTrailingZeros "31354259000"))
30
+
31
+ test7 :: Test
32
+ test7 = TestCase (assertEqual "for (removeTrailingZeros \"175268620380428996398318616814084447530947067495892171784067010554582990344509293003134978703099813389321131256046333465509048857358353126757074078074938772296711322977216557378471587239475875836818902867997043428165063970813631041511546124401319522254865697970411727635914018414016280848414140778207315967695177374498765848880640806205754981989804261087765039100579296799147079792997721677670715918446612214090010046355980536576785282401364025924344578968925566745421040219119682 \")," "175268620380428996398318616814084447530947067495892171784067010554582990344509293003134978703099813389321131256046333465509048857358353126757074078074938772296711322977216557378471587239475875836818902867997043428165063970813631041511546124401319522254865697970411727635914018414016280848414140778207315967695177374498765848880640806205754981989804261087765039100579296799147079792997721677670715918446612214090010046355980536576785282401364025924344578968925566745421040219119682" (removeTrailingZeros "175268620380428996398318616814084447530947067495892171784067010554582990344509293003134978703099813389321131256046333465509048857358353126757074078074938772296711322977216557378471587239475875836818902867997043428165063970813631041511546124401319522254865697970411727635914018414016280848414140778207315967695177374498765848880640806205754981989804261087765039100579296799147079792997721677670715918446612214090010046355980536576785282401364025924344578968925566745421040219119682"))
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
remove_trailing_zeros_from_a_string/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("51230100", removeTrailingZeros("51230100"));
14
+ }
15
+ @Test
16
+ public void test2() {
17
+ assertEquals("123", removeTrailingZeros("123"));
18
+ }
19
+
20
+ }
remove_trailing_zeros_from_a_string/meta.json ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "id": 2819,
3
+ "name": "remove_trailing_zeros_from_a_string",
4
+ "difficulty": "Easy",
5
+ "link": "https://leetcode.com/problems/remove-trailing-zeros-from-a-string/",
6
+ "date": "2023-05-21 00:00:00",
7
+ "task_description": "Given a **positive** integer `num` represented as a string, return _the integer _`num`_ without trailing zeros as a string_. **Example 1:** ``` **Input:** num = \"51230100\" **Output:** \"512301\" **Explanation:** Integer \"51230100\" has 2 trailing zeros, we remove them and return integer \"512301\". ``` **Example 2:** ``` **Input:** num = \"123\" **Output:** \"123\" **Explanation:** Integer \"123\" has no trailing zeros, we return integer \"123\". ``` **Constraints:** `1 <= num.length <= 1000` `num` consists of only digits. `num` doesn't have any leading zeros.",
8
+ "public_test_cases": [
9
+ {
10
+ "label": "Example 1",
11
+ "input": "num = \"51230100\"",
12
+ "output": "\"512301\" "
13
+ },
14
+ {
15
+ "label": "Example 2",
16
+ "input": "num = \"123\"",
17
+ "output": "\"123\" "
18
+ }
19
+ ],
20
+ "private_test_cases": [
21
+ {
22
+ "input": "697530628828869803136441264184780828792169984376501085146074525279154469088573531713959371695137076980364082329318569589350452492847925526511762512791409484801096001801034629457629453409881780694334014562272399499050505518046505709311199289449824927379094967026234945967860122386880041907015304756322123822606485423887168394581828706043093287877604186277287134817761317466599795002977920142870565956527851968383019562246389030602159947684612061714428984314787813948792477574114229286682586044287445993580955501004192443839088855862305376552537660330300950008243068681713486598374658959546659943838161781240630504902017658457885704511608229755975044591843767564694394002164901271442528581772145501745112687848273552828693727043287630930320408753553456005755850677539654708225909343781458031312677265705352443329037005711952423385324649764903826",
23
+ "output": "697530628828869803136441264184780828792169984376501085146074525279154469088573531713959371695137076980364082329318569589350452492847925526511762512791409484801096001801034629457629453409881780694334014562272399499050505518046505709311199289449824927379094967026234945967860122386880041907015304756322123822606485423887168394581828706043093287877604186277287134817761317466599795002977920142870565956527851968383019562246389030602159947684612061714428984314787813948792477574114229286682586044287445993580955501004192443839088855862305376552537660330300950008243068681713486598374658959546659943838161781240630504902017658457885704511608229755975044591843767564694394002164901271442528581772145501745112687848273552828693727043287630930320408753553456005755850677539654708225909343781458031312677265705352443329037005711952423385324649764903826"
24
+ },
25
+ {
26
+ "input": "25264410628881446038637256311455435318271149502521315805820709022073737276054746683125641665238599445445495459069671434815474622748859576975412337337287046981835356894335552279742807327367154024251598193532772476143074807492452383515722951998862",
27
+ "output": "25264410628881446038637256311455435318271149502521315805820709022073737276054746683125641665238599445445495459069671434815474622748859576975412337337287046981835356894335552279742807327367154024251598193532772476143074807492452383515722951998862"
28
+ },
29
+ {
30
+ "input": "562340783104644831449127863177560622574143985731762226442133813716011531995705838135284199381505121243806967398506820579693902861246031265402542019566656508932408195752869677337882799912659756942079680145643158497988252345621183620928372490066644622951805882800659309413049441542926938750972979407797992723646999945051872780256123386988546882740884490612381285744264095838761590300531058914423027563162131965057224599242612879833548628952609910844052125844924450145935793871482167229287019452938045468160622585106064455776951185744812134334587789538545239831918753384492958185223785813379524704946094043567983192728940576221614187323751382737310556951880193629000",
31
+ "output": "562340783104644831449127863177560622574143985731762226442133813716011531995705838135284199381505121243806967398506820579693902861246031265402542019566656508932408195752869677337882799912659756942079680145643158497988252345621183620928372490066644622951805882800659309413049441542926938750972979407797992723646999945051872780256123386988546882740884490612381285744264095838761590300531058914423027563162131965057224599242612879833548628952609910844052125844924450145935793871482167229287019452938045468160622585106064455776951185744812134334587789538545239831918753384492958185223785813379524704946094043567983192728940576221614187323751382737310556951880193629"
32
+ },
33
+ {
34
+ "input": "31354259000",
35
+ "output": "31354259"
36
+ },
37
+ {
38
+ "input": "175268620380428996398318616814084447530947067495892171784067010554582990344509293003134978703099813389321131256046333465509048857358353126757074078074938772296711322977216557378471587239475875836818902867997043428165063970813631041511546124401319522254865697970411727635914018414016280848414140778207315967695177374498765848880640806205754981989804261087765039100579296799147079792997721677670715918446612214090010046355980536576785282401364025924344578968925566745421040219119682",
39
+ "output": "175268620380428996398318616814084447530947067495892171784067010554582990344509293003134978703099813389321131256046333465509048857358353126757074078074938772296711322977216557378471587239475875836818902867997043428165063970813631041511546124401319522254865697970411727635914018414016280848414140778207315967695177374498765848880640806205754981989804261087765039100579296799147079792997721677670715918446612214090010046355980536576785282401364025924344578968925566745421040219119682"
40
+ }
41
+ ],
42
+ "haskell_template": "removeTrailingZeros :: String -> String\nremoveTrailingZeros num ",
43
+ "ocaml_template": "let removeTrailingZeros (num: string) : string = ",
44
+ "scala_template": "def removeTrailingZeros(num: String): String = { \n \n}",
45
+ "java_template": "class Solution {\n public String removeTrailingZeros(String num) {\n \n }\n}",
46
+ "python_template": "class Solution(object):\n def removeTrailingZeros(self, num):\n \"\"\"\n :type num: str\n :rtype: str\n \"\"\"\n "
47
+ }
remove_trailing_zeros_from_a_string/ocaml_tests/main.ml ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ module Main = struct
3
+ open OUnit2
4
+
5
+ (* Program start *)
6
+ let removeTrailingZeros (num: string) : string = failwith "Not implemented"
7
+
8
+ (* Program end *)
9
+
10
+ (* Test cases *)
11
+
12
+ let test1 _ = assert_equal "512301" (removeTrailingZeros "51230100")
13
+
14
+ let test2 _ = assert_equal "123" (removeTrailingZeros "123")
15
+
16
+ let test3 _ = assert_equal "123" (removeTrailingZeros "697530628828869803136441264184780828792169984376501085146074525279154469088573531713959371695137076980364082329318569589350452492847925526511762512791409484801096001801034629457629453409881780694334014562272399499050505518046505709311199289449824927379094967026234945967860122386880041907015304756322123822606485423887168394581828706043093287877604186277287134817761317466599795002977920142870565956527851968383019562246389030602159947684612061714428984314787813948792477574114229286682586044287445993580955501004192443839088855862305376552537660330300950008243068681713486598374658959546659943838161781240630504902017658457885704511608229755975044591843767564694394002164901271442528581772145501745112687848273552828693727043287630930320408753553456005755850677539654708225909343781458031312677265705352443329037005711952423385324649764903826")
17
+
18
+ let test4 _ = assert_equal "123" (removeTrailingZeros "25264410628881446038637256311455435318271149502521315805820709022073737276054746683125641665238599445445495459069671434815474622748859576975412337337287046981835356894335552279742807327367154024251598193532772476143074807492452383515722951998862")
19
+
20
+ let test5 _ = assert_equal "123" (removeTrailingZeros "562340783104644831449127863177560622574143985731762226442133813716011531995705838135284199381505121243806967398506820579693902861246031265402542019566656508932408195752869677337882799912659756942079680145643158497988252345621183620928372490066644622951805882800659309413049441542926938750972979407797992723646999945051872780256123386988546882740884490612381285744264095838761590300531058914423027563162131965057224599242612879833548628952609910844052125844924450145935793871482167229287019452938045468160622585106064455776951185744812134334587789538545239831918753384492958185223785813379524704946094043567983192728940576221614187323751382737310556951880193629000")
21
+
22
+ let test6 _ = assert_equal "123" (removeTrailingZeros "31354259000")
23
+
24
+ let test7 _ = assert_equal "123" (removeTrailingZeros "175268620380428996398318616814084447530947067495892171784067010554582990344509293003134978703099813389321131256046333465509048857358353126757074078074938772296711322977216557378471587239475875836818902867997043428165063970813631041511546124401319522254865697970411727635914018414016280848414140778207315967695177374498765848880640806205754981989804261087765039100579296799147079792997721677670715918446612214090010046355980536576785282401364025924344578968925566745421040219119682")
25
+
26
+
27
+ (* Grouping test cases *)
28
+ let suite = "Test Suite for removeTrailingZeros" >::: [
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
remove_trailing_zeros_from_a_string/scala_tests/MySuite.scala ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ class MySuite extends munit.FunSuite {
3
+
4
+ test("test1") {
5
+ assertEquals(Main.removeTrailingZeros("51230100"), "512301")
6
+ }
7
+
8
+ test("test2") {
9
+ assertEquals(Main.removeTrailingZeros("123"), "123")
10
+ }
11
+
12
+ test("test3") {
13
+ assertEquals(Main.removeTrailingZeros(",6,9,7,5,3,0,6,2,8,8,2,8,8,6,9,8,0,3,1,3,6,4,4,1,2,6,4,1,8,4,7,8,0,8,2,8,7,9,2,1,6,9,9,8,4,3,7,6,5,0,1,0,8,5,1,4,6,0,7,4,5,2,5,2,7,9,1,5,4,4,6,9,0,8,8,5,7,3,5,3,1,7,1,3,9,5,9,3,7,1,6,9,5,1,3,7,0,7,6,9,8,0,3,6,4,0,8,2,3,2,9,3,1,8,5,6,9,5,8,9,3,5,0,4,5,2,4,9,2,8,4,7,9,2,5,5,2,6,5,1,1,7,6,2,5,1,2,7,9,1,4,0,9,4,8,4,8,0,1,0,9,6,0,0,1,8,0,1,0,3,4,6,2,9,4,5,7,6,2,9,4,5,3,4,0,9,8,8,1,7,8,0,6,9,4,3,3,4,0,1,4,5,6,2,2,7,2,3,9,9,4,9,9,0,5,0,5,0,5,5,1,8,0,4,6,5,0,5,7,0,9,3,1,1,1,9,9,2,8,9,4,4,9,8,2,4,9,2,7,3,7,9,0,9,4,9,6,7,0,2,6,2,3,4,9,4,5,9,6,7,8,6,0,1,2,2,3,8,6,8,8,0,0,4,1,9,0,7,0,1,5,3,0,4,7,5,6,3,2,2,1,2,3,8,2,2,6,0,6,4,8,5,4,2,3,8,8,7,1,6,8,3,9,4,5,8,1,8,2,8,7,0,6,0,4,3,0,9,3,2,8,7,8,7,7,6,0,4,1,8,6,2,7,7,2,8,7,1,3,4,8,1,7,7,6,1,3,1,7,4,6,6,5,9,9,7,9,5,0,0,2,9,7,7,9,2,0,1,4,2,8,7,0,5,6,5,9,5,6,5,2,7,8,5,1,9,6,8,3,8,3,0,1,9,5,6,2,2,4,6,3,8,9,0,3,0,6,0,2,1,5,9,9,4,7,6,8,4,6,1,2,0,6,1,7,1,4,4,2,8,9,8,4,3,1,4,7,8,7,8,1,3,9,4,8,7,9,2,4,7,7,5,7,4,1,1,4,2,2,9,2,8,6,6,8,2,5,8,6,0,4,4,2,8,7,4,4,5,9,9,3,5,8,0,9,5,5,5,0,1,0,0,4,1,9,2,4,4,3,8,3,9,0,8,8,8,5,5,8,6,2,3,0,5,3,7,6,5,5,2,5,3,7,6,6,0,3,3,0,3,0,0,9,5,0,0,0,8,2,4,3,0,6,8,6,8,1,7,1,3,4,8,6,5,9,8,3,7,4,6,5,8,9,5,9,5,4,6,6,5,9,9,4,3,8,3,8,1,6,1,7,8,1,2,4,0,6,3,0,5,0,4,9,0,2,0,1,7,6,5,8,4,5,7,8,8,5,7,0,4,5,1,1,6,0,8,2,2,9,7,5,5,9,7,5,0,4,4,5,9,1,8,4,3,7,6,7,5,6,4,6,9,4,3,9,4,0,0,2,1,6,4,9,0,1,2,7,1,4,4,2,5,2,8,5,8,1,7,7,2,1,4,5,5,0,1,7,4,5,1,1,2,6,8,7,8,4,8,2,7,3,5,5,2,8,2,8,6,9,3,7,2,7,0,4,3,2,8,7,6,3,0,9,3,0,3,2,0,4,0,8,7,5,3,5,5,3,4,5,6,0,0,5,7,5,5,8,5,0,6,7,7,5,3,9,6,5,4,7,0,8,2,2,5,9,0,9,3,4,3,7,8,1,4,5,8,0,3,1,3,1,2,6,7,7,2,6,5,7,0,5,3,5,2,4,4,3,3,2,9,0,3,7,0,0,5,7,1,1,9,5,2,4,2,3,3,8,5,3,2,4,6,4,9,7,6,4,9,0,3,8,2,6,"), "697530628828869803136441264184780828792169984376501085146074525279154469088573531713959371695137076980364082329318569589350452492847925526511762512791409484801096001801034629457629453409881780694334014562272399499050505518046505709311199289449824927379094967026234945967860122386880041907015304756322123822606485423887168394581828706043093287877604186277287134817761317466599795002977920142870565956527851968383019562246389030602159947684612061714428984314787813948792477574114229286682586044287445993580955501004192443839088855862305376552537660330300950008243068681713486598374658959546659943838161781240630504902017658457885704511608229755975044591843767564694394002164901271442528581772145501745112687848273552828693727043287630930320408753553456005755850677539654708225909343781458031312677265705352443329037005711952423385324649764903826")
14
+ }
15
+
16
+ test("test4") {
17
+ assertEquals(Main.removeTrailingZeros(",2,5,2,6,4,4,1,0,6,2,8,8,8,1,4,4,6,0,3,8,6,3,7,2,5,6,3,1,1,4,5,5,4,3,5,3,1,8,2,7,1,1,4,9,5,0,2,5,2,1,3,1,5,8,0,5,8,2,0,7,0,9,0,2,2,0,7,3,7,3,7,2,7,6,0,5,4,7,4,6,6,8,3,1,2,5,6,4,1,6,6,5,2,3,8,5,9,9,4,4,5,4,4,5,4,9,5,4,5,9,0,6,9,6,7,1,4,3,4,8,1,5,4,7,4,6,2,2,7,4,8,8,5,9,5,7,6,9,7,5,4,1,2,3,3,7,3,3,7,2,8,7,0,4,6,9,8,1,8,3,5,3,5,6,8,9,4,3,3,5,5,5,2,2,7,9,7,4,2,8,0,7,3,2,7,3,6,7,1,5,4,0,2,4,2,5,1,5,9,8,1,9,3,5,3,2,7,7,2,4,7,6,1,4,3,0,7,4,8,0,7,4,9,2,4,5,2,3,8,3,5,1,5,7,2,2,9,5,1,9,9,8,8,6,2,"), "25264410628881446038637256311455435318271149502521315805820709022073737276054746683125641665238599445445495459069671434815474622748859576975412337337287046981835356894335552279742807327367154024251598193532772476143074807492452383515722951998862")
18
+ }
19
+
20
+ test("test5") {
21
+ assertEquals(Main.removeTrailingZeros(",5,6,2,3,4,0,7,8,3,1,0,4,6,4,4,8,3,1,4,4,9,1,2,7,8,6,3,1,7,7,5,6,0,6,2,2,5,7,4,1,4,3,9,8,5,7,3,1,7,6,2,2,2,6,4,4,2,1,3,3,8,1,3,7,1,6,0,1,1,5,3,1,9,9,5,7,0,5,8,3,8,1,3,5,2,8,4,1,9,9,3,8,1,5,0,5,1,2,1,2,4,3,8,0,6,9,6,7,3,9,8,5,0,6,8,2,0,5,7,9,6,9,3,9,0,2,8,6,1,2,4,6,0,3,1,2,6,5,4,0,2,5,4,2,0,1,9,5,6,6,6,5,6,5,0,8,9,3,2,4,0,8,1,9,5,7,5,2,8,6,9,6,7,7,3,3,7,8,8,2,7,9,9,9,1,2,6,5,9,7,5,6,9,4,2,0,7,9,6,8,0,1,4,5,6,4,3,1,5,8,4,9,7,9,8,8,2,5,2,3,4,5,6,2,1,1,8,3,6,2,0,9,2,8,3,7,2,4,9,0,0,6,6,6,4,4,6,2,2,9,5,1,8,0,5,8,8,2,8,0,0,6,5,9,3,0,9,4,1,3,0,4,9,4,4,1,5,4,2,9,2,6,9,3,8,7,5,0,9,7,2,9,7,9,4,0,7,7,9,7,9,9,2,7,2,3,6,4,6,9,9,9,9,4,5,0,5,1,8,7,2,7,8,0,2,5,6,1,2,3,3,8,6,9,8,8,5,4,6,8,8,2,7,4,0,8,8,4,4,9,0,6,1,2,3,8,1,2,8,5,7,4,4,2,6,4,0,9,5,8,3,8,7,6,1,5,9,0,3,0,0,5,3,1,0,5,8,9,1,4,4,2,3,0,2,7,5,6,3,1,6,2,1,3,1,9,6,5,0,5,7,2,2,4,5,9,9,2,4,2,6,1,2,8,7,9,8,3,3,5,4,8,6,2,8,9,5,2,6,0,9,9,1,0,8,4,4,0,5,2,1,2,5,8,4,4,9,2,4,4,5,0,1,4,5,9,3,5,7,9,3,8,7,1,4,8,2,1,6,7,2,2,9,2,8,7,0,1,9,4,5,2,9,3,8,0,4,5,4,6,8,1,6,0,6,2,2,5,8,5,1,0,6,0,6,4,4,5,5,7,7,6,9,5,1,1,8,5,7,4,4,8,1,2,1,3,4,3,3,4,5,8,7,7,8,9,5,3,8,5,4,5,2,3,9,8,3,1,9,1,8,7,5,3,3,8,4,4,9,2,9,5,8,1,8,5,2,2,3,7,8,5,8,1,3,3,7,9,5,2,4,7,0,4,9,4,6,0,9,4,0,4,3,5,6,7,9,8,3,1,9,2,7,2,8,9,4,0,5,7,6,2,2,1,6,1,4,1,8,7,3,2,3,7,5,1,3,8,2,7,3,7,3,1,0,5,5,6,9,5,1,8,8,0,1,9,3,6,2,9,0,0,0,"), "562340783104644831449127863177560622574143985731762226442133813716011531995705838135284199381505121243806967398506820579693902861246031265402542019566656508932408195752869677337882799912659756942079680145643158497988252345621183620928372490066644622951805882800659309413049441542926938750972979407797992723646999945051872780256123386988546882740884490612381285744264095838761590300531058914423027563162131965057224599242612879833548628952609910844052125844924450145935793871482167229287019452938045468160622585106064455776951185744812134334587789538545239831918753384492958185223785813379524704946094043567983192728940576221614187323751382737310556951880193629")
22
+ }
23
+
24
+ test("test6") {
25
+ assertEquals(Main.removeTrailingZeros(",3,1,3,5,4,2,5,9,0,0,0,"), "31354259")
26
+ }
27
+
28
+ test("test7") {
29
+ assertEquals(Main.removeTrailingZeros(",1,7,5,2,6,8,6,2,0,3,8,0,4,2,8,9,9,6,3,9,8,3,1,8,6,1,6,8,1,4,0,8,4,4,4,7,5,3,0,9,4,7,0,6,7,4,9,5,8,9,2,1,7,1,7,8,4,0,6,7,0,1,0,5,5,4,5,8,2,9,9,0,3,4,4,5,0,9,2,9,3,0,0,3,1,3,4,9,7,8,7,0,3,0,9,9,8,1,3,3,8,9,3,2,1,1,3,1,2,5,6,0,4,6,3,3,3,4,6,5,5,0,9,0,4,8,8,5,7,3,5,8,3,5,3,1,2,6,7,5,7,0,7,4,0,7,8,0,7,4,9,3,8,7,7,2,2,9,6,7,1,1,3,2,2,9,7,7,2,1,6,5,5,7,3,7,8,4,7,1,5,8,7,2,3,9,4,7,5,8,7,5,8,3,6,8,1,8,9,0,2,8,6,7,9,9,7,0,4,3,4,2,8,1,6,5,0,6,3,9,7,0,8,1,3,6,3,1,0,4,1,5,1,1,5,4,6,1,2,4,4,0,1,3,1,9,5,2,2,2,5,4,8,6,5,6,9,7,9,7,0,4,1,1,7,2,7,6,3,5,9,1,4,0,1,8,4,1,4,0,1,6,2,8,0,8,4,8,4,1,4,1,4,0,7,7,8,2,0,7,3,1,5,9,6,7,6,9,5,1,7,7,3,7,4,4,9,8,7,6,5,8,4,8,8,8,0,6,4,0,8,0,6,2,0,5,7,5,4,9,8,1,9,8,9,8,0,4,2,6,1,0,8,7,7,6,5,0,3,9,1,0,0,5,7,9,2,9,6,7,9,9,1,4,7,0,7,9,7,9,2,9,9,7,7,2,1,6,7,7,6,7,0,7,1,5,9,1,8,4,4,6,6,1,2,2,1,4,0,9,0,0,1,0,0,4,6,3,5,5,9,8,0,5,3,6,5,7,6,7,8,5,2,8,2,4,0,1,3,6,4,0,2,5,9,2,4,3,4,4,5,7,8,9,6,8,9,2,5,5,6,6,7,4,5,4,2,1,0,4,0,2,1,9,1,1,9,6,8,2,"), "175268620380428996398318616814084447530947067495892171784067010554582990344509293003134978703099813389321131256046333465509048857358353126757074078074938772296711322977216557378471587239475875836818902867997043428165063970813631041511546124401319522254865697970411727635914018414016280848414140778207315967695177374498765848880640806205754981989804261087765039100579296799147079792997721677670715918446612214090010046355980536576785282401364025924344578968925566745421040219119682")
30
+ }
31
+
32
+ }
removing_minimum_number_of_magic_beans/.DS_Store ADDED
Binary file (6.15 kB). View file
 
removing_minimum_number_of_magic_beans/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 (minimumRemoval [4,1,6,5])," 4 (minimumRemoval [4,1,6,5]))
13
+
14
+ test2 :: Test
15
+ test2 = TestCase (assertEqual "for (minimumRemoval [2,10,3,2])," 7 (minimumRemoval [2,10,3,2]))
16
+
17
+
18
+ -- Grouping test cases
19
+ tests :: Test
20
+ tests = TestList [TestLabel "Test1" test1]
21
+
22
+ -- Running the tests
23
+ main :: IO Counts
24
+ main = runTestTT tests
removing_minimum_number_of_magic_beans/java_tests/Main.java ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import static org.junit.jupiter.api.Assertions.*;
3
+ import org.junit.jupiter.api.Test;
4
+ import java.util.List;
5
+ import java.util.Arrays;
6
+ import java.util.ArrayList;
7
+ public class Main {
8
+ //Program start
9
+
10
+ //Program end
11
+
12
+ @Test
13
+ public void test1() {
14
+ assertEquals(4, minimumRemoval(new ArrayList<>(Arrays.asList(4,1,6,5))));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals(7, minimumRemoval(new ArrayList<>(Arrays.asList(2,10,3,2))));
19
+ }
20
+
21
+ }
removing_minimum_number_of_magic_beans/meta.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b09e254f35994db813f50e3e800406b1475a5fa7b4491195c3d1d2991854721c
3
+ size 11801111