DatasetRepo commited on
Commit
d3d4011
·
verified ·
1 Parent(s): 946bc52

39540dc111a52de652e67196dfbc20970f9019caec53ad906dd02e94ff244fc2

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +1 -0
  2. longest_subarray_with_maximum_bitwise_and/.DS_Store +0 -0
  3. longest_subarray_with_maximum_bitwise_and/haskell_tests/Main.hs +24 -0
  4. longest_subarray_with_maximum_bitwise_and/java_tests/Main.java +21 -0
  5. longest_subarray_with_maximum_bitwise_and/meta.json +3 -0
  6. longest_subarray_with_maximum_bitwise_and/ocaml_tests/main.ml +26 -0
  7. longest_subarray_with_maximum_bitwise_and/scala_tests/MySuite.scala +12 -0
  8. longest_subsequence_with_decreasing_adjacent_difference/haskell_tests/Main.hs +0 -0
  9. longest_subsequence_with_decreasing_adjacent_difference/java_tests/Main.java +24 -0
  10. longest_subsequence_with_decreasing_adjacent_difference/meta.json +0 -0
  11. longest_subsequence_with_decreasing_adjacent_difference/ocaml_tests/main.ml +0 -0
  12. longest_subsequence_with_decreasing_adjacent_difference/scala_tests/MySuite.scala +36 -0
  13. longest_subsequence_with_limited_sum/.DS_Store +0 -0
  14. longest_subsequence_with_limited_sum/haskell_tests/Main.hs +24 -0
  15. longest_subsequence_with_limited_sum/java_tests/Main.java +21 -0
  16. longest_subsequence_with_limited_sum/meta.json +0 -0
  17. longest_subsequence_with_limited_sum/ocaml_tests/main.ml +26 -0
  18. longest_subsequence_with_limited_sum/scala_tests/MySuite.scala +12 -0
  19. longest_substring_of_one_repeating_character/.DS_Store +0 -0
  20. longest_substring_of_one_repeating_character/haskell_tests/Main.hs +24 -0
  21. longest_substring_of_one_repeating_character/java_tests/Main.java +21 -0
  22. longest_substring_of_one_repeating_character/meta.json +1047 -0
  23. longest_substring_of_one_repeating_character/ocaml_tests/main.ml +26 -0
  24. longest_substring_of_one_repeating_character/scala_tests/MySuite.scala +12 -0
  25. make_a_square_with_the_same_color/java_tests/Main.java +24 -0
  26. make_array_zero_by_subtracting_equal_amounts/.DS_Store +0 -0
  27. make_array_zero_by_subtracting_equal_amounts/haskell_tests/Main.hs +24 -0
  28. make_array_zero_by_subtracting_equal_amounts/java_tests/Main.java +21 -0
  29. make_array_zero_by_subtracting_equal_amounts/meta.json +523 -0
  30. make_array_zero_by_subtracting_equal_amounts/ocaml_tests/main.ml +26 -0
  31. make_array_zero_by_subtracting_equal_amounts/scala_tests/MySuite.scala +12 -0
  32. make_costs_of_paths_equal_in_a_binary_tree/haskell_tests/Main.hs +36 -0
  33. make_costs_of_paths_equal_in_a_binary_tree/java_tests/Main.java +21 -0
  34. make_costs_of_paths_equal_in_a_binary_tree/meta.json +325 -0
  35. make_costs_of_paths_equal_in_a_binary_tree/ocaml_tests/main.ml +38 -0
  36. make_costs_of_paths_equal_in_a_binary_tree/scala_tests/MySuite.scala +28 -0
  37. make_k_subarray_sums_equal/.DS_Store +0 -0
  38. make_k_subarray_sums_equal/haskell_tests/Main.hs +24 -0
  39. make_k_subarray_sums_equal/java_tests/Main.java +21 -0
  40. make_k_subarray_sums_equal/meta.json +0 -0
  41. make_k_subarray_sums_equal/ocaml_tests/main.ml +26 -0
  42. make_k_subarray_sums_equal/scala_tests/MySuite.scala +12 -0
  43. make_number_of_distinct_characters_equal/.DS_Store +0 -0
  44. make_number_of_distinct_characters_equal/haskell_tests/Main.hs +27 -0
  45. make_number_of_distinct_characters_equal/java_tests/Main.java +25 -0
  46. make_number_of_distinct_characters_equal/meta.json +0 -0
  47. make_number_of_distinct_characters_equal/ocaml_tests/main.ml +29 -0
  48. make_number_of_distinct_characters_equal/scala_tests/MySuite.scala +16 -0
  49. make_string_a_subsequence_using_cyclic_increments/haskell_tests/Main.hs +0 -0
  50. make_string_a_subsequence_using_cyclic_increments/java_tests/Main.java +25 -0
.gitattributes CHANGED
@@ -151,3 +151,4 @@ longest_palindrome_by_concatenating_two_letter_words/meta.json filter=lfs diff=l
151
  longest_path_with_different_adjacent_characters/meta.json filter=lfs diff=lfs merge=lfs -text
152
  longest_special_path/meta.json filter=lfs diff=lfs merge=lfs -text
153
  longest_special_path_ii/meta.json filter=lfs diff=lfs merge=lfs -text
 
 
151
  longest_path_with_different_adjacent_characters/meta.json filter=lfs diff=lfs merge=lfs -text
152
  longest_special_path/meta.json filter=lfs diff=lfs merge=lfs -text
153
  longest_special_path_ii/meta.json filter=lfs diff=lfs merge=lfs -text
154
+ longest_subarray_with_maximum_bitwise_and/meta.json filter=lfs diff=lfs merge=lfs -text
longest_subarray_with_maximum_bitwise_and/.DS_Store ADDED
Binary file (6.15 kB). View file
 
longest_subarray_with_maximum_bitwise_and/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 (longestSubarray [1,2,3,3,2,2])," 2 (longestSubarray [1,2,3,3,2,2]))
13
+
14
+ test2 :: Test
15
+ test2 = TestCase (assertEqual "for (longestSubarray [1,2,3,4])," 1 (longestSubarray [1,2,3,4]))
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
longest_subarray_with_maximum_bitwise_and/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(2, longestSubarray(new ArrayList<>(Arrays.asList(1,2,3,3,2,2))));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals(1, longestSubarray(new ArrayList<>(Arrays.asList(1,2,3,4))));
19
+ }
20
+
21
+ }
longest_subarray_with_maximum_bitwise_and/meta.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e0f9fd94705aec2aa51baf7568c09e11a4bd4d09078aff58bd38774b54d0287a
3
+ size 12332959
longest_subarray_with_maximum_bitwise_and/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 2 (longestSubarray [1;2;3;3;2;2])
12
+
13
+ let test2 _ = assert_equal 1 (longestSubarray [1;2;3;4])
14
+
15
+
16
+ (* Grouping test cases *)
17
+ let suite = "Test Suite for longestSubarray" >::: [
18
+
19
+ "test1" >:: test1;
20
+ "test2" >:: test2;
21
+ ]
22
+
23
+
24
+ (* Running the tests *)
25
+ let () = run_test_tt_main suite
26
+ end
longest_subarray_with_maximum_bitwise_and/scala_tests/MySuite.scala ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ class MySuite extends munit.FunSuite {
3
+
4
+ test("test1") {
5
+ assertEquals(Main.longestSubarray(List(1,2,3,3,2,2)), 2)
6
+ }
7
+
8
+ test("test2") {
9
+ assertEquals(Main.longestSubarray(List(1,2,3,4)), 1)
10
+ }
11
+
12
+ }
longest_subsequence_with_decreasing_adjacent_difference/haskell_tests/Main.hs ADDED
The diff for this file is too large to render. See raw diff
 
longest_subsequence_with_decreasing_adjacent_difference/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(3, longestSubsequence(Arrays.asList(16,6,3)));
14
+ }
15
+ @Test
16
+ public void test2() {
17
+ assertEquals(4, longestSubsequence(Arrays.asList(6,5,3,4,2,1)));
18
+ }
19
+ @Test
20
+ public void test3() {
21
+ assertEquals(5, longestSubsequence(Arrays.asList(10,20,10,19,10,20)));
22
+ }
23
+
24
+ }
longest_subsequence_with_decreasing_adjacent_difference/meta.json ADDED
The diff for this file is too large to render. See raw diff
 
longest_subsequence_with_decreasing_adjacent_difference/ocaml_tests/main.ml ADDED
The diff for this file is too large to render. See raw diff
 
longest_subsequence_with_decreasing_adjacent_difference/scala_tests/MySuite.scala ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ class MySuite extends munit.FunSuite {
3
+
4
+ test("test1") {
5
+ assertEquals(Main.longestSubsequence(List(16,6,3)), 3)
6
+ }
7
+
8
+ test("test2") {
9
+ assertEquals(Main.longestSubsequence(List(6,5,3,4,2,1)), 4)
10
+ }
11
+
12
+ test("test3") {
13
+ assertEquals(Main.longestSubsequence(List(10,20,10,19,10,20)), 5)
14
+ }
15
+
16
+ test("test4") {
17
+ assertEquals(Main.longestSubsequence(96,282,13,170,113,223,14,255,187,222,191,28,247,238,176,189,89,36,53,274,100,183,193,62,281,265,81,271,4,281,236,20,300,22,95,174,266,46,215,286,121,258,282,73,24,263,148,35,26,258,72,150,238,34,112,113,152,269,157,92,276,133,148,200,231,18,258,150,292,246,20,296,271,66,247,13,202,58,243,219,212,272,113,162,192,112,27,165,244,89,95,120,169,268,61,139,19,240,186,172,135,49,259,73,162,194,194,36,185,16,212,193,119,242,115,50,77,138,155,129,152,213,163,291,113,103,112,218,55,267,250,68,212,296,297,27,28,217,109,138,269,245,149,276,288,113,278,61,19,121,273,137,212,66,17,248,281,185,102,208,15,71,138,70,247,130,102,283,233,84,110,52,15,48,66,101,272,92,159,193,85,235,4,46,157,24,228,8,155,186,91,298,154,194,189,141,64,162,107,81,85,119,125,77,263,104,23,57,90,71,196,85,244,255,268,135,211,32,62,20,210,197,36,180,170,215,139,36,41,95,164,155,41,299,288,140,229,179,278,163,23,125,167,194,61,143,196,140,55,10,36,52,152,28,292,18,223,108,217,295,134,204,151,179,206,260,254,123,196,117,35,141,196,179,255,6,79,250,99,151,144,195,18,284,15,263,33,164,186,102,51,236,193,159,58,199,73,241,266,293,205,45,24,293,217,186,262,123,133,28,284,78,154,272,138,275,279,280,32,182,66,270,174,63,200,103,223,136,223,145,25,268,199,298,94,25,93,101,150,150,205,142,84,261,6,162,64,277,229,232,35,54,69,258,14,216,134,30,261,101,201,194,7,111,121,41,117,175,95,286,160,37,286,112,160,298,61,164,166,235,35,196,211,79,228,176,206,10,47,152,5,15,64,20,194,73,142,238,169,152,26,195,251,220,300,203,59,15,208,72,42,49,102,30,3,12,231,229,222,89,10,151,133,187,215,268,56,211,180,294,73,126,43,90,117,280,173,132,78,64,200,37,209,22,165,238,103,67,285,9,252,13,277,58,65,209,174,125,86,165,5,65,67,152,46,264,281,13,300,59,252,239,43,218,66,141,107,73,65,239,287,85,292,136,250,110,3,206,273,268,88,22,9,271,133,151,110,114,2,67,198,48,47,66,174,100,61,204,281,13,5,90,52,36,32,144,93,180,266,221,112,152,35,295,130,281,203,180,135,198,59,133,37,208,274,149,124,39,137,137,120,256,220,19,213,283,78,232,273,294,198,82,289,158,16,85,19,1,281,122,178,158,69,213,274,27,165,37,185,196,26,146,224,206,259,212,281,87,105,171,72,240,67,49,116,34,30,54,49,145,121,112,249,84,242,32,47,270,78,71,6,137,292,70,101,63,242,146,55,73,66,201,195,45,147,172,90,188,267,198,135,265,249,212,204,255,141,198,9,6,258,227,111,2,136,288,129,41,97,92,5,90,231,124,296,266,126,259,239,197,134,104,221,220,284,38,253,296,284,101,131,229,109,236,90,147,24,83,218,168,228,285,61,17,141,218,161,149,198,209,235,105,112,154,148,115,62,48,153,82,222,4,92,273,51,40,29,128,115,70,277,57,211,287,44,24,172,175,267,64,261,84,77,46,116,75,40,276,175,244,105,108,233,39,138,158,271,5,3,260,135,43,263,93,42,151,241,215,13,146,135,168,73,192,41,184,181,71,188,167,14,188,241,99,148,11,168,294,220,148,212,210,236,17,214,161,212,28,89,63,102,254,295,34,104,292,167,217,273,136,56,159,212,132,31,28,146,89,220,12,283,62,279,27,187,42,264,198,262,255,47,10,269,169,257,189,57,137,123,168,21,76,37,28,153,38,158,247,53,125,32,54,254,6,30,159,284,259,52,53,186,211,224,51,281,46,167,87,52,202,268,300,76,272,158,154,206,167,233,137,201,140,141,128,18,77,43,291,176,92,231,240,65,249,273,38,161,211,277,123,21,251,22,157,44,136,85,69,7,20,59,23,66,156,4,249,246,95,178,229,64,8,23,193,93,224,164,30,142,15,38,206,293,157,66,139,44,74,258,49,115,232,284,105,38,35,67,287,169,9,97,24,170,234,275,81,97,296,103,254,8,22,45,189,17,291,256,177,248,211,185,180,205,163,11,91,215,182,216,150,17,91,240,254,25,161,6,188,108,150,202,86,160,135,151,163,55,103,237,261,233,57,11,200,12,71,155,285,89,50,97,26,256,118,121,106,41,98,185,86,52,69,44,247,158,279,275,263,273,297,290,246,206,298,169,143,92,214,46,271,32,140,82,225,101,120,250,133,154,47,191,9,172,207,227,220,24,58,219,157,66,199,112,72,204,233,119,100,106,18,25,277,192,265,256,97,255,13,113,220,279,293,108,77,173,145,151,108,113,280,210,220,220,103,8,272,59,11,151,103,135,253,188,183,62,119,191,2,9,132,94,238,66,155,255,278,289,71,129,5,140,95,65,40,263,203,104,288,107,73,172,120,59,173,173,298,25,225,170,145,190,55,144,177,29,135,283,277,13,163,9,71,237,99,71,259,298,55,7,245,153,204,117,12,20,89,144,125,115,286,66,197,224,84,216,9,63,33,107,273,197,300,239,106,233,234,164,40,37,281,232,75,44,24,287,165,77,50,61,142,197,45,5,244,218,144,99,229,134,108,280,252,161,198,184,50,143,98,153,19,194,75,179,75,284,161,52,24,252,292,291,252,113,80,114,88,94,245,78,36,139,41,236,123,265,188,7,208,123,80,274,119,244,29,115,240,130,272,185,300,243,249,293,252,48,299,152,233,224,213,241,80,187,13,52,35,172,31,241,125,122,219,263,150,136,84,198,50,266,245,120,43,20,173,188,46,4,71,142,42,253,187,208,95,128,33,125,67,30,159,194,228,228,152,150,204,285,195,30,28,271,95,215,160,2,224,265,167,288,230,93,225,83,124,18,230,101,89,288,292,183,218,107,282,166,228,113,263,28,99,76,258,6,36,73,192,221,40,18,151,192,43,47,191,223,266,92,256,162,219,272,287,299,153,261,230,84,247,59,251,173,196,169,175,213,122,294,81,147,228,141,266,58,280,34,239,213,14,300,74,67,273,111,239,150,28,92,300,294,259,138,136,140,53,81,80,99,224,123,187,175,160,20,103,218,238,17,246,70,275,164,249,282,264,253,280,198,106,25,212,280,167,71,56,118,216,280,227,131,192,285,175,216,48,68,266,37,207,141,293,168,72,168,152,49,246,281,134,173,206,2,150,178,89,169,31,130,144,111,214,50,141,162,87,83,188,180,219,83,249,152,32,212,7,223,55,255,100,91,89,115,227,62,61,269,268,162,214,146,99,135,222,244,53,138,92,239,214,267,271,119,116,62,92,266,249,248,155,219,29,10,285,195,234,279,112,197,253,46,36,222,104,207,187,90,113,16,262,268,154,6,74,198,4,60,274,118,258,240,217,270,275,232,11,167,218,299,222,165,183,57,281,153,34,23,67,201,103,180,108,148,47,165,1,216,177,8,238,67,49,169,37,12,208,109,273,18,130,121,293,295,203,180,91,171,165,96,247,262,1,244,77,114,38,183,90,97,50,45,122,162,32,17,254,23,2,231,27,258,167,114,228,185,187,6,155,221,246,134,131,149,97,178,268,79,125,46,210,143,113,186,144,89,32,63,218,94,223,282,70,164,78,220,43,196,146,54,163,285,178,199,24,20,279,269,62,142,12,285,170,31,210,95,11,121,243,124,151,159,283,122,213,2,41,12,287,203,176,15,138,290,203,267,85,176,234,167,102,280,28,200,243,13,76,17,122,12,128,237,281,185,90,161,202,26,197,229,91,95,12,243,122,38,167,287,242,133,117,2,121,30,168,263,294,238,63,36,272,64,127,40,238,51,107,263,31,242,98,297,134,153,84,244,180,126,266,218,105,159,174,86,174,282,170,249,242,94,124,53,242,103,94,173,35,278,156,136,117,250,293,92,60,254,233,229,248,73,68,148,7,146,191,291,158,290,103,160,157,43,207,53,260,57,61,189,200,261,81,13,217,175,241,196,257,240,216,30,287,210,96,115,71,222,4,64,183,227,126,8,223,54,245,114,199,227,247,20,23,116,61,108,64,24,205,148,285,177,215,47,12,90,207,109,57,6,222,2,47,206,87,109,100,119,190,170,182,74,46,20,259,4,161,2,78,17,240,45,108,183,58,25,22,146,209,31,135,244,62,194,155,117,269,202,293,73,19,279,252,128,219,17,5,251,236,157,256,246,182,219,217,39,79,78,34,222,270,120,68,277,196,299,260,206,283,264,94,245,182,115,170,69,286,104,131,189,51,249,24,191,280,98,35,37,212,273,30,129,173,36,153,299,148,46,244,266,97,131,131,181,268,86,277,255,284,9,254,237,254,85,22,75,69,36,219,230,159,60,180,34,296,134,109,33,195,2,15,284,230,80,117,57,206,202,110,262,158,9,263,174,59,118,107,31,96,128,11,124,53,233,69,10,220,290,57,10,130,59,120,132,214,30,149,294,142,215,56,289,55,82,275,21,202,37,138,171,278,216,267,59,13,6,253,121,289,129,229,273,103,51,71,190,108,16,15,189,7,179,37,169,1,192,6,2,270,13,216,225,237,209,190,271,114,294,148,104,117,286,170,137,77,73,300,29,179,9,91,202,148,102,270,23,205,181,54,291,141,32,135,120,49,26,130,180,68,105,184,270,96,13,234,89,172,275,24,16,154,17,53,131,21,19,12,14,23,204,102,28,130,256,136,206,103,284,8,89,266,68,276,280,68,106,77,66,263,114,208,30,22,178,236,213,247,185,284,37,119,225,202,39,164,273,64,69,41,115,27,25,92,24,228,284,2,103,52,234,248,283,126,213,13,169,232,227,142,230,150,288,121,155,16,271,65,210,288,205,231,154,262,111,217,164,237,254,216,182,38,200,148,199,3,182,300,279,143,144,263,247,287,152,209,90,17,20,9,158,146,121,3,9,154,160,71,39,122,93,261,83,155,293,140,218,206,106,299,249,44,119,211,146,193,141,227,269,140,92,225,7,283,2,158,61,56,110,267,231,143,96,133,49,17,20,202,173,152,245,294,265,107,14,110,262,280,201,291,109,208,217,252,114,178,193,280,59,76,36,105,255,45,77,181,201,135,201,195,139,179,37,168,11,285,35,65,101,129,113,257,210,61,86,42,185,214,80,41,98,117,190,71,136,106,94,3,267,244,134,102,4,96,270,86,82,101,219,187,7,99,263,275,169,213,91,137,108,121,81,214,243,73,253,130,163,156,39,244,93,71,241,150,147,64,30,235,270,90,190,53,297,121,221,277,143,298,77,86,79,122,87,86,19,144,35,201,115,72,59,200,35,223,109,253,45,53,276,138,279,62,234,136,3,27,131,272,60,297,275,12,241,49,232,29,74,155,213,58,47,46,141,72,81,180,132,254,125,88,129,275,163,106,258,135,190,229,206,277,81,131,290,18,125,36,248,287,269,160,125,253,31,2,97,159,54,14,211,87,73,238,32,213,45,110,185,186,5,166,228,157,261,179,209,8,238,107,223,82,259,198,58,29,17,96,77,177,66,268,157,248,204,226,59,93,246,292,62,161,69,146,7,82,9,98,12,264,82,25,293,54,217,63,67,116,2,103,249,126,288,73,70,192,272,111,262,111,274,205,155,177,251,243,123,150,153,282,161,73,118,55,297,288,202,282,114,22,78,23,155,227,276,210,237,275,227,36,92,182,79,241,128,1,231,247,253,117,76,108,134,156,165,174,205,295,263,216,56,163,247,94,75,283,150,44,157,133,39,45,292,85,89,282,144,189,29,274,251,235,255,143,181,184,99,22,37,100,276,28,91,52,300,158,60,96,237,297,249,255,155,127,77,187,226,109,68,144,138,12,51,275,122,13,102,156,17,270,25,44,84,235,105,71,276,192,139,21,47,252,268,288,122,300,268,167,277,3,75,99,176,44,296,208,256,174,89,83,83,289,145,49,145,185,44,225,244,223,137,171,211,98,254,156,152,89,221,281,91,168,106,63,186,283,111,180,26,223,216,51,290,20,92,98,222,266,2,176,199,35,140,244,250,19,202,142,43,254,51,143,27,66,245,8,133,223,170,166,30,290,172,88,254,45,68,116,99,74,212,52,22,234,67,189,162,173,191,6,119,187,222,91,177,194,50,43,5,92,143,277,237,39,212,190,213,118,30,279,238,220,227,40,211,6,15,253,1,116,56,11,169,116,12,200,230,155,243,115,265,201,207,210,238,96,60,86,101,92,31,119,271,35,99,204,31,167,299,234,196,91,285,241,164,247,253,82,1,85,270,296,192,48,23,108,40,180,244,137,163,132,106,236,35,104,131,251,25,117,270,222,189,66,24,84,159,27,191,240,250,57,146,200,253,284,39,113,79,125,219,68,237,209,98,214,210,285,39,78,74,105,253,215,130,226,189,106,118,70,181,111,208,34,225,6,290,19,207,250,11,275,192,206,175,197,232,220,58,179,230,259,182,207,166,232,109,143,261,57,139,241,127,167,125,142,128,199,188,296,58,84,238,188,75,143,141,97,178,138,141,189,262,157,157,4,146,287,177,202,19,80,94,31,38,242,2,76,195,127,57,233,178,9,121,40,170,96,225,243,119,22,182,69,162,239,151,65,6,274,86,11,248,187,162,273,99,240,137,176,33,61,274,94,154,11,62,171,3,218,70,59,279,175,73,49,80,247,256,298,217,276,103,146,15,6,182,30,147,298,101,298,239,98,35,241,10,246,295,231,141,50,187,147,48,136,116,111,140,88,204,239,33,131,77,42,41,231,93,204,195,108,8,39,80,239,100,218,217,77,219,232,81,63,47,113,87,194,248,194,25,83,18,41,14,285,223,227,46,278,282,242,156,252,115,61,89,213,185,132,90,190,11,236,264,44,232,64,270,136,176,24,104,207,151,100,128,145,17,27,263,106,226,138,271,90,290,279,197,7,205,123,193,56,248,229,217,29,207,28,293,25,110,31,135,184,261,72,167,99,203,64,103,54,239,33,220,203,65,73,99,122,127,228,50,288,167,122,87,132,74,162,139,104,185,265,172,252,256,269,38,279,293,121,255,281), 147)
18
+ }
19
+
20
+ test("test5") {
21
+ assertEquals(Main.longestSubsequence(138,96,66,254,107,212,110,31,246,246,116,207,110,63,147,45,77,225,291,61,204,49,12,20,64,295,99,35,10,251,248,137,169,7,16,264,114,223,154,21,221,290,26,293,299,143,176,171,284,18,177,166,112,279,269,82,84,17,51,73,12,20,261,140,88,286,158,98,135,255,136,118,276,96,236,74,256,13,154,38,9,47,285,235,67,28,58,217,98,74,204,9,132,47,5,293,258,166,129,48,91,276,9,71,232,287,262,20,252,248,246,9,18,189,158,278,252,48,257,163,255,66,243,39,88,116,247,260,227,77,9,258,23,40,292,2,214,113,235,285,276,83,281,86,256,35,272,183,166,276,199,202,221,2,172,137,54,17,114,189,167,28,245,131,134,46,10,290,291,291,63,158,41,142,98,219,9,240,166,195,240,287,102,72,152,227,146,40,259,240,80,171,206,48,279,285,267,273,69,209,11,269,78,267,242,234,251,113,54,4,135,263,226,298,268,75,12,170,108,60,225,223,186,130,241,159,295,188,281,191,135,36,227,222,104,166,181,111,142,125,255,161,59,287,182,126,71,162,94,268,212,259,15,98,259,16,252,33,259,84,171,102,296,72,67,53,223,195,257,240,35,114,80,125,177,187,141,54,224,207,172,251,89,202,167,214,123,293,91,89,24,66,259,182,147,186,155,298,230,95,45,148,111,110,80,139,226,69,233,141,111,73,31,217,295,88,273,218,180,299,4,112,240,98,232,130,210,183,78,267,24,17,45,292,60,112,245,2,138,230,278,78,197,270,47,32,151,17,216,254,224,268,55,89,109,190,109,229,118,98,21,136,124,106,187,166,297,149,199,139,217,159,182,56,243,255,178,160,32,146,241,53,17,269,88,243,255,41,216,195,150,260,51,78,112,68,189,2,39,141,198,176,56,245,23,263,290,269,118,250,161,102,41,250,101,210,252,79,221,154,174,294,261,198,121,87,271,7,110,16,91,150,211,275,51,78,210,61,79,216,203,23,287,286,42,287,41,225,173,258,83,23,166,226,64,131,280,205,9,283,130,133,199,11,27,171,67,154,125,85,204,194,169,260,62,208,202,232,199,38,180,123,283,294,43,99,149,205,197,101,218,13,239,43,258,132,76,43,218,239,39,156,157,199,68,8,109,57,17,50,225,254,141,20,275,221,178,171,121,52,5,35,118,285,268,133,173,5,171,218,60,292,80,167,279,193,41,19,160,12,162,78,179,140,144,66,201,218,128,237,26,48,259,212,42,87,221,146,241,185,17,196,127,234,299,28,103,185,214,111,97,174,276,142,239,261,44,185,5,85,279,41,279,57,36,188,146,67,212,144,149,14,134,263,238,135,208,152,114,38,300,104,55,260,29,42,30,43,127,163,241,296,157,162,141,101,118,295,55,275,174,58,191,107,11,258,182,116,143,143,132,194,232,165,218,12,106,255,53,225,42,1,253,69,148,189,106,64,147,166,142,237,176,141,285,243,136,83,254,102,254,101,282,90,16,216,162,34,241,275,201,294,56,217,279,257,126,264,3,123,126,112,230,67,82,117,266,194,254,224,260,197,226,299,200,74,170,281,98,160,41,240,88,149,14,67,252,164,120,141,166,231,129,87,151,246,285,232,228,214,197,207,89,18,170,12,69,155,7,128,89,273,80,90,39,18,198,9,11,122,282,95,121,70,229,209,83,48,188,155,253,29,86,20,76,86,156,160,35,78,220,294,203,225,184,65,246,223,198,207,45,282,213,137,7,204,5,74,7,145,163,166,249,239,188,121,166,152,6,281,243,238,16,272,26,156,147,183,72,115,219,233,183,275,129,282,93,200,263,5,11,264,283,108,126,53,272,171,206,62,167,88,72,173,20,169,219,17,125,123,62,241,231,189,70,261,225,270,82,92,71,287,263,198,104,280,201,131,168,245,288,17,291,124,299,249,26,268,291,53,300,257,45,183,238,138,121,139,145,31,268,225,253,187,24,154,200,298,263,32,34,212,151,126,40,146,264,108,218,268,35,265,81,280,12,281,4,224,179,202,141,274,103,75,25,8,190,125,204,166,253,274,57,274,62,174,235,168,224,106,270,140,124,117,23,40,267,204,295,233,35,283,211,281,12,102,202,263,131,270,293,298,253,193,149,47,101,69,117,189,22,139,136,166,10,16,67,79,43,57,39,300,70,81,266,174,199,285,242,7,32,65,291,108,226,92,160,17,28,140,60,299,251,140,105,277,85,55,22,287,219,236,201,92,148,204,66,289,264,268,87,209,296,37,226,87,186,132,214,68,147,295,120,138,259,172,221,78,168,245,205,248,177,148,120,87,22,196,201,274,161,95,239,136,295,200,36,75,228,300,95,247,281,280,204,48,197,97,185,156,38,36,239,78,166,117,62,216,221,141,245,35,254,111,95,219,160,183,21,40,18,290,199,85,61,131,139,212,9,192,87,295,200,16,75,159,257,114,230,51,147,35,100,79,282,159,89,95,163,109,281,66,290,6,21,146,257,118,250,67,174,98,243,92,129,276,79,213,7,141,158,90,232,57,180,200,236,216,11,158,148,286,274,88,225,40,207,259,235,173,192,165,293,93,292,22,43,156,229,38,218,137,144,185,198,151,125,300,215,39,37,170,47,83,105,265,83,173,268,168,287,283,149,35,152,120,147,183,216,33,21,5,264,183,174,297,2,48,221,273,99,120,257,256,61,115,249,109,184,262,17,269,195,160,49,19,192,45,251,215,237,5,209,49,81,7,35,220,161,222,176,183,87,161,201,276,166,218,92,106,297,73,150,68,229,47,229,78,16,177,122,299,15,154,282,257,190,80,69,71,13,89,177,9,106,204,226,58,274,166,230,196,233,91,291,39,157,289,122,280,37,127,297,223,197,217,98,41,230,78,120,266,12,202,80,75,235,206,294,69,245,293,53,250,1,231,300,194,206,272,154,255,279,51,210,63,233,163,94,298,157,260,90,58,74,57,233,50,109,265,74,40,41,266,157,173,152,15,141,240,138,265,260,99,233,235,30,68,181,125,103,295,26,297,51,271,104,142,79,251,272,200,65,254,210,47,59,8,38,106,50,263,203,170,59,210,154,187,278,281,236,238,128,261,194,274,146,116,256,136,15,120,13,261,120,170,280,33,58,252,91,288,114,37,91,180,216,38,133,194,11,173,28,280,251,36,57,79,7,104,71,231,265,207,175,232,257,196,123,165,75,248,212,60,51,157,158,164,93,28,40,215,194,55,274,200,77,103,123,219,214,49,8,60,198,298,153,132,47,38,286,175,8,36,265,286,51,73,88,160,299,113,197,188,286,105,17,35,138,234,169,248,295,84,236,273,129,237,262,39,72,132,235,191,41,228,60,273,258,133,114,172,255,212,44,67,204,255,46,115,281,287,259,153,106,266,261,295,127,274,39,197,194,272,138,64,45,153,265,94,31,246,294,4,40,19,96,32,33,262,234,96,252,207,174,267,79,234,86,188,183,3,256,183,287,206,32,250,111,10,90,15,42,160,42,82,150,109,110,93,108,226,267,186,179,250,104,125,138,56,119,36,44,21,261,30,83,13,101,72,108,79,77,293,15,224,269,262,70,91,171,2,170,266,20,278,22,131,50,11,89,196,37,256,229,94,181,155,136,229,198,272,42,262,254,93,34,270,173,299,55,173,298,174,266,183,12,72,167,208,106,204,143,277,88,285,183,204,152,233,250,63,200,199,293,101,94,128,47,155,58,187,6,122,146,14,264,205,68,59,155,34,271,165,77,268,253,300,113,257,28,64,187,31,94,132,256,75,30,61,42,227,47,177,253,82,283,88,153,184,206,193,111,15,281,169,296,203,113,299,69,196,61,106,130,239,37,99,275,247,44,177,258,78,100,109,156,51,183,227,57,78,293,292,71,275,169,114,286,130,91,148,52,131,196,151,186,28,70,255,34,18,49,112,207,210,48,153,227,293,227,221,284,139,125,157,202,192,136,291,193,58,42,269,23,87,259,14,29,144,111,130,81,123,52,37,146,285,168,188,104,292,294,49,203,197,128,18,14,150,153,100,138,255,21,89,122,39,239,158,207,190,42,177,206,210,215,229,18,224,213,147,170,78,194,297,63,67,108,115,171,56,269,291,36,286,97,184,233,65,33,197,134,165,289,77,65,193,259,219,117,14,8,123,2,129,251,128,112,99,79,128,134,217,50,74,133,165,210,84,246,49,176,238,188,120,279,164,67,287,85,185,78,136,185,162,128,165,211,125,85,166,199,47,180,293,48,69,207,201,226,16,32,23,35,190,241,182,266,196,204,81,242,250,88,279,15,259,278,242,80,244,123,158,260,172,65,274,24,92,226,265,32,56,172,233,219,63,27,232,37,228,78,161,281,202,27,187,120,133,97,199,86,266,126,189,74,52,214,23,294,227,79,172,235,42,242,254,47,283,180,139,117,218,7,252,198,275,199,57,139,207,292,287,5,213,147,189,120,8,78,266,190,294,203,167,184,13,69,244,131,18,180,101,41,252,31,107,149,280,269,23,292,38,54,268,133,24,208,124,235,36,285,124,54,66,21,235,113,282,264,161,40,27,58,298,32,289,221,62,254,6,232,146,59,253,63,190,260,157,193,33,90,284,115,158,15,139,205,190,113,144,279,225,21,285,222,217,30,68,55,276,180,182,61,76,147,110,232,198,67,52,42,229,26,122,248,38,16,187,28,259,243,161,178,21,56,192,187,248,259,146,299,101,72,1,108,182,266,241,42,40,167,293,199,15,130,295,130,67,191,119,125,65,28,45,249,266,152,42,286,277,87,59,271,255,103,239,212,90,214,186,214,121,58,37,115,140,72,119,164,101,92,75,175,66,141,220,298,181,146,233,226,244,179,291,33,227,33,151,83,70,30,109,156,190,207,73,36,287,240,147,219,139,221,273,95,114,226,245,144,84,121,116,269,270,275,252,270,75,44,189,281,122,9,261,12,245,164,186,22,38,300,21,264,84,81,151,275,174,71,62,52,285,243,64,63,186,47,15,191,204,159,238,286,238,266,260,40,34,57,206,82,2,56,220,258,129,195,2,115,190,261,166,113,90,200,106,218,248,68,213,111,245,267,241,129,57,189,50,106,281,285,273,22,214,258,172,256,246,18,239,66,207,90,160,204,245,194,105,28,45,291,186,65,135,47,237,260,191,169,164,51,295,87,19,185,247,13,264,80,261,213,97,226,174,63,225,252,175,184,258,122,230,192,64,106,261,221,106,263,92,147,75,99,263,222,186,297,235,211,153,248,132,191,11,150,185,17,141,62,12,29,144,183,170,182,128,204,68,24,66,103,51,101,201,81,289,92,143,72,269,51,242,175,162,138,40,190,107,95,57,280,271,2,205,179,32,92,245,107,296,112,32,295,40,218,248,195,160,296,182,153,11,269,70,281,18,239,48,132,190,13,214,189,35,104,6,185,217,14,124,236,260,44,278,93,206,6,263,95,6,265,168,175,187,182,208,57,266,64,141,50,20,209,297,298,24,281,41,136,209,70,12,285,109,156,58,264,286,239,110,241,15,76,236,104,17,210,263,237,200,33,108,263,241,115,186,113,278,132,28,209,238,77,211,142,294,108,209,75,267,244,236,188,165,290,176,108,78,189,254,216,18,84,145,59,252,151,233,6,265,86,194,210,208,109,252,27,137,169,34,7,272,178,108,254,80,38,102,21,180,265,183,145,129,102,219,108,2,243,138,120,173,15,41,57,4,253,159,49,39,76,138,198,23,162,237,281,236,266,166,138,50,165,240,138,83,229,240,161,16,92,148,247,285,284,222,67,153,224,168,208,256,20,156,68,121,210,116,32,253,103,47,31,104,275,43,144,241,298,224,27,190,238,126,292,94,243,176,268,149,225,267,222,13,6,153,121,239,243,174,61,140,197,236,77,119,220,99,276,116,102,295,124,282,51,21,256,249,181,42,34,211,226,178,140,285,91,280,28,262,143,261,18,95,65,23,63,290,92,36,281,137,283,276,153,172,232,244,176,57,164,230,217,137,145,290,244,67,131,239,1,176,112,43,273,115,59,223,231,246,61,272,282,23,224,253,214,112,170,123,53,30,180,141,259,60,295,207,180,249,35,257,231,177,298,256,111,277,60,282,253,97,78,71,203,2,215,144,169,2,156,260,163,93,285,149,296,196,227,114,107,218,6,84,73,57,94,35,220,109,250,153,200,171,58,148,25,134,205,34,288,250,45,183,180,176,158,251,277,110,260,213,250,133,151,152,280,241,4,27,20,96,94,231,205,293,173,250,176,43,24,9,156,74,195,215,104,49,217,224,137,51,92,224,143,249,109,191,218,209,142,1,26,71,8,126,178,260,290,296,76,286,139,263,5,9,153,148,193,253,107,47,167,174,98,3,152,249,130,63,275,84,52,78,197,232,51,200,137,280,248,252,63,152,192,12,43,298,263,28,115,159,108,154,216,34,160,1,110,297,187,258,68,12,208,265,94,206,56,263,173,130,85,283,77,251,109,86,264,75,14,151,100,95,28,249,203,92,140,193,19,170,127,60,102,83,241,89,95,238,287,33,80,28,243,27,146,81,232,150,207,270,292,35,114,20,33,108,169,55,5,28,49,157,163,254,148,54,85,17,129,199,86,33,291,288,55,176,3,5,123,147,102,140,35,41,37,14,292,183,138,81,108,22,195,297,16,275,184,180,91,127,136,271,147,182,143,248,270,270,142,43,22,210,251,300,220,228,194,242,43,46,109,269,7,299,137,239,261,171,182,115,163,48,212,194,215,218,115,288,44,275,300,282,63,36,50,148,183,134,258,81,142,143,151,91,279,108,283,145,251,196,17,246,230,187,281,227,205,86,106,59,267,191,146,155,10,48,162,126,103,249,259,273,15,84,223,294,24,299,146,112,175,258,224,2,102,102,178,86,214,158,191,38,90,238,15,182,176,96,248,295,50,215,117,210,257,107,45,106,273,224,206,287,179,204,201,268,295,188,51,254,185,52,177,76,231,54,29,114,248,104,199,69,257,67,4,51,228,36,51,95,182,289,233,214,252,73,156,65,285,248,89,145,211,49,172,299,40,154,161,33,212,264,234,278,29,88,41,180,211,121,96,109,253,34,101,64,287,278,173,142,143,11,226,95,40,219,47,54,141,4,203,1,113,9,162,103,173,291,268,68,77,98,243,10,126,201,129,192,82,237,43,208,13,64,247,261,54,37,111,13,55,294,26,89,11,41,133,49,65,76,234,102,290,93,150,136,174,66,182,16,292,73,260,87,201,243,110,243,238,264,80,61,83,177,230,175,77,132,197,266,139,240,8,18,164,162,271,57,148,84,203,262,298,206,233,155,244,12,274,200,179,195,154,130,96,145,206,213,47,285,65,75,81,134,151,279,83,93,124,273,128,273,209,127,217,178,74,160,159,156,232,147,66,37,181,281,246,246,106,91,74,143,193,208,121,72,160,95,189,299,53,205,126,131,281,202,294,223,287,266,196,16,177,235,99,298,67,73,283,237,193,65,235,133,282,174,118,234,183,210,110,92,109,257,226,255,218,297,248,88,94,169,300,115,223,123,126,106,131,1,181,280,142,84,238,78,221,148,205,142,192,38,116,195,14,234,230,248,244,284,187,214,48,246,200,100,276,182,85,240,125,149,209,28,88,238,59,282,133,70,122,294,217,213,23,262,267,115,271,94,26,19,84,163,97,109,69,201,111,212,120,25,296,6,272,263,40,98,32,52,147,255,233,297,27,233,29,33,294,199,203,26,22,274,163,14,225,85,34,293,194,236,49,81,181,65,115,215,147,45,67,142,280,127,54,14,132,234,108,88,26,249,240,229,16,180,240,58,276,257,137,142,138,153,285,167,286,201,22,130,250,222,175,165,181,222,231,254,194,111,85,182,200,179,229,100,17,79,14,131,105,206,264,210,145,248,136,248,56,296,190,148,243,82,40,60,220,88,81,237,139,46,55,214,277,127,225,30,37,297,37,229,12,25,238,95,289,265,38,141,79,115,232,67,197,121,130,147,217,166,204,232,52,133,199,49,267,59,197,165,142,202,216,110,17,52,270,210,171,133,118,272,47,191,287,202,147,129,38,205,84,280,155,296,115,197,235,204,274,175,146,151,187,282,244,233,14,100,136,277,68,18,216,11,260,163,56,299,172,158,85,88,274,223,152,237,300,242,8,237,299,30,135,201,28,107,285,274,167,181,1,263,18,103,26,52,69,5,263,53,199,184,133,79,110,75,259,49,220,277,88,228,238,114,259,74,299,259,174,231,42,171,208,111,237,149,42,156,156,121,17,5,12,281,217,296,26,29,43,182,201,171,171,200,189,157,296,89,255,265,36,174,27,300,67,127,275,119,42,92,29,162,37,164,119,180,253,14,235,96,18,180,169,243,164,13,147,35,248,142,107,297,9,216,90,124,288,13,218,247,160,234,244,3,88,155,176,110,52,197,217,7,271,85,138,50,34,52,133,43,138,207,189,217,233,7,249,254,216,261,207,120,198,59,108,100,12,177,291,126,114,64,60,165,286,239,46,227,31,32,110,233,244,245,272,276,110,57,174,156,282,230,16,145,79,236,186,35,146,287,195,225,291,103,102,219,166,71,89,150,58,295,212,103,218,124,124,128,23,161,117,253,150,65,225,104,160,37,163,248,25,235,112,2,295,17,179,283,103,205,53,193,292,257,68,77,215,298,256,30,294,220,255,241,25,49,57,68,190,13,162,24,29,236,98,205,256,151,174,76,225,198,269,267,213,294,188,116,98,175,220,293,241,225,235,146,10,292,156,225,287,21,39,255,27,69,249,215,169,117,67,23,298,38,191,108,3,85,80,36,278,96,126,233,151,276,28,207,287,233,151,182,207,273,117,105,150,294,286,183,239,104,165,167,159,53,52,69,198,110,261,52,108,215,225,99,39,25,7,164,55,76,254,103,212,101,111,85,236,200,243,100,212,120,231,292,101,184,38,127,87,20,278,52,27,252,127,174,55,4,95,258,283,292,22,180,176,229,191,167,188,23,31,65,114,51,232,295,2,229,206,297,107,133,288,241,247,291,188,157,147,267,193,265,132,243,144,255,279,45,125,243,217,52,250,283,47,187,244,85,42,95,144,123,191,245,253,115,293,121,212,203,69,237,220,56,97,246,281,256,281,216,3,157,19,162,252,286,290,216,114,163,263,265,261,275,45,50,129,289,166,36,163,261,217,107,1,73,55,41,142,25,277,162,130,65,158,242,127,100,154,78,189,43,284,62,55,177,264,222,66,45,133,286,150,117,256,33,297,30,278,89,53,245,31,146,202,44,254,74,165,37,288,166,127,69,92,104,115,49,219,182,248,232,62,175,226,140,204,154,114,282,110,275,60,36,174,193,12,272,232,299,228,87,142,150,113,199,140,149,3,155,224,93,2,281,170,218,161,83,26,2,175,127,291,295,158,161,88,230,9,18,8,246,40,61,237,226,263,161,72,114,37,56,147,42,48,186,288,158,298,284,193,159,115,211,135,270,153,80,235,56,7,150,62,160,253,233,160,136,216,294,124,62,116,93,77,86,234,67,172,234,84,292,56,291,150,238,41,146,122,260,10,139,122,158,147,258,167,105,151,153,52,148,276,41,43,168,206,43,158,235,287,17,297,259,150,251,90,154,223,10,67,160,212,273,80,6,273,267,214,103,25,293,4,82,113,51,147,198,245,20,132,70,80,109,96,74,73,204,189,207,132,192,285,148,232,125,95,120,27,31,72,168,85,87,101,98,89,186,68,162,268,93,242,99,180,293,140,23,99,175,215,66,189,239,293,133,164,29,50,51,60,149,82,133,27,99,283,93,1,73,274,295,111,170,259,181,258,253,236,169,144,139,142,243,22,195,203,191,96,252,246,275,289,67,22,111,82,140,108,174,153,93,137,213,237,222,175,272,158,143,98,230,128,233,10,252,178,21,141,228,29,299,207,49,118,66,43,150,56,273,106,5,50,60,52,4,54,168,183,89,170,168,14,28,197,269,4,80,198,132,6,60,131,246,141,147,191,147,79,32,36,294,46,32,278,261,42,191,186,240,173,154,152,44,264,161,178,241,235,244,207,78,267,133,232,27,11,246,240,58,197,198,258,70,161,10,149,128,146,38,77,21,223,105,188,241,149,12,215,215,202,238,94,149,43,216,117,138,127,300,216,289,2,9,117,145,178,221,206,200,15,229,284,150,234,165,198,193,223,95,220,284,78,125,92,102,176,101,11,61,18,44,3,166,51,128,61,133,234,270,1,233,266,55,261,134,155,267,76,1,22,69,293,272,53,215,22,42,264,169,21,191,230,245,225,9,163,74,17,131,83,65,228,22,65,36,224,152,209,272,90,4,300,129,164,202,278,141,285,47,40,191,145,102,265,241,188,289,126,297,260,187,277,140,104,251,140,100,98,258,230,61,219,232,153,35,250,46,8,238,289,57,208,230,234,272,58,116,53,174,89,258,14,126,16,90,226,286,242,140,258,37,41,164,112,12,202,235,167,254,126,257,22,50,165,296,55,214,90,51,4,113,285,62,76,234,189,280,243,202,168,222,63,141,21,15,285,211,277,284,16,220,70,180,204,191,5,224,16,259,137,46,234,228,85,218,41,295,27,289,21,38,105,136,183,218,44,242,42,194,133,217,142,154,141,189,130,124,112,159,112,204,171,8,101,161,52,182,91,61,17,103,234,157,173,132,234,12,38,290,230,211,102,46,253,151,154,105,193,139,29,247,178,258,273,33,92,89,168,24,164,170,183,266,269,108,255,159,65,35,10,185,86,193,238,218,292,179,162,187,186,1,99,8,167,51,210,168,213,260,88,104,159,282,77,58,38,180,296,137,84,111,230,105,275,136,264,194,2,30,30,58,13,261,180,97,77,159,41,175,158,183,100,179,204,221,131,259,247,111,175,159,44,138,106,59,226,107,153,276,114,16,48,158,205,111,138,22,226,104,96,291,295,228,56,282,239,61,188,87,175,88,183,201,63,257,18,201,185,71,72,61,173,64,213,73,162,13,241,96,233,119,279,63,80,225,173,55,281,173,283,140,39,230,80,30,35,30,209,105,68,236,89,1,20,98,288,103,51,144,53,234,155,1,241,174,141,214,48,217,253,165,85,72,149,295,262,135,101,137,154,40,212,173,276,193,249,93,24,176,252,130,222,262,89,25,74,2,82,71,123,113,225,129,75,260,293,69,16,265,288,178,237,1,272,133,119,123,73,253,178,112,270,166,222,98,274,40,297,232,25,170,144,144,259,137,99,16,139,87,235,274,288,286,224,247,248,250,160,186,201,13,185,150,76,252,77,159,65,296,230,229,202,287,207,117,116,47,248,221,143,206,280,48,4,116,272,176,279,158,14,287,57,55,32,81,129,208,28,64,131,179,46,51,46,269,237,117,182,80,29,110,75,126,246,209,15,29,213,51,178,246,201,170,94,112,201,177,63,86,31,8,241,17,229,281,137,208,40,196,43,295,254,41,51,268,40,161,18,222,89,298,117,135,111,285,203,107,250,39,9,216,191,180,32,52,269,17,213,8,207,176,133,159,33,163,85,136,229,91,22,57,195,72,231,40,237,168,136,84,282,138,286,178,194,285,87,195,250,268,47,33,207,168,38,291,102,48,97,18,97,201,258,186,239,208,43,82,186,269,203,254,286,175,247,238,2,208,253,83,255,87,178,290,122,278,227,274,96,220,73,206,156,276,205,86,184,166,259,26,195,119,99,182,182,34,127,234,189,8,194,295,151,6,222,148,122,237,30,241,143,77,113,141,3,269,62,182,154,18,62,40,256,73,152,223,98,195,31,23,13,33,184,195,295,221,118,195,136,258,6,64,128,269,203,208,36,271,145,209,24,196,214,260,112,273,37,238,196,13,278,299,47,162,223,98,188,167,15,39,254,223,189,121,267,212,189,198,218,253,238,240,190,16,298,262,116,231,149,41,237,101,150,11,168,128,196,180,154,12,37,201,134,153,82,110,77,272,101,273,155,22,146,297,197,140,294,266,23,99,157,250,195,125,285,132,143,102,102,48,204,136,104,170,266,228,13,231,175,22,95,81,109,38,146,104,95,69,86,97,152,246,153,259,104,242,16,3,162,46,92,161,112,188,45,185,91,110,266,35,270,28,121,48,189,265,84,179,70,157,146,246,267,164,56,180,267,99,104,78,230,99,169,118,88,210,39,271,138,234,15,1,3,75,148,93,189,89,136,256,134,280,34,28,107,34,13,158,96,158,220,68,124,104,49,28,278,111,269,51,160,157,297,299,115,189,172,285,273,174,272,104,173,234,87,250,108,53,159,53,78,72,123,153,70,253,216,16,136,150,154,185,182,281,208,109,232,158,252,192,141,283,102,28,182,280,52,49,143,99,221,170,4,279,55,229,150,128,56,31,47,196,254,298,296,106,243,216,36,184,181,64,272,108,134,164,273,169,198,161,12,287,117,30,232,214,143,198,136,179,147,171,47,222,35,59,177,104,126,43,95,217,171,180,154,203,29,143,275,152,26,103,90,270,218,254,241,142,179,48,160,7,267,69,209,292,171,269,293,167,154,225,214,146,127,91,62,41,4,217,76,231,187,211,113,220,237,284,241,184,288,39,7,262,85,131,26,62,140,222,242,121,254,61,116,19,272,48,38,227,44,2,40,232,95,14,133,265,64,41,37,269,75,65,284,84,17,80,134,278,182,30,79,236,132,222,134,85,265,148,150,231,146,241,64,291,5,215,5,127,135,64,288,115,69,198,231,198,66,288,280,90,24,222,184,298,300,190,24,54,215,46,298,188,44,70,236,23,157,63,17,83,292,209,21,243,230,155,66,88,92,77,77,129,96,298,42,118,195,96,16,214,296,137,18,58,73,187,93,245,154,148,217,233,216,131,210,118,14,115,270,286,162,59,48,172,296,66,42,1,211,84,2,229,68,32,229,35,258,151,193,256,172,185,166,137,118,296,54,119,216,108,41,264,41,148,38,52,142,95,220,91,81,231,30,227,144,223,281,214,280,1,159,199,221,18,285,174,15,11,97,236,82,138,160,86,120,195,225,22,90,51,44,245,205,285,263,111,144,214,34,161,245,50,144,15,153,68,96,149,169,66,265,288,67,21,292,37,38,62,51,66), 217)
22
+ }
23
+
24
+ test("test6") {
25
+ assertEquals(Main.longestSubsequence(242,209,233,88,103,57,229,183,161,50,151,210,244,275,142,265,178,60,247,10,118,158,34,255,253,11,106,263,265,281,88,115,300,141,142,132,47,289,177,101,241,194,98,15,262,164,74,59,175,132,109,48,12,246,215,244,204,153,270,106,147,299,203,88,212,207,247,38,188,223,249,227,125,88,198,187,66,167,42,223,110,249,194,201,223,52,113,7,88,37,292,64,258,110,183,96,36,140,111,63,54,32,146,148,30,197,35,166,214,38,103,24,204,233,90,297,294,123,94,110,240,27,58,95,207,165,48,45,161,131,275,179,28,31,169,125,230,294,215,28,98,98,19,87,56,200,25,260,242,205,274,268,92,153,176,97,3,91,296,150,299,71,236,273,261,106,226,265,183,199,20,111,113,71,241,132,5,188,132,193,179,198,88,105,300,267,291,161,76,177,122,88,234,105,269,28,220,30,13,26,299,185,4,22,13,28,149,120,174,163,23,105,224,8,142,174,191,19,122,233,174,264,3,59,192,63,152,128,42,23,189,77,270,105,48,55,178,199,60,70,104,97,168,39,217,266,77,259,181,86,280,254,244,206,102,290,244,193,15,101,52,80,269,157,26,271,261,227,109,118,288,89,109,139,245,78,91,144,173,120,28,298,18,14,89,118,36,280,258,185,207,242,219,74,89,234,10,195,82,191,7,262,231,22,26,134,298,105,213,107,257,4,74,48,130,80,120,47,249,59,128,129,281,51,297,161,90,297,203,255,56,6,54,161,84,233,38,164,36,130,235,103,208,156,194,233,137,229,75,128,34,127,220,9,11,116,11,176,149,276,133,139,261,242,185,89,42,49,197,275,129,213,185,238,49,232,82,70,82,246,275,277,107,289,200,100,76,43,15,150,263,79,217,196,86,230,86,287,55,262,249,216,106,130,55,288,216,233,88,219,155,154,172,16,291,159,196,200,169,111,31,118,237,31,38,64,258,148,52,28,166,283,125,104,252,174,203,128,49,223,56,214,207,183,122,231,216,142,274,261,10,224,81,139,300,186,201,153,77,26,241,190,103,282,280,93,8,250,59,260,45,7,279,209,125,113,255,130,35,256,280,267,75,243,267,297,154,168,98,277,244,85,175,244,82,225,5,187,203,242,36,63,118,64,21,209,36,259,13,226,39,260,230,131,150,160,209,290,91,83,102,279,33,139,35,216,31,79,280,216,152,169,224,72,292,66,157,79,35,61,299,67,152,125,286,145,3,220,36,88,19,98,59,223,298,274,41,104,197,178,20,293,289,4,215,100,203,39,249,269,209,46,225,262,184,259,17,126,159,57,1,196,4,195,255,222,248,3,158,8,196,40,37,114,241,40,176,198,29,169,171,238,46,5,164,31,151,267,102,129,43,277,62,182,79,14,269,168,280,115,273,162,208,169,15,160,58,13,5,83,99,92,250,9,39,3,187,14,196,156,261,134,147,162,30,67,260,135,209,49,248,94,205,171,147,240,169,230,232,82,105,18,195,187,190,75,234,46,211,110,299,25,141,150,111,256,270,80,63,18,83,247,16,195,37,220,297,279,228,234,139,43,33,51,258,151,140,145,161,136,122,280,248,213,206,197,224,277,199,38,164,22,246,71,2,176,100,62,223,163,65,30,88,118,200,18,51,65,253,232,300,23,123,277,250,155,242,193,197,95,197,140,27,171,68,292,78,43,76,146,139,164,272,219,155,1,130,25,176,173,140,228,184,146,282,69,132,20,225,57,51,18,193,109,40,157,69,23,50,288,237,172,274,64,90,285,294,250,299,12,257,164,244,187,201,199,272,222,156,56,74,226,176,62,203,241,76,177,189,201,206,153,264,201,7,32,221,44,97,159,150,82,48,133,79,299,20,179,23,219,285,165,252,261,54,177,60,75,186,298,74,186,161,101,274,66,52,227,42,46,164,199,140,64,7,98,90,54,20,273,264,260,62,71,26,34,122,97,162,192,183,85,6,105,57,56,267,43,206,83,188,100,7,218,220,232,257,40,20,96,177,88,105,56,101,182,192,10,120,105,31,15,95,89,72,176,101,170,250,165,223,241,37,246,8,15,95,22,61,246,66,89,154,272,294,243,204,176,113,296,299,59,165,51,51,22,182,289,109,45,49,97,34,167,44,162,151,215,155,250,69,30,246,242,280,76,26,136,240,82,206,30,197,4,70,287,125,237,240,2,31,261,195,223,80,14,215,262,65,247,222,208,193,208,32,102,67,285,45,139,214,285,280,71,207,167,92,162,38,228,214,10,101,205,214,44,150,123,135,195,112,258,270,199,213,17,221,19,66,112,13,206,25,297,41,83,277,274,239,293,39,9,252,56,22,244,223,271,43,40,163,300,176,234,297,41,88,7,123,164,81,250,165,52,210,151,227,162,289,77,216,73,97,51,81,170,12,241,255,230,295,45,115,132,38,98,125,213,96,61,46,46,296,270,270,91,24,150,77,125,212,237,46,83,227,184,273,37,186,199,95,188,110,283,140,5,273,232,215,132,289,246,92,264,176,252,97,218,55,53,279,255,204,9,88,251,166,290,10,45,13,290,36,246,298,262,108,105,299,51,136,277,268,146,181,123,237,71,295,269,2,107,253,191,42,87,69,96,63,162,20,166,144,223,38,7,143,12,25,181,59,121,103,120,87,123,200,14,54,246,227,155,224,284,35,238,52,63,48,234,175,4,247,227,297,279,113,167,150,92,297,241,158,35,38,220,128,168,169,84,293,92,262,186,175,4,207,82,75,184,202,285,235,219,224,231,92,288,17,43,151,295,146,178,209,93,276,83,148,252,216,278,176,4,247,293,290,295,95,200,102,232,68,213,190,142,242,28,222,33,73,262,5,23,222,258,175,104,115,270,56,271,36,89,44,96,107,111,3,147,125,201,45,197,204,160,212,235,90,283,224,7,153,216,222,37,283,130,161,224,296,60,150,235,113,130,148,211,69,266,48,115,30,291,136,153,233,112,297,57,7,166,92,229,281,85,298,6,217,98,98,217,131,70,166,46,284,31,151,111,24,281,137,221,79,232,10,182,157,82,116,46,53,123,250,265,124,70,291,241,292,200,25,124,276,73,1,269,34,229,109,281,222,233,207,77,227,123,226,194,31,46,281,277,222,1,73,87,48,21,268,24,38,186,160,203,222,216,21,164,117,96,185,198,252,138,280,10,298,106,232,267,157,137,181,30,21,90,114,155,175,142,287,47,292,294,196,82,181,196,69,43,179,44,247,212,287,217,77,262,54,116,221,259,259,24,201,90,131,84,251,248,188,39,288,133,272,209,219,87,36,43,150,94,185,90,196,47,191,75,155,179,271,67,275,91,43,242,31,235,260,225,192,179,235,82,2,125,16,143,184,106,170,43,193,183,224,268,102,45,36,48,283,157,181,271,260,174,118,246,90,1,295,249,63,292,272,175,19,77,120,56,223,294,66,176,130,120,236,131,132,219,81,122,197,260,134,46,220,249,134,124,201,134,291,79,164,168,82,145,197,256,16,132,78,53,241,3,212,19,33,260,245,168,34,113,62,241,34,197,3,149,242,287,208,123,194,97,4,298,86,84,49,171,249,163,282,69,61,179,238,124,115,73,233,161,213,288,131,90,243,250,27,7,120,120,192,84,18,9,99,115,95,221,245,262,57,207,119,82,56,37,16,136,94,254,5,260,33,228,183,130,293,11,48,113,38,211,30,22,114,142,142,278,293,24,244,90,171,297,108,161,159,147,272,14,157,36,198,202,298,19,218,37,231,74,140,276,217,199,280,137,78,15,64,245,147,16,59,288,25,64,123,34,170,103,172,45,114,50,290,86,50,276,35,69,134,91,204,198,281,39,88,22,276,296,287,53,139,49,151,163,234,207,189,148,28,263,132,294,90,205,26,227,65,64,65,48,192,230,86,71,297,74,105,284,174,246,255,171,128,89,31,149,179,185,235,198,62,179,57,62,205,144,92,210,295,284,61,246,179,18,30,237,161,22,146,18,25,148,292,294,238,26,261,181,187,294,16,212,260,24,210,225,142,47,265,189,165,154,218,228,262,287,239,79,122,196,1,133,118,246,171,172,192,82,54,189,18,197,284,151,38,91,102,79,88,78,72,44,230,88,170,146,109,105,240,136,263,95,17,199,69,80,31,158,149,8,246,210,266,131,298,95,1,177,279,196,83,268,293,190,248,46,186,237,279,194,233,25,166,120,154,171,89,172,45,172,12,177,191,218,71,223,233,262,82,140,162,188,28,188,195,68,222,61,74,80,150,69,271,66,219,255,197,66,209,294,54,36,148,15,206,44,265,171,103,31,115,239,233,118,174,252,192,184,136,285,122,235,291,155,198,40,269,99,142,223,242,143,190,224,225,172,268,41,54,123,30,248,138,225,171,79,253,217,28,192,130,216,210,57,284,201,225,3,177,129,208,103,43,17,57,11,297,158,47,223,72,297,38,153,46,187,124,95,3,170,159,256,43,150,245,48,84,58,148,223,235,201,254,205,15,105,21,167,297,219,125,126,274,91,144,195,104,14,188,224,38,115,138,134,112,286,244,195,29,208,83,57,8,15,69,257,42,190,170,149,189,40,265,254,252,131,224,219,163,29,275,274,45,198,59,213,239,114,206,115,221,157,258,41,106,133,193,247,291,173,229,7,159,195,241,200,255,158,195,221,175,19,271,130,124,243,29,43,58,256,202,205,22,90,274,284,135,158,155,267,235,119,272,60,260,284,132,17,62,177,51,214,125,261,126,226,60,279,294,13,37,202,257,296,183,190,225,118,54,197,299,12,1,127,59,114,65,222,203,10,105,60,66,198,218,278,146,297,223,278,218,148,38,178,270,68,22,243,93,173,226,32,119,49,201,162,89,60,46,58,123,231,10,19,134,125,92,22,75,26,121,41,247,138,63,270,101,166,264,75,91,278,228,163,183,47,13,86,227,223,224,170,124,235,214,10,126,137,237,188,175,233,1,229,206,299,279,138,128,154,131,168,13,115,119,285,216,238,263,32,202,300,280,81,248,224,286,96,150,114,185,276,132,92,275,8,205,166,203,201,105,4,118,282,44,147,27,162,259,186,73,170,75,82,151,271,281,140,133,258,48,56,1,241,181,7,202,45,56,197,142,112,110,22,84,269,226,13,28,209,7,15,168,153,128,41,240,104,193,88,300,44,287,217,245,107,8,95,129,29,277,16,46,80,274,156,72,195,168,262,189,38,129,96,47,295,129,16,180,34,73,235,147,55,244,223,259,147,56,25,298,217,4,128,236,105,266,31,105,108,47,155,201,195,82,10,235,60,149,180,51,18,94,19,266,190,241,296,83,180,39,46,262,202,197,6,54,54,83,235,107,213,54,297,9,42,298,189,59,64,276,155,277,264,1,124,191,273,29,136,126,180,287,43,236,110,103,154,29,30,285,259,292,274,186,148,193,290,192,192,81,87,298,175,48,229,150,285,285,152,263,28,252,143,68,293,231,77,107,280,141,6,174,156,184,158,266,142,293,246,300,68,246,274,138,189,64,136,224,277,133,89,294,258,82,14,191,153,275,202,76,269,83,39,192,90,70,178,180,185,21,261,299,118,152,289,178,181,256,55,217,31,118,138,219,38,300,106,107,166,297,107,165,151,110,110,92,147,85,218,210,74,211,89,142,120,25,203,1,270,108,203,197,113,67,235,62,109,126,124,270,72,145,56,50,78,172,281,174,139,30,179,72,184,28,273,191,62,235,42,225,91,185,146,111,129,249,297,79,74,265,50,55,61,92,65,268,14,188,267,217,89,117,148,71,90,95,245,19,144,221,9,158,18,151,74,167,25,21,204,264,272,17,141,206,88,250,111,6,107,101,29,181,38,66,264,98,162,203,206,70,39,68,88,258,253,85,213,27,241,130,37,154,116,228,113,131,12,56,250,300,168,103,162,93,5,17,16,57,40,37,188,109,197,248,259,238,37,166,191,162,225,162,226,167,169,226,118,139,159,284,28,233,269,31,100,33,22,192,60,252,246,94,269,110,134,96,188,219,212,11,132,127,87,93,230,292,74,257,43,277,50,66,290,72,90,180,55,67,113,160,14,196,117,211,58,1,177,159,48,267,118,27,49,125,174,145,208,125,295,104,252,191,253,188,274,133,248,110,8,13,239,87,55,244,28,270,164,122,77,157,66,219,145,40,204,119,168,206,209,97,221,10,9,68,163,281,105,201,26,69,269,296,266,279,226,86,207,199,71,87,296,65,190,25,215,10,170,78,90,173,103,263,281,187,205,23,299,139,73,267,149,42,220,198,95,290,160,174,219,126,187,281,180,245,65,234,265,103,127,130,44,128,39,138,163,128,209,263,233,40,10,289,48,159,298,193,13,296,242,249,159,300,250,34,149,106,49,272,61,49,15,118,277,216,290,113,263,139,297,242,230,112,290,54,16,184,33,153,299,191,146,298,269,294,220,15,86,70,18,293,234,251,211,243,138,9,140,86,172,19,283,164,61,173,163,250,190,52,35,297,4,204,34,29,201,126,199,117,52,20,211,52,69,269,136,232,88,119,260,168,160,194,174,296,54,34,229,244,60,165,257,223,92,96,173,75,70,198,137,77,198,271,179,178,132,223,205,160,125,248,4,109,284,263,196,74,280,6,9,47,230,205,210,146,77,65,20,65,239,17,279,10,191,23,295,278,21,278,299,191,173,59,250,39,208,253,6,88,292,285,164,273,160,246,123,294,90,73,104,233,5,60,290,253,58,248,58,154,172,149,148,278,4,28,77,3,34,74,5,277,16,127,190,32,53,173,266,2,151,209,251,259,34,147,213,267,133,116,194,16,165,97,239,221,264,26,57,159,100,281,197,6,7,95,124,178,24,96,65,216,174,232,202,235,145,228,158,251,186,233,4,236,50,212,205,65,10,76,211,22,125,144,146,158,244,3,43,147,269,139,237,224,263,17,137,159,279,41,227,26,114,201,52,220,107,221,186,43,76,11,94,9,176,236,46,176,102,131,60,100,66,162,135,192,251,94,204,27,288,175,257,168,230,139,222,117,96,291,217,16,113,239,270,22,293,27,30,260,115,85,127,289,169,103,230,68,286,109,194,67,260,267,60,239,221,229,136,25,270,167,164,258,141,266,284,89,217,270,294,294,120,273,263,181,245,256,4,215,169,141,6,225,212,110,87,263,176,235,276,80,82,290,42,13,246,266,181,253,14,194,186,66,299,13,12,56,259,189,296,169,216,173,8,190,215,106,41,42,251,223,298,278,209,166,245,213,139,278,173,33,24,180,178,194,258,280,253,102,298,155,68,300,177,259,218,240,197,252,241,107,37,206,268,135,238,15,118,238,15,145,120,139,221,37,192,83,164,189,275,280,154,89,191,40,63,9,6,15,117,7,192,152,209,131,222,199,84,182,186,253,187,126,131,252,156,227,82,199,109,118,299,262,38,160,294,288,70,192,80,258,160,206,219,76,163,174,63,254,65,24,103,290,112,20,225,103,23,127,105,69,300,84,200,300,125,199,1,204,225,185,59,70,63,268,268,185,34,76,287,182,41,242,78,171,175,226,55,136,225,292,2,132,151,224,232,126,86,97,295,56,130,86,283,253,150,264,266,212,28,211,251,50,64,23,66,98,95,22,117,37,64,95,293,8,31,156,119,206,188,212,95,244,49,176,113,241,128,291,152,255,88,76,250,216,194,10,264,193,125,240,89,140,190,191,214,32,203,157,24,7,70,102,129,78,32,48,32,59,53,270,166,80,210,293,22,224,177,8,20,141,276,219,184,72,166,290,220,261,187,86,155,123,158,134,251,95,58,178,62,132,80,122,289,273,179,143,219,10,207,59,152,2,41,14,50,290,232,296,9,267,236,33,181,184,283,298,248,154,271,237,163,214,108,299,111,256,5,159,265,155,247,47,271,226,284,145,226,1,125,255,70,212,233,5,80,155,14,160,289,261,174,182,122,19,237,45,247,23,52,149,245,162,79,82,230,185,226,160,129,30,232,44,76,259,144,35,154,109,16,157,222,164,66,293,220,251,5,275,226,190,106,4,99,147,79,233,133,116,269,198,236,150,20,156,5,9,280,259,101,150,38,120,168,44,274,152,106,94,130,68,274,243,10,195,138,213,9,172,252,144,278,149,292,180,187,138,109,249,1,102,184,143,223,133,187,162,95,268,176,244,90,93,15,15,4,195,117,229,82,72,30,214,215,252,218,218,234,9,27,14,148,177,15,9,35,197,273,73,287,110,124,235,205,94,74,112,208,268,204,18,89,167,117,132,28,232,28,291,55,215,204,176,173,42,241,214,201,61,257,201,236,269,44,21,36,135,243,244,111,142,88,148,232,52,65,51,164,155,38,256,78,247,215,102,206,218,70,222,14,268,248,259,229,11,133,140,259,149,62,19,128,88,162,141,89,123,22,51,208,6,6,210,52,107,205,131,24,181,44,89,271,103,241,132,190,293,121,153,12,27,233,250,156,131,73,248,45,172,247,243,58,271,165,159,30,244,274,124,280,14,128,93,280,48,251,106,298,206,70,101,165,8,112,272,41,273,27,95,233,51,261,80,22,296,93,144,209,197,87,110,199,298,253,59,17,217,271,117,124,290,164,172,29,190,184,137,254,244,167,15,45,82,22,94,49,53,207,228,77,41,214,54,127,281,249,201,209,227,101,233,107,149,95,278,236,194,124,269,116,273,285,37,142,197,151,283,70,210,62,13,37,115,21,118,54,1,119,160,221,185,119,150,49,143,230,96,225,66,103,63,262,133,78,268,173,88,205,103,172,23,287,145,256,254,76,283,227,186,187,203,7,220,131,209,200,51,16,52,170,167,153,128,175,183,98,203,296,181,111,195,237,127,90,4,285,89,101,290,259,235,265,258,40,286,102,249,40,147,229,15,292,232,229,244,235,248,105,240,143,123,102,251,73,114,253,181,3,103,56,53,229,5,274,118,231,109,178,216,251,28,202,62,215,96,180,180,178,208,174,286,30,190,298,232,20,133,223,178,228,127,82,218,72,222,20,226,92,36,140,157,29,107,157,5,88,170,231,48,260,282,88,66,254,198,46,84,137,111,158,170,281,172,122,9,279,243,96,164,41,201,188,91,212,268,264,295,81,210,166,238,198,54,82,299,238,15,216,98,282,45,288,142,41,226,96,110,192,169,148,109,163,108,223,163,296,215,113,296,2,221,191,299,85,160,227,103,214,257,58,57,123,38,101,131,121,43,277,195,196,184,69,155,186,150,73,276,225,205,41,100,18,277,257,213,133,35,194,230,64,41,148,164,232,144,207,65,33,259,131,126,163,108,173,90,70,273,187,139,105,18,64,213,86,21,77,235,151,179,278,143,150,97,278,271,124,280,279,212,261,199,98,169,42,245,53,219,175,50,148,87,15,129,175,258,247,131,151,294,278,258,188,222,236,86,8,250,268,193,219,267,282,149,219,89,88,209,63,47,143,203,108,25,173,170,129,172,210,113,21,247,72,263,71,191,164,291,171,276,143,85,44,254,95,208,117,244,163,44,252,146,136,257,111,28,94,137,229,159,159,56,78,13,117,117,237,77,216,51,93,15,93,192,106,210,131,218,26,39,8,172,216,51,9,81,264,33,70,183,195,97,98,253,270,175,60,74,5,5,221,117,142,297,33,194,158,129,200,131,130,240,103,156,294,37,136,165,261,14,231,240,138,222,38,233,201,278,128,232,63,282,282,238,208,181,110,225,215,167,2,266,82,73,12,140,154,233,152,297,204,242,171,142,83,251,103,73,64,230,240,67,168,212,152,102,94,9,265,165,95,141,280,96,114,28,73,280,73,25,278,209,168,137,78,162,136,110,265,28,28,9,83,102,119,270,172,161,43,9,3,104,59,141,10,179,143,159,159,61,246,258,103,94,190,34,225,18,227,88,126,124,50,62,145,4,28,44,121,78,283,270,255,27,38,170,67,151,299,114,270,120,194,188,128,197,25,45,210,128,77,154,286,106,200,187,122,164,211,267,138,177,243,78,132,32,136,6,108,144,214,48,160,297,155,184,155,269,107,197,54,239,103,60,143,63,264,246,233,32,261,129,136,19,49,155,238,34,19,39,292,166,231,288,190,154,20,116,11,223,236,119,217,107,92,294,163,36,158,39,103,131,273,6,98,99,131,75,170,31,210,128,36,291,234,190,276,82,138,61,263,207,214,174,152,99,39,178,284,3,156,276,178,215,195,218,264,160,279,128,39,79,122,258,159,59,107,104,230,159,208,184,267,139,278,251,175,240,232,227,192,174,152,13,217,8,98,291,223,248,235,150,71,279,86,249,51,37,211,174,145,86,60,271,180,199,143,300,180,32,162,87,172,178,27,295,234,268,140,294,251,179,235,142,30,182,247,274,16,201,216,255,75,235,2,263,221,45,19,179,244,252,124,298,77,16,123,224,158,199,126,270,53,43,285,87,59,246,206,150,193,124,197,247,104,300,133,280,203,92,247,203,157,115,227,52,224,290,125,262,39,122,102,241,156,44,90,175,71,277,24,217,28,177,185,252,75,34,207,21,178,243,295,147,170,194,185,239,294,238,4,217,68,213,142,84,183,247,136,190,203,162,252,287,232,248,285,69,266,14,145,212,287,51,103,134,167,74,86,58,236,51,202,300,174,146,156,299,183,260,46,206,233,152,211,188,245,29,253,200,66,105,105,66,241,119,216,129,237,201,48,63,146,175,80,193,133,61,181,39,41,13,18,257,226,200,75,222,85,164,152,180,76,262,196,135,239,156,249,72,52,52,119,2,153,42,131,221,228,257,11,127,211,286,274,129,105,209,174,28,140,259,150,250,234,236,277,110,152,61,214,160,270,56,122,82,270,53,251,203,148,57,137,116,232,21,36,93,92,205,126,185,213,241,91,60,111,250,15,34,58,298,100,266,77,220,87,292,37,110,12,293,105,238,286,290,226,196,7,123,187,189,122,233,223,226,77,70,71,282,70,84,137,154,158,198,9,114,24,143,244,142,31,100,139,189,215,273,110,7,50,53,99,21,203,163,210,12,152,230,38,285,267,50,18,217,266,221,109,187,52,149,128,92,71,179,204,127,106,76,285,241,157,227,96,18,80,276,158,6,231,77,253,162,297,124,195,209,44,149,14,278,282,72,18,163,280,243,130,200,119,228,33,287,36,211,250,171,197,138,188,11,166,151,173,294,220,89,101,88,21,207,72,136,32,230,108,88,204,266,84,71,281,245,1,29,30,76,30,160,117,184,121,69,143,91,70,60,286,195,15,293,214,82,125,107,152,33,252,247,173,18,97,154,103,299,76,47,139,240,237,1,253,154,154,156,43,201,279,226,129,8,131,52,103,146,88,169,44,19,99,226,25,162,141,282,215,240,120,299,194,62,16,266,91,6,49,145,173,182,96,263,181,141,139,54,40,22,53,277,113,164,6,300,197,178,272,23,113,274,109,26,80,275,225,224,256,138,250,277,89,148,206,196,144,38,62,289,36,70,219,153,123,197,34,214,168,67,1,136,161,142,67,95,150,76,147,8,86,42,165,99,263,136,288,88,131,206,6,153,133,255,16,60,227,28,139,265,289,71,244,108,141,241,266,56,300,228,51,287,205,59,131,117,110,228,143,292,110,25,3,140,186,21,162,178,259,177,79,8,36,166,256,139,285,215,110,149,102,133,4,131,282,270,273,177,236,13,1,177,8,209,86,118,121,73,20,121,104,242,161,12,111,261,3,137,69,115,61,39,3,77,80,146,114,254,231,193,215,284,60,7,52,160,175,274,129,132,47,192,179,194,166,298,211,137,203,53,158,277,133,128,94,250,99,53,162,226,114,158,98,83,167,157,24,101,228,232,188,251,56,132,34,132,106,51,4,226,48,132,300,231,224,223,125,151,165,273,177,269,252,198,286,266,35,26,227,239,294,99,238,56,141,170,105,40,178,99,228,22,255,166,140,250,245,196,174,299,163,218,74,242,270,98,181,200,44,17,127,148,192,145,126,210,243,172,197,104,222,211,297,293,154,124,38,245,295,274,216,147,8,78,176,31,144,13,139,146,239,240,290,170,45,115,93,56,91,2,143,238,276,50,23,284,249,45,159,279), 203)
26
+ }
27
+
28
+ test("test7") {
29
+ assertEquals(Main.longestSubsequence(155,248,30,64,261,289,93,159,172,133,191,12,169,281,138,257,153,97,124,169,3,169,111,57,86,155,100,226,247,163,45,197,185,248,237,33,115,72,130,62,54,30,244,252,240,14,175,171,174,124,29,197,85,19,113,139,115,49,266,42,297,247,217,283,146,290,51,262,214,119,289,166,137,300,196,218,64,246,72,296,264,20,78,87,32,90,135,233,243,287,8,290,177,230,28,157,60,187,62,190,268,182,184,26,232,213,213,16,245,238,231,193,6,221,100,126,209,145,176,199,147,187,70,97,97,263,244,295,176,47,247,190,38,59,242,98,17,180,186,148,205,178,136,158,192,90,68,257,236,241,221,194,288,17,169,161,274,27,69,169,81,229,109,230,203,63,109,268,167,23,183,274,155,212,265,280,142,94,9,250,292,119,126,86,201,108,237,47,230,73,127,250,36,54,191,147,136,86,72,277,171,272,14,154,43,239,220,136,258,114,71,244,47,81,223,34,119,37,16,104,49,47,255,257,177,116,62,118,281,257,167,89,169,208,60,174,291,35,179,189,266,256,145,129,193,87,96,101,103,109,83,265,209,193,42,267,214,287,124,212,122,130,271,106,64,82,66,14,61,143,129,41,101,110,112,108,166,200,136,231,211,291,116,241,78,71,226,12,138,194,34,281,273,180,153,104,141,4,8,198,153,50,257,111,75,174,45,4,6,260,259,266,175,5,90,279,265,266,50,144,284,81,289,293,94,32,193,264,289,90,261,31,81,144,189,48,297,26,261,44,225,102,286,95,185,199,191,11,82,285,300,126,179,259,88,147,260,120,241,99,145,272,114,85,222,126,195,142,279,256,282,233,98,295,298,237,115,253,200,79,25,226,139,228,241,166,175,266,97,10,248,281,137,298,91,57,251,104,81,143,290,131,121,23,131,214,39,38,170,186,72,8,191,35,219,163,121,280,293,47,110,130,152,87,53,278,257,167,229,272,88,26,47,292,293,72,235,278,216,170,114,297,194,236,117,181,260,60,77,178,66,196,225,277,68,196,21,101,270,14,69,266,46,181,66,199,155,271,254,192,1,52,157,135,83,238,222,134,275,53,152,257,99,72,33,185,8,280,74,71,68,298,231,295,5,68,221,21,34,261,28,12,24,13,137,203,14,41,235,108,285,289,296,258,293,296,71,185,171,207,120,147,160,238,99,102,31,269,266,178,100,50,283,164,28,273,299,84,227,201,292,293,195,247,53,215,188,208,125,266,203,282,83,228,223,12,108,183,59,182,62,46,56,293,225,235,152,94,285,153,143,56,247,202,225,168,65,134,292,282,64,265,177,102,120,19,284,177,126,151,30,102,128,97,197,251,107,148,60,21,234,87,173,166,16,259,227,54,105,254,202,241,50,257,117,289,142,90,11,157,264,82,263,263,125,250,198,290,285,203,119,29,275,164,245,258,244,49,104,268,44,89,1,50,41,118,284,30,134,80,15,182,20,33,51,115,300,220,32,250,257,263,22,229,59,11,255,91,50,147,252,142,215,239,131,112,220,45,94,78,275,183,165,104,148,269,230,177,187,289,120,57,277,87,92,64,177,210,177,218,72,194,299,204,80,255,234,59,277,262,118,184,284,212,93,104,157,61,159,72,216,96,168,295,107,231,157,121,41,177,282,3,104,282,176,171,80,138,128,294,268,222,137,79,6,26,101,216,146,115,101,129,146,272,280,67,117,67,62,167,257,149,141,131,240,100,109,65,67,262,18,77,164,131,263,276,61,87,131,83,116,180,86,83,179,47,44,73,3,72,253,216,97,166,23,232,238,257,179,232,297,66,167,29,103,297,157,129,93,147,142,40,79,47,77,73,169,67,149,239,298,94,282,99,173,218,290,106,154,58,241,219,17,160,267,104,63,120,294,67,153,50,54,256,147,264,226,191,66,98,67,284,54,32,191,196,242,54,213,126,252,176,69,16,291,114,94,4,105,160,251,2,161,132,186,291,159,276,87,261,219,194,91,206,271,282,19,58,27,207,90,38,101,100,43,204,146,31,186,40,11,170,43,176,34,75,139,135,82,212,225,188,33,241,179,210,277,6,195,283,139,111,214,61,21,176,65,16,209,77,112,201,159,103,36,181,127,261,1,174,118,189,108,2,134,129,128,117,46,286,37,219,167,164,95,162,2,151,216,162,83,228,160,254,55,19,4,21,23,208,144,179,147,276,41,147,32,153,206,281,261,202,97,71,286,283,80,27,255,76,300,200,159,95,281,185,62,124,81,168,233,22,25,135,252,81,35,73,195,119,36,84,274,111,203,214,36,273,239,30,72,214,25,5,33,86,63,166,201,106,270,52,72,255,149,298,281,272,186,149,162,60,143,152,289,279,231,18,145,35,175,149,195,49,92,150,103,161,144,29,289,219,107,276,206,233,263,189,216,129,273,189,84,231,56,148,224,84,17,21,104,136,198,63,279,166,170,18,120,95,246,114,128,224,223,90,26,72,260,64,129,247,150,76,230,160,70,19,217,78,296,191,132,111,215,56,21,43,170,189,62,254,294,229,244,200,12,95,209,8,192,220,250,53,120,250,151,291,172,282,296,97,197,212,26,145,80,290,183,204,294,85,89,136,246,280,59,191,65,32,163,85,224,244,198,275,63,1,122,107,102,55,92,142,104,114,16,138,217,215,225,278,31,226,190,161,211,53,164,185,139,2,178,299,167,132,294,141,170,221,205,272,283,9,242,114,182,159,231,86,106,167,16,88,254,8,158,125,295,85,224,247,240,162,226,169,233,144,80,123,98,64,193,128,151,78,125,160,179,254,24,265,114,259,280,76,142,39,62,33,231,99,221,181,194,98,90,136,124,84,13,223,257,228,135,97,82,227,127,51,5,23,139,10,68,11,58,294,221,203,15,232,237,27,222,103,204,200,132,79,264,77,204,239,220,4,164,122,206,143,101,77,236,278,14,50,34,235,45,277,38,76,288,174,46,227,271,140,94,276,171,69,106,177,124,216,67,267,276,27,182,265,257,133,51,145,236,150,74,184,74,52,109,252,28,179,70,297,128,220,3,121,76,53,124,89,51,118,39,174,217,63,140,165,170,65,34,235,190,290,283,296,119,211,117,161,153,180,283,286,111,203,52,168,228,68,123,207,280,79,49,66,17,115,284,183,90,101,93,282,95,60,184,296,280,1,292,111,30,127,192,263,223,48,170,77,273,108,139,117,180,196,206,139,171,211,26,84,123,229,298,19,64,2,130,133,21,136,165,178,264,193,229,193,58,256,190,114,283,13,40,267,189,29,133,49,44,185,254,8,71,12,202,92,33,219,138,17,32,130,197,121,59,67,175,246,274,22,76,155,202,246,149,183,273,289,239,234,208,284,245,194,122,97,68,114,176,28,99,178,56,25,110,214,292,248,160,70,58,176,258,6,159,196,248,252,80,182,168,134,246,127,209,271,42,91,192,298,182,57,214,120,77,24,113,241,206,258,107,24,240,158,13,21,296,212,101,284,173,260,60,55,184,187,32,45,112,237,140,246,255,265,266,89,29,271,99,77,50,195,155,261,22,198,152,172,184,159,87,294,130,225,264,96,42,250,286,215,291,186,14,195,277,71,150,252,266,193,276,96,284,224,120,162,214,259,41,24,231,193,99,244,64,117,158,55,244,69,103,188,67,49,205,158,206,179,175,37,229,287,237,237,123,91,250,127,35,242,57,128,256,128,106,53,42,77,82,32,128,176,282,169,237,213,287,125,165,94,155,179,19,4,59,214,25,99,27,217,216,231,99,293,208,20,252,292,279,19,58,21,181,260,53,136,147,300,171,187,174,2,168,103,287,300,146,231,21,257,248,215,29,134,158,118,278,293,280,24,147,221,78,277,81,62,234,133,234,151,144,246,130,24,270,88,209,149,220,162,53,63,46,85,20,206,91,210,169,225,204,5,33,163,201,222,285,248,111,116,37,297,287,25,11,300,6,70,253,265,1,132,2,55,136,44,29,228,222,183,200,159,279,293,169,122,8,160,282,283,281,288,178,19,160,22,106,133,217,263,161,172,146,288,274,169,81,34,284,72,140,30,4,247,270,15,43,98,194,212,216,261,131,166,103,169,32,143,97,141,211,247,97,53,177,35,92,95,118,14,180,57,283,44,18,75,155,115,190,163,244,117,203,57,49,91,14,274,128,202,31,86,181,32,96,201,174,290,115,3,89,14,231,167,39,146,101,270,280,85,93,203,143,95,72,244,176,236,156,93,129,284,188,269,98,40,265,185,190,243,201,133,94,113,206,158,50,182,64,157,119,18,73,143,280,174,13,226,37,112,53,260,222,266,297,158,229,277,170,131,3,134,148,182,132,56,175,164,91,282,108,69,40,131,248,74,152,87,102,57,113,230,41,224,111,136,165,15,192,120,205,145,103,138,193,235,262,28,289,22,184,24,16,122,31,236,16,192,299,9,106,20,64,230,298,273,4,17,112,173,29,25,208,157,125,205,24,213,284,95,241,264,155,32,80,149,284,293,159,129,94,250,137,207,82,116,248,111,98,212,118,48,145,152,67,258,115,295,75,1,272,103,89,225,192,73,182,90,57,145,84,207,90,94,288,234,124,129,18,126,283,284,7,185,119,244,118,137,205,197,204,95,8,201,205,43,289,207,296,124,275,54,120,67,178,96,163,41,221,8,196,172,92,105,179,106,278,41,147,147,262,211,294,219,293,121,107,205,95,81,197,277,71,252,167,178,95,167,125,37,186,141,112,197,18,47,219,52,225,197,18,115,142,275,93,264,235,283,244,39,78,145,232,108,297,107,264,104,2,61,253,291,168,53,56,275,126,76,226,236,72,158,204,294,123,288,94,134,290,26,255,112,243,219,190,68,240,55,106,87,131,236,277,74,150,131,94,276,149,227,219,130,81,192,29,215,51,94,262,62,225,23,16,190,41,257,88,220,103,245,42,65,254,2,63,162,69,293,218,224,85,169,57,56,234,111,20,167,86,256,272,83,170,233,53,261,89,294,57,137,68,213,280,117,267,49,180,147,183,201,17,51,137,163,294,258,265,203,238,253,238,79,202,122,229,233,67,79,206,223,252,36,151,39,210,97,120,186,67,296,128,283,219,25,100,85,205,9,234,297,124,208,196,130,27,115,293,296,88,106,26,8,148,197,30,279,32,22,137,75,145,34,66,151,159,266,237,92,115,216,13,33,298,111,136,85,222,189,110,125,290,84,262,36,62,220,150,24,271,212,148,240,295,175,157,89,198,33,288,185,59,265,238,79,146,105,91,60,127,213,289,134,28,92,211,169,129,220,299,296,218,270,230,163,47,17,21,205,165,37,167,180,119,232,181,265,2,30,218,183,84,209,191,196,61,263,138,204,145,293,32,115,193,23,193,206,72,268,182,66,158,20,71,222,296,231,108,245,218,230,119,209,249,13,241,18,260,63,7,29,95,216,106,29,211,33,99,181,60,259,208,98,93,189,71,286,235,297,234,269,66,176,39,173,147,11,216,175,288,203,45,177,276,117,21,64,231,215,273,106,237,133,71,228,260,181,28,275,164,133,270,11,74,156,230,275,139,74,268,7,211,167,22,103,240,99,1,135,106,149,220,291,211,121,140,189,46,1,85,4,264,138,265,246,299,56,129,31,99,186,292,136,90,112,94,172,286,276,33,50,96,99,54,18,106,70,67,114,37,76,30,272,103,127,57,274,190,73,63,14,156,242,81,148,216,153,18,277,273,274,2,125,291,214,116,99,99,129,46,74,148,145,88,175,3,277,114,38,78,205,235,241,240,80,69,49,119,260,167,129,237,95,269,162,142,9,266,185,272,17,247,277,246,142,18,104,21,81,18,26,229,77,116,248,13,124,49,193,207,253,34,170,217,63,58,72,159,75,191,85,74,234,252,297,53,274,87,73,254,165,130,207,46,105,112,222,245,93,87,276,251,164,220,153,82,209,36,187,76,127,20,122,219,172,71,156,27,117,260,45,205,180,237,173,201,194,14,9,276,162,239,248,214,224,21,23,85,267,186,153,139,249,116,167,85,283,236,34,52,234,102,80,196,68,209,280,230,210,238,21,297,255,60,253,119,132,9,296,256,97,211,127,75,97,220,197,261,220,298,184,149,99,158,282,190,58,176,33,80,202,4,40,240,272,281,75,194,77,84,35,78,112,143,83,222,159,177,258,232,39,274,224,205,71,170,41,93,97,188,154,291,283,173,87,143,286,41,256,149,46,171,257,69,158,298,1,22,198,206,93,19,126,129,211,284,203,29,231,159,258,16,147,270,134,143,293,4,182,259,13,20,33,24,104,234,220,115,67,13,276,79,137,61,244,133,148,73,203,60,119,215,3,37,71,28,42,42,102,226,147,256,70,30,295,60,65,288,112,126,246,142,113,8,112,7,21,135,34,41,264,20,292,260,49,58,203,47,158,294,186,170,144,221,257,298,175,222,137,212,58,133,262,248,257,205,111,208,251,69,154,276,245,184,118,152,136,221,52,215,91,109,188,281,33,38,95,142,190,51,297,238,250,269,161,24,157,96,7,124,64,94,186,294,9,295,200,51,73,190,233,221,120,62,188,290,192,38,35,101,159,68,300,255,105,299,282,124,166,137,35,229,286,43,213,195,89,123,186,153,61,15,122,157,96,270,37,36,226,236,230,130,285,93,160,127,38,26,111,199,148,82,237,229,255,168,86,171,127,42,171,202,201,269,277,38,228,208,85,2,201,137,179,98,147,245,252,149,40,37,32,1,92,86,152,191,271,26,6,200,265,189,265,228,58,62,11,46,279,269,12,290,215,97,16,293,176,242,251,48,163,41,298,138,50,51,178,209,84,15,97,190,180,257,59,64,252,202,125,247,204,80,157,216,138,135,286,212,235,50,94,171,100,92,147,59,297,165,64,205,206,166,263,5,179,294,173,170,90,8,261,149,252,282,147,253,217,281,27,174,190,210,34,61,212,44,215,144,244,68,73,289,121,21,106,21,230,155,155,263,241,128,58,92,20,203,139,263,10,28,208,4,120,140,145,31,155,104,92,193,210,227,40,101,167,283,70,272,11,155,274,79,46,246,259,72,219,195,106,200,16,93,147,163,125,35,86,15,171,139,70,34,110,239,74,28,240,250,38,149,168,26,47,183,98,41,225,91,70,82,263,88,123,144,260,115,233,1,103,116,29,224,249,117,150,21,229,40,190,25,12,119,182,245,253,279,118,133,103,182,213,193,67,162,207,31,239,67,212,84,41,199,238,6,248,265,178,147,268,291,235,235,143,30,246,39,209,166,42,47,239,184,10,291,228,121,136,143,292,94,279,32,287,212,149,86,24,294,1,105,98,134,287,10,298,46,158,252,197,240,112,215,247,227,27,134,206,69,49,295,158,157,112,22,245,169,97,103,149,85,281,201,81,6,277,124,96,244,169,9,163,55,229,120,185,170,193,121,272,205,110,63,65,130,120,273,152,105,299,72,74,109,9,255,221,239,281,89,19,275,2,299,206,28,134,287,76,22,197,89,149,271,29,118,274,279,253,283,17,141,101,9,72,37,274,229,1,104,41,19,135,187,203,243,156,279,79,98,179,144,264,137,182,1,266,259,280,215,65,151,185,218,30,7,82,156,104,82,212,23,263,275,59,82,162,52,211,177,111,183,81,213,272,180,111,212,236,25,72,3,83,110,144,23,84,156,119,294,167,269,29,226,25,151,15,215,194,157,293,131,268,197,192,96,25,147,97,4,64,248,277,275,18,60,54,198,150,117,10,287,290,46,82,19,209,156,145,20,145,269,3,107,26,149,76,181,3,172,290,178,192,209,234,85,84,97,113,61,44,114,59,89,209,296,287,5,190,278,26,82,209,157,59,195,80,273,245,210,5,166,123,75,201,7,26,220,282,1,133,295,37,39,36,84,74,164,115,152,167,300,156,75,251,169,96,267,141,103,144,139,249,251,174,120,170,76,203,210,36,56,55,210,20,204,3,197,145,224,176,71,142,15,261,99,166,20,108,109,55,275,181,167,261,298,240,258,295,36,282,79,250,28,252,226,161,142,285,228,131,106,282,206,7,74,116,11,14,65,157,156,82,188,43,180,212,20,65,204,54,242,73,133,130,249,152,297,154,217,236,194,287,44,68,171,286,276,64,180,152,197,77,222,137,108,89,294,234,14,125,141,71,28,155,128,50,219,185,220,77,49,282,176,242,86,131,234,131,41,226,237,91,26,229,258,132,205,59,68,216,275,130,78,9,112,11,19,260,100,142,205,9,179,182,81,157,16,55,191,25,200,295,269,235,139,65,255,23,187,40,44,82,289,185,284,35,193,246,66,171,236,111,283,190,26,273,116,255,147,64,229,23,238,76,77,144,176,275,136,29,239,269,57,75,166,291,226,207,199,282,138,22,54,44,210,198,40,229,40,182,60,8,158,221,81,215,223,63,74,194,38,148,252,136,89,224,67,277,157,153,209,35,35,36,157,187,168,39,84,293,269,195,29,278,107,199,233,219,233,177,231,28,89,42,51,4,170,294,264,272,54,285,53,83,235,120,268,178,219,4,271,284,121,183,263,38,274,7,69,129,176,149,102,168,228,278,4,248,65,255,295,25,230,126,107,205,287,288,134,176,299,2,150,213,63,43,7,270,169,131,16,36,300,280,6,154,135,254,232,123,199,194,49,179,191,57,167,140,122,181,235,129,265,116,166,56,102,87,102,69,297,166,134,226,95,295,143,275,16,130,111,25,91,295,241,244,49,220,101,271,35,95,237,150,153,259,3,275,230,288,192,101,255,23,233,55,292,249,300,215,237,94,184,73,273,29,201,86,261,37,3,193,138,108,67,220,140,162,56,297,290,182,271,296,8,238,45,125,147,38,97,211,40,131,72,150,140,100,194,77,72,164,261,278,272,56,187,111,295,268,5,169,25,25,285,184,4,165,140,292,153,72,187,167,154,291,210,245,49,2,100,215,222,133,29,136,24,263,99,55,286,282,180,230,135,49,60,255,261,120,285,253,44,199,173,291,282,37,204,32,69,115,137,168,97,119,91,236,290,110,155,179,158,140,99,13,95,81,122,108,140,266,128,31,161,144,11,78,186,33,186,113,300,179,271,109,161,268,241,113,148,135,37,247,182,111,206,31,6,162,230,65,47,18,266,3,14,198,285,8,49,169,18,3,207,24,178,51,145,96,186,1,117,264,251,241,90,160,202,225,241,275,273,153,173,215,266,147,285,153,255,45,35,182,142,119,216,6,289,155,57,165,217,293,53,104,227,158,132,281,26,214,142,266,163,154,266,181,95,6,233,277,191,235,145,75,235,24,57,5,160,28,54,35,85,11,296,246,233,51,45,120,76,6,228,128,89,15,76,244,259,144,30,73,256,17,166,202,228,289,199,296,281,160,122,101,170,274,244,113,140,75,295,24,8,245,163,91,64,101,114,285,36,175,134,91,204,114,268,71,231,187,107,177,65,138,127,192,254,108,64,117,91,114,240,236,220,76,243,77,211,186,96,94,52,26,49,238,292,76,220,58,52,29,297,58,247,289,47,7,165,17,170,151,172,18,102,58,19,248,32,70,46,15,66,51,194,149,294,108,8,287,174,91,225,140,25,47,14,127,121,11,174,9,238,66,113,269,73,137,261,97,284,93,152,78,12,281,109,155,236,17,10,166,149,57,219,115,33,122,163,21,16,241,27,216,85,34,203,288,60,120,279,145,54,82,44,11,174,190,243,76,182,169,183,130,87,234,239,171,45,148,285,295,151,133,286,174,92,214,171,65,106,86,261,94,231,181,53,237,36,271,186,88,258,296,60,190,17,34,198,193,118,286,168,212,52,180,182,225,21,44,110,150,164,163,270,111,176,237,29,270,176,292,67,115,80,181,13,53,233,241,140,142,51,190,73,229,94,234,266,245,90,130,211,221,24,258,11,189,133,46,261,129,81,121,157,198,152,111,78,18,81,166,150,246,244,281,136,166,208,210,162,6,292,46,24,234,203,28,54,37,25,197,108,118,124,9,69,194,195,126,57,293,160,239,251,210,16,291,81,195,286,266,63,33,11,8,10,231,194,12,46,89,267,293,172,228,30,199,185,15,289,204,57,206,208,105,278,298,64,258,294,86,60,62,17,5,140,264,102,64,159,161,213,162,191,74,131,176,103,218,185,229,176,281,156,150,128,65,91,93,85,71,167,14,166,261,223,144,253,291,198,103,101,47,62,130,187,133,21,193,158,58,172,243,222,34,240,137,63,144,99,33,235,293,226,25,240,96,179,231,113,79,208,157,41,40,49,130,122,139,9,157,296,231,289,66,47,260,258,183,233,169,8,165,231,10,227,255,272,186,130,178,121,151,138,158,245,202,12,187,94,60,181,257,251,14,130,60,165,43,188,3,252,208,229,297,33,198,141,112,14,48,24,70,233,262,205,86,273,133,28,197,29,139,81,5,54,31,47,138,24,238,166,124,275,252,34,168,54,229,66,160,134,178,15,285,232,57,26,185,219,8,61,99,134,190,170,288,15,29,243,116,135,262,66,213,284,72,82,231,225,91,110,265,216,229,10,64,143,235,108,50,134,26,109,47,244,248,214,67,91,111,20,136,223,230,228,148,290,107,293,1,106,54,118,280,214,299,267,74,74,90,85,125,205,85,225,129,39,274,126,75,57,211,180,79,117,262,228,137,245,288,20,164,212,144,171,220,69,277,167,27,245,290,12,131,272,280,231,98,50,222,95,175,261,69,160,139,104,262,27,60,157,80,126,271,24,25,270,39,127,159,103,181,114,63,17,71,294,174,85,2,230,191,201,48,112,290,260,70,59,131,93,173,213,168,97,19,297,272,124,30,168,157,164,300,90,28,115,145,285,147,116,202,184,119,134,74,136,70,248,8,218,189,183,244,177,275,280,236,15,112,49,155,261,152,160,74,243,84,231,2,76,186,282,53,205,259,174,253,72,173,288,286,181,136,157,86,79,231,108,120,71,280,221,219,257,235,155,138,51,163,243,223,223,41,258,120,54,121,119,239,253,124,177,290,109,162,118,156,23,122,100,192,219,250,50,168,104,232,214,194,289,260,283,124,130,290,165,297,246,7,32,42,245,175,283,171,273,36,235,224,228,179,158,158,95,192,198,132,173,130,124,223,44,271,267,268,6,148,7,60,167,49,68,26,257,65,272,105,130,139,133,253,189,76,210,126,42,264,285,45,69,249,152,274,196,211,257,253,229,89,187,146,204,53,207,123,215,245,43,264,279,146,213,296,29,48,227,206,207,75,142,272,287,210,235,45,13,36,79,113,59,191,136,219,237,203,97,134,2,110,77,34,131,23,155,270,69,183,19,23,19,40,278,103,209,8,205,182,166,197,264,119,91,234,218,283,275,267,59,28,82,78,245,212,231,221,129,217,186,229,300,222,43,72,136,199,100,17,254,227,45,104,98,66,53,148,194,118,106,18,141,267,33,147,34,287,12,106,26,237,163,213,75,245,92,194,267,26,298,149,92,114,267,184,16,111,293,59,45,131,60,299,59,154,300,201,287,5,251,8,163,41,151,65,110,226,297,6,194,271,204,232,69,96,81,111,186,64,27,101,250,285,96,79,230,209,252,79,21,213,281,19,114,119,211,119,220,44,118,180,106,138,253,202,17,240,5,280,20,52,156,71,78,92,126,255,21,9,263,159,99,146,12,173,254,293,298,209,175,119,25,30,229,137,42,225,18,89,127,263,247,29,166,267,88,78,15,230,126,79,143,71,117,193,69,95,83,235,18,190,97,138,81,165,67,78,129,218,269,182,268,84,43,9,272,216,34,294,149,165,204,85,193,246,227,249,270,139,200,125,215,70,55,57,217,108,162,232,5,138,92,12,298,22,232,176,268,21,145,198,82,258,150,7,295,157,22,230,156,250,189,202,111,205,100,59,146,79,73,134,220,12,210,196,138,51,59,54,300,220,130,10,221,89,266,202,191,228,147,212,270,113,114,246,176,38,42,20,271,139,214,88,29,283,146,223,241,194,74,193,149,44,186,171,215,246,202,194,89,274,77,131,284,88,17,246,78,273,235,193,9,238,194,274,282,222,297,180,44,230,65,125,97,286,264,81,155,124,298,21,253,146,29,194,78,233,21,246,102,40,276,285,280,197,45,91,17,207,237,114,102,7,20,105,273,143,163,41,20,76,254,265,56,241,246,113,45,59,86,50,140,148,185,72,151,68,296,144,185,226,73,230,28,227,270,111,61,292,161,100,218,7,179,3,2,265,113,148,116,271,119,157,56,171,177,82,158,242,83,250,219,285,140,61,218,98,90,63,148,222,289,58,72,132,148,165,75,43,169,284,86,7,82,148,280,153,4,147,285,291,212,249,59,23,262,128,236,151,29,88,194,282,228,39,220,221,69,48,22,224,265,280,16,199,177,167,297,119,1,210,134,292,255,77,187,46,144,30,131,266,206,233,89,100,226,250,43,205,291,107,286,60,215,121,45,6,247,244,222,298,156,121,227,47,34,86,145,300,78,144,259,1,156,287,85,206,9,293,173,29,273,280,97,175,5,276,122,214,191,235,55,259,209,299,197,4,217,4,27,81,129,38,115,228,245,282,56,52,19,100,165,120,78,197,176,68,218,279,121,68,130,166,43,226,300,68,48,134,207,242,228,6,233,13,221,297,261,215,267,198,44,164,257,105,134,68,45,2,159,170,288,266,26,190,260,186,66,212,135,43,235,74,235,124,116,235,222,269,241,52,237,223,111,39,214,209,238,288,293,229,153,183,264,78,294,34,284,246,33,44,102,116,96,58,127,137,253,272,134,220,225,259,273,177,122,36,175,96,278,196,210,215,139,242,135,231,105,182,104,247,188,206,189,53,35,72,36,101,283,61,114,201,165,210,163,223,133,109,147,237,197,148,2,158,279,85,25,122,64,104,61,184,93,154,290,185,70,116,14,110,23,28,165,62,234,256,223,252,117,217,71,300,130,20,81,50,224,153,117,226,14,67,237,216,154,273,72,110,223,215,163,37,264,33,241,255,110,52,155,230,101,226,214,284,261,213,243,174,59,265,231,165,4,178,207,54,107,168,252,293,240,284,299,214,72,151,40,260,163,33,165,139,62,153,132,31,39,219,234,216,266,293,95,2,272,162,244,233,187,148,219,285,268,191,201,108,223,12,22,292,292,290,193,65,284,51,101,32,55,166,23,82,91,113,157,17,270,88,71,41,298,63,253,166,44,296,192,166,42,117,67,8,238,89,274,282,166,187,59,237,298,2,138,278,66,159,145,183,203,177,39,151,195,296,272,97,293,105,271,32,264,205,155,154,295,255,175,4,90,267,159,193,71,148,148,203,295,296,176,108,80,99,140,181,118,296,219,69,173,203,7,219,175,39,283,3,120,20,289,142,117,294,238,197,169,187,157,229,206,224,204,164,230,20,10,32,282,78,166,280,212,80,117,135,191,89,54,144,93,10,74,33,223,216,23,24,75,146,242,294,78,256,249,229,236,209,29,82,151,290,62,126,10,121,37,68,297,280,272,186,32,74,46,108,131,139,146,246,102,126,87,158,149,182,247,95,142,205,168,143,202,191,124,68,233,10,293,195,166,65,292,213,179,126,143,43,157,111,97,238,42,38,60,144,39,262,102,48,233,84,18,155,10,66,31,107,39,62,74,252,119,107,67,76,194,216,158,253,146,219,175,271,251,219,221,12,31,141,123,258,189,289,226,46,193,237,93,34,206,100,76,14,97,79,94,279,117,136,54,14,197,252,279,88,288,151,259,130,83,92,123,162,112,286,209,151,290,71,103,221,281,78,81,205,3,234,108,106,134,23,73,35,160,218,108,216,236,153,133,187,176,260,196,114,298,280,15,220,157,96,26,128,147,44,89,24,7,236,31,141,27,26,213,117,64,250,192,151,34,222,234,182,202,28,96,86,45,256,171,258,252,70,178,41,16,36,17,255,245,266,18,280,250,180,157,266,9,101,7,203,278,227,132,257,133,200,151,148,207,135,232,253,98,5,268,31,31,52,246,77,83,227,194,87,118,86,238,126,23,258,103,207,156,130,91,241,50,85,198,112,92,74,99,51,16,291,274,129,182,14,82,236,143,27,98,69,72,104,157,25,224,104,212,197,276,46,215,24,119,176,132,299,180,224,184,299,239,269,232,15,160,243,166,132,202,230,184,16,162,161,20,10,183,76,298,246,251,21,297,266,229,197,91,7,279,214,156,264,190,220,38,90,287,131,104,238,96,39,199,156,294,96,156,285,265,298,258,13,111,14,284,149,285,285,257,164,261,189,85,267,103,102,61,244,35,78,239,199,77,138,43,36,54,169,128,260,270,47,170,130,45,9,80,69,193,197,236,171,67,130,147,168,240,192,97,272,295,25,218,271,90,277,119,148,73,38,118,250,58,51,198,86,33,9,64,118,130,240,123,261,142,51,10,109,265,47,96,219,216,214,161,162,66,77,299,13,156,279,120,83,37,190,152,189,267,202,103,111,210,214,87,173,98,230,296,220,290,85,168,38,230,36,61,230,90,234,23,93,85,161,209,54,201,102,58,235,25,124,269,174,163,142,76,4,195,292,229,131,169,226,192,42,276,210,127,12,229,175,82,243,255,95,180,104,31,80,265,290,231,273,93,84,268,259,212,91,76,157,29,76,62,26,190,160,29,69,62,97,48,22,28,254,222,232,201,11,7,147,243,6,216,279,5,95,57,149,82,284,250,224,265,276,165,31,109,100,102,182,263,156,46,114,141,163,57,243,34,98,18,162,103,20,208,135,146,291,5,125,176,127,168,189,98,234,6,138,215,199,15,104,130,254,82,221,10,44,27,147,104,123,246,4,51,109,122,168,218,247,46,75,174,27,282,277,4,202,151,119,55,183,63,6,85,208,138,127,143,231,31,199,22,48,134,106,172,210,241,245,52,64,229,208,54,199,167,275,53,39,286,251,108,238,23,115,38,87,225,21,45,163,80,165,52,215,170,112,199,155,19,31,107,18,45,264,248,53,258,296,286,159,218,164,209,204,285,256,45,188,172,163,41,150,35,210,300,1,23,2,17,249,38,150,92,141,43,291,231,47,230,134,194,284,296,33,164,32,206,214,141,243,165,83,208,276,284,62,65,253,75,14,49,270,233,16,186,38,52,106,170,7,60,66,279,8,105,234,186,218,83,155,153,16,48,132), 230)
30
+ }
31
+
32
+ test("test8") {
33
+ assertEquals(Main.longestSubsequence(154,151,261,32,114,294,282,180,139,158,219,274,292,149,270,285,300,10,56,184,87,41,273,296,271,251,48,188,207,250,181,31,199,97,82,159,15,63,110,152,136,171,202,54,150,154,288,24,84,34,175,219,185,54,105,127,62,90,204,181,227,191,195,103,191,213,10,77,128,31,122,297,128,87,231,191,81,105,218,214,198,9,225,244,106,87,247,218,80,171,60,134,73,140,20,244,86,35,12,103,104,121,222,297,222,31,42,37,102,64,125,261,69,106,208,139,7,130,10,97,10,171,198,161,85,278,254,193,115,211,160,18,96,117,150,127,275,239,44,79,285,84,134,144,228,257,238,261,81,163,6,24,274,132,73,98,262,238,38,2,28,178,111,9,271,173,149,237,64,24,15,258,60,112,298,263,102,162,170,74,41,213,207,252,45,180,293,281,174,15,186,52,233,117,248,129,204,130,18,119,99,241,15,292,77,259,240,42,61,286,92,242,215,153,54,232,127,143,55,166,223,24,105,138,202,48,91,158,267,219,277,252,117,181,246,205,268,144,132,176,45,97,96,156,259,234,256,222,292,205,76,127,197,38,228,195,239,114,97,215,74,59,283,134,266,195,240,200,294,266,257,168,238,243,176,229,199,206,50,264,247,107,110,131,178,85,261,91,241,57,75,175,160,187,31,66,9,295,113,211,11,168,232,212,269,273,123,15,82,122,205,87,159,189,195,4,108,194,40,231,70,177,262,75,64,26,214,182,40,111,263,103,75,110,258,53,29,204,259,285,180,33,16,277,124,282,105,252,285,210,93,122,259,60,243,133,154,223,227,191,124,178,266,189,226,255,287,286,58,265,280,16,147,128,210,223,83,27,196,57,147,265,10,86,62,288,299,24,71,213,36,190,286,89,230,118,245,273,129,194,175,46,221,132,125,199,111,105,241,36,197,196,277,172,197,250,189,122,150,25,36,92,132,81,222,16,12,283,247,85,155,21,173,174,240,69,196,176,125,172,148,125,254,162,79,233,80,126,197,283,229,244,132,294,214,166,22,271,11,193,41,218,205,166,247,108,60,226,128,199,290,205,123,137,3,199,46,292,68,77,62,252,159,142,50,226,225,265,272,145,261,3,96,70,166,122,57,199,51,125,205,86,135,132,27,239,199,108,236,153,151,28,104,85,163,6,100,201,6,129,83,231,3,289,283,296,45,95,286,137,220,220,161,25,273,134,21,198,113,204,88,159,270,283,54,291,246,90,271,196,58,189,137,205,101,182,144,289,254,101,182,175,252,30,11,90,283,212,24,261,277,44,98,131,194,217,191,204,59,50,186,281,299,92,65,35,287,186,13,64,60,231,166,22,57,159,276,269,59,225,171,10,57,253,87,293,110,115,278,20,86,140,174,90,77,232,1,137,94,109,145,268,166,5,215,76,252,147,249,196,275,214,103,177,66,145,130,236,168,283,261,219,4,214,239,151,17,242,162,266,254,147,285,80,132,220,92,32,51,203,289,54,238,45,17,60,194,254,124,234,90,222,70,79,162,169,57,200,105,18,155,254,130,299,96,63,216,88,219,24,113,163,33,110,227,192,87,235,237,241,270,156,141,225,150,8,286,172,22,263,197,231,45,24,73,130,72,121,251,263,161,37,132,32,88,285,145,236,10,165,221,128,201,34,71,36,81,238,21,82,79,192,258,182,196,21,151,297,294,27,98,194,272,258,223,203,109,84,8,121,120,256,188,109,103,120,119,101,112,80,219,225,295,19,234,263,69,211,89,149,73,74,75,276,70,189,297,296,154,96,128,73,14,223,73,300,204,45,152,57,41,176,216,17,251,238,93,170,241,96,233,14,86,278,201,172,143,198,210,215,61,278,156,144,64,81,132,128,243,70,137,215,216,89,231,200,166,278,251,70,157,108,98,122,135,48,136,61,96,13,294,73,216,77,188,137,35,174,154,183,219,51,40,193,225,22,188,144,227,127,80,161,217,62,290,227,287,261,214,116,55,74,52,257,98,204,123,270,197,289,147,143,218,18,78,74,30,175,270,290,255,20,211,246,35,58,233,121,91,175,269,1,66,241,12,36,34,94,274,220,177,78,283,184,122,95,255,34,128,218,200,197,101,85,2,248,109,139,61,43,131,111,285,186,114,147,131,264,94,73,240,184,169,209,97,193,74,225,124,202,45,166,75,227,129,43,124,37,132,16,177,65,166,77,6,43,23,36,250,288,77,169,131,226,159,140,286,43,116,235,89,140,170,180,179,159,30,136,161,37,41,175,259,184,240,22,248,248,112,40,18,166,24,220,116,62,67,166,83,169,272,145,186,49,190,224,283,274,56,58,33,247,193,159,77,3,263,170,201,97,65,75,249,197,285,126,134,75,173,151,283,34,89,283,269,34,101,36,22,212,280,235,251,194,205,178,247,148,139,264,172,164,232,186,114,24,266,34,219,254,8,40,294,237,290,52,183,144,55,200,75,36,140,78,204,25,71,90,191,66,209,133,267,187,195,109,293,79,93,51,201,63,246,281,297,97,273,139,104,210,208,73,224,227,15,37,230,160,294,225,152,170,131,147,47,197,283,145,297,230,181,281,85,176,199,296,287,190,98,110,111,39,111,138,39,190,55,74,112,225,204,13,270,161,293,294,232,247,210,50,238,296,102,130,200,235,204,165,83,147,298,192,82,1,224,21,300,215,200,171,141,78,26,175,288,87,104,151,105,256,285,102,123,154,218,128,40,173,50,80,130,295,236,101,146,46,232,277,14,118,232,75,298,179,227,1,232,70,35,138,133,44,295,274,245,191,192,279,212,267,251,193,48,195,253,7,138,49,107,252,118,265,297,217,267,128,5,232,289,5,243,258,204,192,172,223,59,161,294,123,91,84,181,262,32,135,185,28,206,202,82,165,101,287,36,211,277,298,161,75,245,115,61,287,227,91,254,293,29,148,256,251,165,76,148,100,227,156,140,220,190,234,154,240,198,227,158,269,82,142,73,100,163,87,160,50,10,37,111,81,220,164,71,276,144,39,206,23,217,276,39,204,238,70,257,200,197,92,94,140,2,226,201,148,297,68,63,22,106,165,130,20,244,143,36,237,105,257,2,288,175,33,24,38,74,239,94,260,2,184,174,288,195,95,125,146,42,200,164,48,25,237,199,230,226,64,5,179,112,149,238,273,250,248,124,27,72,143,78,179,93,8,271,293,23,107,298,24,46,189,128,218,112,32,71,24,93,300,81,282,60,180,238,94,37,287,84,79,242,280,243,153,292,116,99,90,268,63,58,87,171,213,298,74,156,240,38,181,30,46,207,283,84,198,27,51,228,298,225,37,168,118,256,84,118,5,256,62,134,82,112,164,191,65,215,263,205,83,61,232,63,292,255,247,32,167,99,110,149,206,14,65,132,40,207,121,127,178,98,295,291,33,107,114,165,180,33,150,226,35,16,221,201,200,182,118,176,245,37,292,264,54,297,51,125,188,189,241,119,11,170,20,12,59,261,159,123,18,198,289,190,31,287,217,30,175,157,226,292,112,201,181,261,204,81,79,175,42,214,102,211,11,252,2,33,255,128,195,213,126,25,194,284,244,73,24,76,153,279,137,66,203,269,29,265,62,131,85,148,47,173,34,275,31,285,45,96,208,194,30,175,145,141,122,27,10,166,169,188,114,98,114,101,125,48,226,70,223,121,51,298,15,139,54,171,122,157,186,126,117,26,135,170,10,88,182,206,254,139,11,18,61,118,136,64,196,178,5,188,25,230,89,76,234,67,83,52,262,84,115,47,26,183,24,112,49,297,152,298,256,106,154,117,165,97,123,279,281,123,47,61,266,255,130,48,108,30,28,258,226,296,18,197,204,22,259,239,58,274,147,110,46,27,139,205,296,80,159,282,86,206,66,139,88,296,229,250,202,297,120,118,14,161,90,8,299,243,157,152,247,288,247,92,76,261,122,58,157,109,96,106,172,298,237,201,85,46,152,156,38,123,230,295,52,66,264,82,205,180,97,250,188,153,298,240,256,181,233,73,209,156,252,274,199,187,76,161,3,54,236,10,72,127,113,73,296,221,164,220,65,124,216,162,144,110,134,178,185,207,152,152,69,88,289,153,284,285,233,300,221,24,83,76,289,7,60,93,46,23,87,20,136,76,81,132,186,275,39,214,288,38,77,174,141,47,217,176,79,51,16,285,34,199,236,282,195,160,213,51,186,81,159,94,119,180,172,268,226,245,154,204,210,40,216,216,22,234,233,271,55,163,251,170,98,188,31,60,177,68,15,94,265,130,29,108,123,138,139,274,39,54,243,232,81,36,92,95,282,183,146,274,130,70,47,105,150,168,225,183,23,159,61,33,296,175,257,151,172,276,68,4,154,289,66,167,123,257,269,239,173,94,201,69,1,66,300,166,63,96,293,178,30,245,37,221,8,275,272,204,23,277,130,249,139,276,213,245,3,61,220,119,96,237,277,5,255,237,218,136,221,233,220,62,121,51,188,149,147,3,123,289,217,128,191,276,233,223,141,251,2,196,191,170,50,75,72,77,47,94,84,77,157,274,66,42,132,70,78,68,186,61,191,122,48,197,100,296,139,12,10,58,109,16,285,68,172,72,300,128,125,194,228,188,234,73,28,35,165,56,124,200,218,192,237,6,89,55,160,194,172,272,198,166,283,167,296,278,187,261,178,72,113,246,103,40,127,19,300,285,258,230,67,81,218,238,212,53,203,106,96,173,99,233,212,260,70,231,113,4,166,75,224,73,81,241,267,236,203,263,207,214,286,46,24,224,122,178,286,137,236,247,58,203,175,198,205,219,261,146,85,107,168,66,26,59,221,30,108,251,236,32,138,262,292,97,76,127,251,249,192,135,246,37,109,225,226,260,167,279,43,104,284,172,168,283,87,157,85,247,87,208,101,200,186,222,172,242,49,180,49,196,81,196,51,8,145,36,71,223,10,61,203,157,194,238,155,117,269,224,48,147,76,222,225,232,158,85,2,186,113,230,201,117,60,231,267,36,284,44,225,108,24,185,261,138,154,96,7,181,246,135,235,62,58,110,134,95,98,219,217,247,139,110,83,116,190,206,108,162,291,196,33,147,250,101,200,299,63,205,183,16,129,119,207,16,232,271,218,287,184,125,284,243,76,212,103,112,110,46,133,4,169,49,40,65,196,136,150,91,171,129,289,146,16,58,211,246,294,183,207,180,143,180,26,265,193,261,288,81,1,73,120,50,13,54,250,250,293,103,180,96,69,132,235,130,91,235,8,188,128,255,213,133,193,272,5,289,71,39,115,44,226,50,173,63,2,6,144,245,5,157,151,49,18,154,132,207,22,253,87,88,225,207,29,116,45,4,148,162,67,204,165,201,130,52,247,80,31,50,20,46,102,164,157,120,25,230,4,2,288,67,51,15,165,128,88,254,197,194,234,278,187,155,36,11,155,300,261,85,199,96,106,251,224,25,30,144,293,274,150,180,270,94,19,54,29,178,88,172,196,199,142,29,269,98,85,178,206,58,110,262,63,72,146,213,166,18,211,76,211,220,141,139,233,247,270,158,219,102,196,76,169,10,150,143,250,182,85,220,11,37,249,173,156,194,66,162,84,192,21,125,11,51,76,39,223,247,139,223,67,157,145,3,80,255,38,161,163,70,104,241,281,195,277,231,250,298,271,37,168,254,148,151,74,242,259,73,1,180,127,160,75,208,89,215,103,165,214,63,133,135,247,239,207,24,181,191,23,250,158,154,179,79,238,22,96,299,188,240,143,88,176,49,188,108,89,179,48,92,31,68,71,29,63,283,77,220,160,82,26,263,116,289,210,233,111,66,179,96,109,166,132,74,160,107,292,80,201,289,187,215,211,17,111,19,297,2,261,238,33,22,152,185,295,158,72,91,247,157,102,300,78,190,23,285,61,73,165,235,59,275,253,99,161,146,102,99,111,182,6,191,136,196,236,41,226,23,298,90,201,300,60,61,263,173,56,55,204,245,143,297,280,59,79,143,63,71,17,255,121,203,193,170,236,281,195,70,31,110,79,77,267,44,219,15,296,197,148,300,173,231,171,54,115,110,50,258,70,211,227,245,221,190,131,53,298,36,4,93,280,29,174,76,203,132,266,226,276,156,100,165,265,202,36,258,160,21,47,233,226,159,255,121,182,280,234,250,27,284,43,2,294,264,104,8,240,205,101,300,133,226,298,216,252,74,14,290,63,160,123,98,101,224,70,297,226,196,273,281,266,121,238,277,120,45,33,241,286,288,292,197,126,7,201,81,31,190,179,209,208,293,139,159,240,82,77,242,268,76,67,183,122,26,261,52,4,205,130,182,289,110,31,264,262,61,37,117,20,138,133,187,50,215,177,184,247,134,4,176,120,197,11,155,135,100,3,180,2,135,292,192,113,233,265,100,79,95,86,71,283,71,77,262,231,103,102,206,293,260,162,263,68,150,247,221,103,259,97,207,207,90,23,54,51,43,164,297,269,20,67,249,24,74,201,154,108,15,117,221,79,218,5,38,165,58,162,200,262,183,249,27,228,209,263,45,232,78,193,253,50,16,57,222,146,300,278,94,194,18,226,231,45,181,192,122,281,298,261,282,132,216,32,133,176,233,296,260,177,90,91,280,140,298,193,254,96,5,74,168,209,37,151,117,113,121,299,23,263,75,59,211,82,156,61,127,109,19,142,233,288,19,171,107,217,52,32,238,78,69,54,282,235,150,36,175,120,276,182,130,62,178,10,13,103,75,241,252,3,115,293,121,41,253,123,285,15,192,251,92,264,246,245,52,92,255,211,97,212,186,270,216,182,239,128,127,230,111,124,236,89,257,57,199,57,27,290,183,169,148,239,264,48,126,211,55,45,194,65,231,81,171,181,159,136,284,157,247,71,124,162,10,188,160,124), 144)
34
+ }
35
+
36
+ }
longest_subsequence_with_limited_sum/.DS_Store ADDED
Binary file (6.15 kB). View file
 
longest_subsequence_with_limited_sum/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 (answerQueries [4,5,2,1] [3,10,21])," [2,3,4] (answerQueries [4,5,2,1] [3,10,21]))
13
+
14
+ test2 :: Test
15
+ test2 = TestCase (assertEqual "for (answerQueries [2,3,4,5] [1])," [0] (answerQueries [2,3,4,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
longest_subsequence_with_limited_sum/java_tests/Main.java ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import static org.junit.jupiter.api.Assertions.*;
3
+ import org.junit.jupiter.api.Test;
4
+ import java.util.List;
5
+ import java.util.Arrays;
6
+ import java.util.ArrayList;
7
+ public class Main {
8
+ //Program start
9
+
10
+ //Program end
11
+
12
+ @Test
13
+ public void test1() {
14
+ assertEquals(new ArrayList<>(Arrays.asList(2,3,4)), answerQueries(new ArrayList<>(Arrays.asList(4,5,2,1)), new ArrayList<>(Arrays.asList(3,10,21))));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals(new ArrayList<>(Arrays.asList(0)), answerQueries(new ArrayList<>(Arrays.asList(2,3,4,5)), new ArrayList<>(Arrays.asList(1))));
19
+ }
20
+
21
+ }
longest_subsequence_with_limited_sum/meta.json ADDED
The diff for this file is too large to render. See raw diff
 
longest_subsequence_with_limited_sum/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 [2;3;4] (answerQueries [4;5;2;1] [3;10;21])
12
+
13
+ let test2 _ = assert_equal [0] (answerQueries [2;3;4;5] [1])
14
+
15
+
16
+ (* Grouping test cases *)
17
+ let suite = "Test Suite for answerQueries" >::: [
18
+
19
+ "test1" >:: test1;
20
+ "test2" >:: test2;
21
+ ]
22
+
23
+
24
+ (* Running the tests *)
25
+ let () = run_test_tt_main suite
26
+ end
longest_subsequence_with_limited_sum/scala_tests/MySuite.scala ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ class MySuite extends munit.FunSuite {
3
+
4
+ test("test1") {
5
+ assertEquals(Main.answerQueries(List(4,5,2,1),List(3,10,21)), List(2,3,4))
6
+ }
7
+
8
+ test("test2") {
9
+ assertEquals(Main.answerQueries(List(2,3,4,5),List(1)), List(0))
10
+ }
11
+
12
+ }
longest_substring_of_one_repeating_character/.DS_Store ADDED
Binary file (6.15 kB). View file
 
longest_substring_of_one_repeating_character/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 (longestRepeating \"babacc \" \"bcb \" [1,3,3])," [3,3,4] (longestRepeating "babacc" "bcb" [1,3,3]))
13
+
14
+ test2 :: Test
15
+ test2 = TestCase (assertEqual "for (longestRepeating \"abyzz \" \"aa \" [2,1])," [2,3] (longestRepeating "abyzz" "aa" [2,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
longest_substring_of_one_repeating_character/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(3,3,4)), longestRepeating("babacc", "bcb", new ArrayList<>(Arrays.asList(1,3,3))));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals(new ArrayList<>(Arrays.asList(2,3)), longestRepeating("abyzz", "aa", new ArrayList<>(Arrays.asList(2,1))));
19
+ }
20
+
21
+ }
longest_substring_of_one_repeating_character/meta.json ADDED
@@ -0,0 +1,1047 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "id": 2319,
3
+ "name": "longest_substring_of_one_repeating_character",
4
+ "difficulty": "Hard",
5
+ "link": "https://leetcode.com/problems/longest-substring-of-one-repeating-character/",
6
+ "date": "1647129600000",
7
+ "task_description": "You are given a **0-indexed** string `s`. You are also given a **0-indexed** string `queryCharacters` of length `k` and a **0-indexed** array of integer **indices** `queryIndices` of length `k`, both of which are used to describe `k` queries. The `ith` query updates the character in `s` at index `queryIndices[i]` to the character `queryCharacters[i]`. Return _an array_ `lengths` _of length _`k`_ where_ `lengths[i]` _is the **length** of the **longest substring** of _`s`_ consisting of **only one repeating** character **after** the_ `ith` _query__ is performed._ **Example 1:** ``` **Input:** s = \"babacc\", queryCharacters = \"bcb\", queryIndices = [1,3,3] **Output:** [3,3,4] **Explanation:** - 1st query updates s = \"b**b**bacc\". The longest substring consisting of one repeating character is \"bbb\" with length 3. - 2nd query updates s = \"bbb**c**cc\". The longest substring consisting of one repeating character can be \"bbb\" or \"ccc\" with length 3. - 3rd query updates s = \"bbb**b**cc\". The longest substring consisting of one repeating character is \"bbbb\" with length 4. Thus, we return [3,3,4]. ``` **Example 2:** ``` **Input:** s = \"abyzz\", queryCharacters = \"aa\", queryIndices = [2,1] **Output:** [2,3] **Explanation:** - 1st query updates s = \"ab**a**zz\". The longest substring consisting of one repeating character is \"zz\" with length 2. - 2nd query updates s = \"a**a**azz\". The longest substring consisting of one repeating character is \"aaa\" with length 3. Thus, we return [2,3]. ``` **Constraints:** `1 <= s.length <= 105` `s` consists of lowercase English letters. `k == queryCharacters.length == queryIndices.length` `1 <= k <= 105` `queryCharacters` consists of lowercase English letters. `0 <= queryIndices[i] < s.length`",
8
+ "public_test_cases": [
9
+ {
10
+ "label": "Example 1",
11
+ "input": "s = \"babacc\", queryCharacters = \"bcb\", queryIndices = [1,3,3]",
12
+ "output": "[3,3,4] "
13
+ },
14
+ {
15
+ "label": "Example 2",
16
+ "input": "s = \"abyzz\", queryCharacters = \"aa\", queryIndices = [2,1]",
17
+ "output": "[2,3] "
18
+ }
19
+ ],
20
+ "private_test_cases": [
21
+ {
22
+ "input": [
23
+ "\"mldyufrhyddnbawxkxeft\"",
24
+ "\"hhfqjppcruhikachwlabsdhjzfyyxpstnhazmpe\"",
25
+ [
26
+ 16,
27
+ 14,
28
+ 14,
29
+ 8,
30
+ 14,
31
+ 13,
32
+ 17,
33
+ 3,
34
+ 20,
35
+ 10,
36
+ 18,
37
+ 18,
38
+ 20,
39
+ 9,
40
+ 3,
41
+ 12,
42
+ 14,
43
+ 20,
44
+ 8,
45
+ 17,
46
+ 2,
47
+ 15,
48
+ 5,
49
+ 8,
50
+ 13,
51
+ 8,
52
+ 6,
53
+ 3,
54
+ 9,
55
+ 15,
56
+ 4,
57
+ 4,
58
+ 17,
59
+ 13,
60
+ 7,
61
+ 6,
62
+ 0,
63
+ 15,
64
+ 11
65
+ ]
66
+ ],
67
+ "output": [
68
+ 2,
69
+ 2,
70
+ 2,
71
+ 2,
72
+ 2,
73
+ 2,
74
+ 2,
75
+ 2,
76
+ 2,
77
+ 1,
78
+ 1,
79
+ 1,
80
+ 1,
81
+ 1,
82
+ 1,
83
+ 1,
84
+ 1,
85
+ 1,
86
+ 2,
87
+ 2,
88
+ 2,
89
+ 2,
90
+ 2,
91
+ 1,
92
+ 1,
93
+ 1,
94
+ 1,
95
+ 1,
96
+ 1,
97
+ 1,
98
+ 1,
99
+ 1,
100
+ 1,
101
+ 2,
102
+ 2,
103
+ 2,
104
+ 2,
105
+ 2,
106
+ 2
107
+ ]
108
+ },
109
+ {
110
+ "input": [
111
+ "\"yqhpdmefhzuujqtttgctyhaajxomcwyhkdkpnmxmfeqvjeudkpumdjyrqymdgspvsqlzfjtijwdffrhgyjpygacmkv\"",
112
+ "\"aa\"",
113
+ [
114
+ 26,
115
+ 5
116
+ ]
117
+ ],
118
+ "output": [
119
+ 3,
120
+ 3
121
+ ]
122
+ },
123
+ {
124
+ "input": [
125
+ "\"fwisuvqxrdpqmomunucphecqlvphsaxcjstsuqqxv\"",
126
+ "\"ophvjfqirvbjalbqkpaozlvewmvmnhbjwotsphkdygveczwxqxmoffruachbrmzfihqluzhrlssqffalo\"",
127
+ [
128
+ 25,
129
+ 1,
130
+ 5,
131
+ 36,
132
+ 2,
133
+ 1,
134
+ 15,
135
+ 38,
136
+ 27,
137
+ 14,
138
+ 0,
139
+ 28,
140
+ 20,
141
+ 28,
142
+ 32,
143
+ 0,
144
+ 11,
145
+ 15,
146
+ 30,
147
+ 11,
148
+ 7,
149
+ 28,
150
+ 1,
151
+ 15,
152
+ 6,
153
+ 13,
154
+ 7,
155
+ 11,
156
+ 21,
157
+ 2,
158
+ 29,
159
+ 6,
160
+ 12,
161
+ 3,
162
+ 1,
163
+ 20,
164
+ 10,
165
+ 20,
166
+ 4,
167
+ 15,
168
+ 6,
169
+ 10,
170
+ 24,
171
+ 19,
172
+ 12,
173
+ 16,
174
+ 9,
175
+ 29,
176
+ 27,
177
+ 27,
178
+ 7,
179
+ 35,
180
+ 17,
181
+ 10,
182
+ 25,
183
+ 30,
184
+ 13,
185
+ 20,
186
+ 27,
187
+ 39,
188
+ 38,
189
+ 8,
190
+ 11,
191
+ 36,
192
+ 35,
193
+ 31,
194
+ 3,
195
+ 20,
196
+ 22,
197
+ 37,
198
+ 36,
199
+ 38,
200
+ 8,
201
+ 35,
202
+ 7,
203
+ 23,
204
+ 40,
205
+ 9,
206
+ 36,
207
+ 18,
208
+ 5
209
+ ]
210
+ ],
211
+ "output": [
212
+ 2,
213
+ 2,
214
+ 2,
215
+ 2,
216
+ 2,
217
+ 2,
218
+ 2,
219
+ 2,
220
+ 2,
221
+ 2,
222
+ 1,
223
+ 1,
224
+ 1,
225
+ 1,
226
+ 1,
227
+ 1,
228
+ 1,
229
+ 1,
230
+ 2,
231
+ 2,
232
+ 2,
233
+ 2,
234
+ 2,
235
+ 2,
236
+ 2,
237
+ 2,
238
+ 2,
239
+ 3,
240
+ 3,
241
+ 3,
242
+ 3,
243
+ 3,
244
+ 1,
245
+ 1,
246
+ 1,
247
+ 1,
248
+ 1,
249
+ 1,
250
+ 1,
251
+ 1,
252
+ 1,
253
+ 1,
254
+ 1,
255
+ 1,
256
+ 1,
257
+ 1,
258
+ 1,
259
+ 1,
260
+ 1,
261
+ 1,
262
+ 1,
263
+ 1,
264
+ 1,
265
+ 1,
266
+ 1,
267
+ 1,
268
+ 1,
269
+ 1,
270
+ 1,
271
+ 1,
272
+ 1,
273
+ 2,
274
+ 2,
275
+ 2,
276
+ 2,
277
+ 2,
278
+ 2,
279
+ 2,
280
+ 2,
281
+ 2,
282
+ 2,
283
+ 2,
284
+ 1,
285
+ 1,
286
+ 1,
287
+ 1,
288
+ 1,
289
+ 2,
290
+ 2,
291
+ 2,
292
+ 2
293
+ ]
294
+ },
295
+ {
296
+ "input": [
297
+ "\"pbxsrqesvrauzwfqlgtnkfdgutaldupodjatkgfvkglnyczslirgsoa\"",
298
+ "\"occchvbilygtciuzjxyzwepvcvlllrnytsykqizpmozdlqqywharlrapfpzndbj\"",
299
+ [
300
+ 1,
301
+ 47,
302
+ 10,
303
+ 38,
304
+ 42,
305
+ 6,
306
+ 10,
307
+ 37,
308
+ 27,
309
+ 22,
310
+ 22,
311
+ 24,
312
+ 39,
313
+ 36,
314
+ 2,
315
+ 23,
316
+ 14,
317
+ 9,
318
+ 32,
319
+ 5,
320
+ 17,
321
+ 3,
322
+ 29,
323
+ 44,
324
+ 51,
325
+ 24,
326
+ 50,
327
+ 39,
328
+ 45,
329
+ 37,
330
+ 47,
331
+ 46,
332
+ 38,
333
+ 51,
334
+ 12,
335
+ 49,
336
+ 42,
337
+ 16,
338
+ 41,
339
+ 11,
340
+ 46,
341
+ 31,
342
+ 2,
343
+ 11,
344
+ 27,
345
+ 2,
346
+ 29,
347
+ 24,
348
+ 52,
349
+ 52,
350
+ 45,
351
+ 40,
352
+ 52,
353
+ 13,
354
+ 12,
355
+ 39,
356
+ 19,
357
+ 0,
358
+ 29,
359
+ 13,
360
+ 35,
361
+ 11,
362
+ 9
363
+ ]
364
+ ],
365
+ "output": [
366
+ 1,
367
+ 1,
368
+ 1,
369
+ 1,
370
+ 1,
371
+ 1,
372
+ 1,
373
+ 1,
374
+ 1,
375
+ 1,
376
+ 2,
377
+ 2,
378
+ 2,
379
+ 2,
380
+ 2,
381
+ 2,
382
+ 2,
383
+ 2,
384
+ 2,
385
+ 2,
386
+ 2,
387
+ 2,
388
+ 2,
389
+ 2,
390
+ 2,
391
+ 2,
392
+ 2,
393
+ 2,
394
+ 2,
395
+ 2,
396
+ 2,
397
+ 2,
398
+ 2,
399
+ 2,
400
+ 2,
401
+ 2,
402
+ 2,
403
+ 2,
404
+ 2,
405
+ 2,
406
+ 2,
407
+ 2,
408
+ 2,
409
+ 2,
410
+ 2,
411
+ 2,
412
+ 2,
413
+ 2,
414
+ 1,
415
+ 1,
416
+ 1,
417
+ 1,
418
+ 1,
419
+ 1,
420
+ 1,
421
+ 1,
422
+ 1,
423
+ 1,
424
+ 1,
425
+ 1,
426
+ 1,
427
+ 2,
428
+ 2
429
+ ]
430
+ },
431
+ {
432
+ "input": [
433
+ "\"dxttasnzkkybjnvuevkxeobdbiudldvaonmqjaxhnbzqlvuijmzbfs\"",
434
+ "\"wbddpbsy\"",
435
+ [
436
+ 46,
437
+ 19,
438
+ 19,
439
+ 33,
440
+ 14,
441
+ 25,
442
+ 51,
443
+ 43
444
+ ]
445
+ ],
446
+ "output": [
447
+ 2,
448
+ 2,
449
+ 2,
450
+ 2,
451
+ 2,
452
+ 2,
453
+ 2,
454
+ 2
455
+ ]
456
+ },
457
+ {
458
+ "input": [
459
+ "\"jhlruycytwwhfbbgvqdnyykzlfcvizzecbkcdnjrhilacnnkhwewcrlpyht\"",
460
+ "\"bjoohpjxyakjz\"",
461
+ [
462
+ 10,
463
+ 40,
464
+ 40,
465
+ 25,
466
+ 43,
467
+ 29,
468
+ 54,
469
+ 19,
470
+ 6,
471
+ 53,
472
+ 27,
473
+ 28,
474
+ 44
475
+ ]
476
+ ],
477
+ "output": [
478
+ 2,
479
+ 2,
480
+ 2,
481
+ 2,
482
+ 2,
483
+ 2,
484
+ 2,
485
+ 2,
486
+ 3,
487
+ 3,
488
+ 3,
489
+ 3,
490
+ 3
491
+ ]
492
+ },
493
+ {
494
+ "input": [
495
+ "\"mjnuuayckgg\"",
496
+ "\"dgbhoanwizjgleuoagvjaok\"",
497
+ [
498
+ 8,
499
+ 7,
500
+ 0,
501
+ 9,
502
+ 9,
503
+ 5,
504
+ 10,
505
+ 2,
506
+ 10,
507
+ 1,
508
+ 8,
509
+ 10,
510
+ 10,
511
+ 1,
512
+ 9,
513
+ 1,
514
+ 5,
515
+ 1,
516
+ 7,
517
+ 8,
518
+ 7,
519
+ 7,
520
+ 4
521
+ ]
522
+ ],
523
+ "output": [
524
+ 2,
525
+ 2,
526
+ 2,
527
+ 2,
528
+ 2,
529
+ 2,
530
+ 2,
531
+ 2,
532
+ 2,
533
+ 2,
534
+ 2,
535
+ 2,
536
+ 2,
537
+ 2,
538
+ 2,
539
+ 2,
540
+ 2,
541
+ 2,
542
+ 2,
543
+ 2,
544
+ 2,
545
+ 2,
546
+ 1
547
+ ]
548
+ },
549
+ {
550
+ "input": [
551
+ "wtxtjwomvzrnojdcitibpsodcymjpzdunhavgkjsnzxwljkxmorcuuivhpifqnpytspdybhbedihgyuc",
552
+ "kxuuncqkmxbtgiuwgpniflxrbfdzacyzlsvjclwiqdgkupwqcjnjisuzrofpqoxvcbjgkekktxonfyafuwjhix",
553
+ [
554
+ 58,
555
+ 22,
556
+ 79,
557
+ 16,
558
+ 4,
559
+ 76,
560
+ 7,
561
+ 72,
562
+ 67,
563
+ 26,
564
+ 63,
565
+ 24,
566
+ 26,
567
+ 30,
568
+ 54,
569
+ 29,
570
+ 12,
571
+ 74,
572
+ 79,
573
+ 38,
574
+ 68,
575
+ 26,
576
+ 3,
577
+ 43,
578
+ 24,
579
+ 43,
580
+ 67,
581
+ 8,
582
+ 24,
583
+ 5,
584
+ 66,
585
+ 66,
586
+ 62,
587
+ 71,
588
+ 25,
589
+ 69,
590
+ 40,
591
+ 22,
592
+ 61,
593
+ 18,
594
+ 39,
595
+ 29,
596
+ 10,
597
+ 58,
598
+ 36,
599
+ 8,
600
+ 19,
601
+ 13,
602
+ 11,
603
+ 50,
604
+ 31,
605
+ 31,
606
+ 19,
607
+ 43,
608
+ 72,
609
+ 39,
610
+ 33,
611
+ 77,
612
+ 16,
613
+ 72,
614
+ 65,
615
+ 64,
616
+ 28,
617
+ 34,
618
+ 11,
619
+ 66,
620
+ 61,
621
+ 9,
622
+ 16,
623
+ 79,
624
+ 13,
625
+ 76,
626
+ 51,
627
+ 25,
628
+ 10,
629
+ 6,
630
+ 37,
631
+ 10,
632
+ 63,
633
+ 55,
634
+ 55,
635
+ 75,
636
+ 78,
637
+ 43,
638
+ 27,
639
+ 44
640
+ ]
641
+ ],
642
+ "output": [
643
+ 2,
644
+ 2,
645
+ 2,
646
+ 2,
647
+ 2,
648
+ 2,
649
+ 2,
650
+ 2,
651
+ 2,
652
+ 2,
653
+ 2,
654
+ 2,
655
+ 2,
656
+ 2,
657
+ 3,
658
+ 3,
659
+ 3,
660
+ 3,
661
+ 3,
662
+ 3,
663
+ 3,
664
+ 3,
665
+ 3,
666
+ 3,
667
+ 3,
668
+ 3,
669
+ 3,
670
+ 3,
671
+ 3,
672
+ 3,
673
+ 3,
674
+ 3,
675
+ 3,
676
+ 3,
677
+ 3,
678
+ 3,
679
+ 3,
680
+ 3,
681
+ 3,
682
+ 3,
683
+ 3,
684
+ 3,
685
+ 3,
686
+ 3,
687
+ 3,
688
+ 3,
689
+ 3,
690
+ 3,
691
+ 3,
692
+ 3,
693
+ 3,
694
+ 3,
695
+ 3,
696
+ 3,
697
+ 3,
698
+ 3,
699
+ 3,
700
+ 3,
701
+ 3,
702
+ 3,
703
+ 3,
704
+ 3,
705
+ 3,
706
+ 3,
707
+ 3,
708
+ 3,
709
+ 3,
710
+ 3,
711
+ 3,
712
+ 3,
713
+ 3,
714
+ 3,
715
+ 3,
716
+ 3,
717
+ 3,
718
+ 3,
719
+ 3,
720
+ 3,
721
+ 3,
722
+ 3,
723
+ 4,
724
+ 4,
725
+ 4,
726
+ 4,
727
+ 4,
728
+ 4
729
+ ]
730
+ },
731
+ {
732
+ "input": [
733
+ "wqunykjfmqseeq",
734
+ "uocqonbcyfxzmafouqdvbrkjgwjxhvvdpxjtexjtrxdwwyinifh",
735
+ [
736
+ 4,
737
+ 0,
738
+ 12,
739
+ 7,
740
+ 10,
741
+ 12,
742
+ 10,
743
+ 4,
744
+ 10,
745
+ 0,
746
+ 6,
747
+ 2,
748
+ 11,
749
+ 6,
750
+ 13,
751
+ 11,
752
+ 9,
753
+ 5,
754
+ 2,
755
+ 3,
756
+ 6,
757
+ 11,
758
+ 10,
759
+ 1,
760
+ 8,
761
+ 13,
762
+ 11,
763
+ 13,
764
+ 8,
765
+ 5,
766
+ 12,
767
+ 13,
768
+ 7,
769
+ 8,
770
+ 3,
771
+ 9,
772
+ 7,
773
+ 3,
774
+ 11,
775
+ 4,
776
+ 0,
777
+ 4,
778
+ 7,
779
+ 13,
780
+ 1,
781
+ 13,
782
+ 10,
783
+ 5,
784
+ 11,
785
+ 9,
786
+ 0
787
+ ]
788
+ ],
789
+ "output": [
790
+ 2,
791
+ 2,
792
+ 1,
793
+ 1,
794
+ 1,
795
+ 1,
796
+ 1,
797
+ 1,
798
+ 1,
799
+ 1,
800
+ 1,
801
+ 1,
802
+ 1,
803
+ 1,
804
+ 1,
805
+ 1,
806
+ 1,
807
+ 1,
808
+ 1,
809
+ 1,
810
+ 1,
811
+ 1,
812
+ 1,
813
+ 1,
814
+ 1,
815
+ 1,
816
+ 1,
817
+ 1,
818
+ 1,
819
+ 1,
820
+ 1,
821
+ 1,
822
+ 1,
823
+ 1,
824
+ 1,
825
+ 1,
826
+ 1,
827
+ 1,
828
+ 1,
829
+ 1,
830
+ 1,
831
+ 2,
832
+ 2,
833
+ 2,
834
+ 2,
835
+ 2,
836
+ 2,
837
+ 2,
838
+ 2,
839
+ 2,
840
+ 2
841
+ ]
842
+ },
843
+ {
844
+ "input": [
845
+ "ehkwhiiiltfqspihjbqcjljvicnahjcc",
846
+ "tumrciabnkakulboptzvlbtrwfwjcuesvtgkzgecixhhnjukbdsvjasbnydzdabvajvuxiehhrftlsrrwmafxajgksrrkk",
847
+ [
848
+ 18,
849
+ 11,
850
+ 21,
851
+ 3,
852
+ 17,
853
+ 17,
854
+ 14,
855
+ 31,
856
+ 30,
857
+ 9,
858
+ 25,
859
+ 17,
860
+ 21,
861
+ 20,
862
+ 14,
863
+ 21,
864
+ 11,
865
+ 9,
866
+ 9,
867
+ 8,
868
+ 30,
869
+ 23,
870
+ 20,
871
+ 7,
872
+ 18,
873
+ 14,
874
+ 24,
875
+ 8,
876
+ 8,
877
+ 22,
878
+ 5,
879
+ 21,
880
+ 4,
881
+ 13,
882
+ 22,
883
+ 3,
884
+ 8,
885
+ 16,
886
+ 28,
887
+ 6,
888
+ 25,
889
+ 11,
890
+ 3,
891
+ 26,
892
+ 11,
893
+ 20,
894
+ 18,
895
+ 15,
896
+ 20,
897
+ 31,
898
+ 19,
899
+ 11,
900
+ 28,
901
+ 5,
902
+ 21,
903
+ 4,
904
+ 21,
905
+ 15,
906
+ 20,
907
+ 8,
908
+ 8,
909
+ 13,
910
+ 31,
911
+ 14,
912
+ 23,
913
+ 19,
914
+ 9,
915
+ 27,
916
+ 30,
917
+ 4,
918
+ 30,
919
+ 11,
920
+ 21,
921
+ 25,
922
+ 19,
923
+ 17,
924
+ 20,
925
+ 1,
926
+ 23,
927
+ 18,
928
+ 26,
929
+ 4,
930
+ 17,
931
+ 17,
932
+ 16,
933
+ 2,
934
+ 19,
935
+ 4,
936
+ 1,
937
+ 4,
938
+ 9,
939
+ 29,
940
+ 4,
941
+ 15
942
+ ]
943
+ ],
944
+ "output": [
945
+ 3,
946
+ 3,
947
+ 3,
948
+ 3,
949
+ 3,
950
+ 3,
951
+ 3,
952
+ 3,
953
+ 3,
954
+ 3,
955
+ 3,
956
+ 3,
957
+ 3,
958
+ 3,
959
+ 3,
960
+ 3,
961
+ 3,
962
+ 3,
963
+ 3,
964
+ 3,
965
+ 3,
966
+ 3,
967
+ 3,
968
+ 2,
969
+ 2,
970
+ 2,
971
+ 2,
972
+ 2,
973
+ 2,
974
+ 2,
975
+ 1,
976
+ 1,
977
+ 1,
978
+ 1,
979
+ 1,
980
+ 2,
981
+ 2,
982
+ 2,
983
+ 2,
984
+ 2,
985
+ 2,
986
+ 2,
987
+ 2,
988
+ 2,
989
+ 2,
990
+ 2,
991
+ 2,
992
+ 2,
993
+ 2,
994
+ 2,
995
+ 2,
996
+ 2,
997
+ 2,
998
+ 2,
999
+ 2,
1000
+ 2,
1001
+ 2,
1002
+ 2,
1003
+ 2,
1004
+ 2,
1005
+ 2,
1006
+ 2,
1007
+ 2,
1008
+ 2,
1009
+ 2,
1010
+ 2,
1011
+ 2,
1012
+ 2,
1013
+ 2,
1014
+ 2,
1015
+ 2,
1016
+ 2,
1017
+ 2,
1018
+ 2,
1019
+ 2,
1020
+ 2,
1021
+ 2,
1022
+ 2,
1023
+ 2,
1024
+ 2,
1025
+ 2,
1026
+ 2,
1027
+ 2,
1028
+ 2,
1029
+ 2,
1030
+ 2,
1031
+ 2,
1032
+ 2,
1033
+ 2,
1034
+ 2,
1035
+ 2,
1036
+ 1,
1037
+ 1,
1038
+ 1
1039
+ ]
1040
+ }
1041
+ ],
1042
+ "haskell_template": "longestRepeating :: String -> String -> [Int] -> [Int]\nlongestRepeating s queryCharacters queryIndices ",
1043
+ "ocaml_template": "let longestRepeating (s: string) (queryCharacters: string) (queryIndices: int list) : int list = ",
1044
+ "scala_template": "def longestRepeating(s: String,queryCharacters: String,queryIndices: List[Int]): List[Int] = { \n \n}",
1045
+ "java_template": "public static List<Integer> longestRepeating(String s, String queryCharacters, List<Integer> queryIndices) {\n\n}",
1046
+ "python_template": "class Solution(object):\n def longestRepeating(self, s, queryCharacters, queryIndices):\n \"\"\"\n :type s: str\n :type queryCharacters: str\n :type queryIndices: List[int]\n :rtype: List[int]\n \"\"\"\n "
1047
+ }
longest_substring_of_one_repeating_character/ocaml_tests/main.ml ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ module Main = struct
3
+ open OUnit2
4
+
5
+ (* Program start *)
6
+
7
+ (* Program end *)
8
+
9
+ (* Test cases *)
10
+
11
+ let test1 _ = assert_equal [3;3;4] (longestRepeating "babacc" "bcb" [1;3;3])
12
+
13
+ let test2 _ = assert_equal [2;3] (longestRepeating "abyzz" "aa" [2;1])
14
+
15
+
16
+ (* Grouping test cases *)
17
+ let suite = "Test Suite for longestRepeating" >::: [
18
+
19
+ "test1" >:: test1;
20
+ "test2" >:: test2;
21
+ ]
22
+
23
+
24
+ (* Running the tests *)
25
+ let () = run_test_tt_main suite
26
+ end
longest_substring_of_one_repeating_character/scala_tests/MySuite.scala ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ class MySuite extends munit.FunSuite {
3
+
4
+ test("test1") {
5
+ assertEquals(Main.longestRepeating("babacc","bcb",[1,3,3]), List(3,3,4))
6
+ }
7
+
8
+ test("test2") {
9
+ assertEquals(Main.longestRepeating("abyzz","aa",[2,1]), List(2,3))
10
+ }
11
+
12
+ }
make_a_square_with_the_same_color/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(true, canMakeSquare(Arrays.asList(Arrays.asList("B","W","B"),Arrays.asList("B","W","W"),Arrays.asList("B","W","B"))));
14
+ }
15
+ @Test
16
+ public void test2() {
17
+ assertEquals(false, canMakeSquare(Arrays.asList(Arrays.asList("B","W","B"),Arrays.asList("W","B","W"),Arrays.asList("B","W","B"))));
18
+ }
19
+ @Test
20
+ public void test3() {
21
+ assertEquals(true, canMakeSquare(Arrays.asList(Arrays.asList("B","W","B"),Arrays.asList("B","W","W"),Arrays.asList("B","W","W"))));
22
+ }
23
+
24
+ }
make_array_zero_by_subtracting_equal_amounts/.DS_Store ADDED
Binary file (6.15 kB). View file
 
make_array_zero_by_subtracting_equal_amounts/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 (minimumOperations [1,5,0,3,5])," 3 (minimumOperations [1,5,0,3,5]))
13
+
14
+ test2 :: Test
15
+ test2 = TestCase (assertEqual "for (minimumOperations [0])," 0 (minimumOperations [0]))
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
make_array_zero_by_subtracting_equal_amounts/java_tests/Main.java ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import static org.junit.jupiter.api.Assertions.*;
3
+ import org.junit.jupiter.api.Test;
4
+ import java.util.List;
5
+ import java.util.Arrays;
6
+ import java.util.ArrayList;
7
+ public class Main {
8
+ //Program start
9
+
10
+ //Program end
11
+
12
+ @Test
13
+ public void test1() {
14
+ assertEquals(3, minimumOperations(new ArrayList<>(Arrays.asList(1,5,0,3,5))));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals(0, minimumOperations(new ArrayList<>(Arrays.asList(0))));
19
+ }
20
+
21
+ }
make_array_zero_by_subtracting_equal_amounts/meta.json ADDED
@@ -0,0 +1,523 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "id": 2436,
3
+ "name": "make_array_zero_by_subtracting_equal_amounts",
4
+ "difficulty": "Easy",
5
+ "link": "https://leetcode.com/problems/make-array-zero-by-subtracting-equal-amounts/",
6
+ "date": "1658620800000",
7
+ "task_description": "You are given a non-negative integer array `nums`. In one operation, you must: Choose a positive integer `x` such that `x` is less than or equal to the **smallest non-zero** element in `nums`. Subtract `x` from every **positive** element in `nums`. Return _the **minimum** number of operations to make every element in _`nums`_ equal to _`0`. **Example 1:** ``` **Input:** nums = [1,5,0,3,5] **Output:** 3 **Explanation:** In the first operation, choose x = 1. Now, nums = [0,4,0,2,4]. In the second operation, choose x = 2. Now, nums = [0,2,0,0,2]. In the third operation, choose x = 2. Now, nums = [0,0,0,0,0]. ``` **Example 2:** ``` **Input:** nums = [0] **Output:** 0 **Explanation:** Each element in nums is already 0 so no operations are needed. ``` **Constraints:** `1 <= nums.length <= 100` `0 <= nums[i] <= 100`",
8
+ "public_test_cases": [
9
+ {
10
+ "label": "Example 1",
11
+ "input": "nums = [1,5,0,3,5]",
12
+ "output": "3 "
13
+ },
14
+ {
15
+ "label": "Example 2",
16
+ "input": "nums = [0]",
17
+ "output": "0 "
18
+ }
19
+ ],
20
+ "private_test_cases": [
21
+ {
22
+ "input": [
23
+ 36,
24
+ 40,
25
+ 69,
26
+ 52,
27
+ 6,
28
+ 42,
29
+ 16,
30
+ 99,
31
+ 80,
32
+ 35,
33
+ 97,
34
+ 31,
35
+ 68,
36
+ 58,
37
+ 66,
38
+ 94,
39
+ 19,
40
+ 96,
41
+ 74,
42
+ 68,
43
+ 71,
44
+ 16,
45
+ 17,
46
+ 10,
47
+ 91,
48
+ 57,
49
+ 40,
50
+ 42,
51
+ 66,
52
+ 20,
53
+ 68,
54
+ 6,
55
+ 88,
56
+ 37
57
+ ],
58
+ "output": 27
59
+ },
60
+ {
61
+ "input": [
62
+ 46,
63
+ 44,
64
+ 31,
65
+ 50,
66
+ 39,
67
+ 46,
68
+ 29,
69
+ 25,
70
+ 70,
71
+ 36,
72
+ 0,
73
+ 69,
74
+ 90,
75
+ 30,
76
+ 84,
77
+ 83,
78
+ 23,
79
+ 11,
80
+ 2,
81
+ 80,
82
+ 91,
83
+ 87,
84
+ 27,
85
+ 27,
86
+ 51,
87
+ 68,
88
+ 38,
89
+ 78,
90
+ 39,
91
+ 45,
92
+ 68,
93
+ 66,
94
+ 49,
95
+ 94,
96
+ 91,
97
+ 28,
98
+ 41,
99
+ 19,
100
+ 33,
101
+ 82,
102
+ 92,
103
+ 90,
104
+ 30,
105
+ 81,
106
+ 63,
107
+ 63,
108
+ 52,
109
+ 24,
110
+ 43,
111
+ 57,
112
+ 78,
113
+ 80,
114
+ 86,
115
+ 3,
116
+ 76,
117
+ 72,
118
+ 88,
119
+ 40,
120
+ 85,
121
+ 55,
122
+ 29,
123
+ 92,
124
+ 30,
125
+ 75,
126
+ 58,
127
+ 3,
128
+ 92
129
+ ],
130
+ "output": 51
131
+ },
132
+ {
133
+ "input": [
134
+ 0,
135
+ 94,
136
+ 59,
137
+ 65,
138
+ 19,
139
+ 41,
140
+ 54,
141
+ 89,
142
+ 51,
143
+ 84,
144
+ 97,
145
+ 15,
146
+ 87,
147
+ 72,
148
+ 16,
149
+ 7,
150
+ 36,
151
+ 96,
152
+ 24,
153
+ 100,
154
+ 70,
155
+ 95,
156
+ 34,
157
+ 6,
158
+ 60,
159
+ 2,
160
+ 81,
161
+ 35,
162
+ 82,
163
+ 89,
164
+ 88,
165
+ 96,
166
+ 12,
167
+ 21,
168
+ 37,
169
+ 47,
170
+ 44,
171
+ 86,
172
+ 50,
173
+ 12,
174
+ 55,
175
+ 54,
176
+ 49,
177
+ 61,
178
+ 75
179
+ ],
180
+ "output": 40
181
+ },
182
+ {
183
+ "input": [
184
+ 69,
185
+ 47,
186
+ 89,
187
+ 11,
188
+ 21,
189
+ 14,
190
+ 79,
191
+ 56,
192
+ 45,
193
+ 83,
194
+ 79,
195
+ 61,
196
+ 39,
197
+ 72,
198
+ 36,
199
+ 87,
200
+ 25,
201
+ 50,
202
+ 81,
203
+ 89,
204
+ 24,
205
+ 55,
206
+ 72,
207
+ 33,
208
+ 26,
209
+ 89,
210
+ 13,
211
+ 43,
212
+ 2,
213
+ 23,
214
+ 95,
215
+ 78,
216
+ 53,
217
+ 70,
218
+ 13,
219
+ 41
220
+ ],
221
+ "output": 31
222
+ },
223
+ {
224
+ "input": [
225
+ 56,
226
+ 86,
227
+ 51,
228
+ 47,
229
+ 71,
230
+ 72,
231
+ 55,
232
+ 74,
233
+ 33,
234
+ 75,
235
+ 20,
236
+ 65,
237
+ 60,
238
+ 31,
239
+ 16,
240
+ 50,
241
+ 43,
242
+ 0,
243
+ 45,
244
+ 79,
245
+ 83,
246
+ 88,
247
+ 63,
248
+ 86,
249
+ 0,
250
+ 43,
251
+ 65
252
+ ],
253
+ "output": 22
254
+ },
255
+ {
256
+ "input": [
257
+ 26,
258
+ 11,
259
+ 29,
260
+ 100,
261
+ 28,
262
+ 59,
263
+ 10,
264
+ 53,
265
+ 71,
266
+ 90,
267
+ 41,
268
+ 12,
269
+ 86,
270
+ 3,
271
+ 55,
272
+ 35,
273
+ 74,
274
+ 1,
275
+ 64,
276
+ 100,
277
+ 25,
278
+ 54,
279
+ 38,
280
+ 74,
281
+ 4,
282
+ 10,
283
+ 25,
284
+ 41,
285
+ 99,
286
+ 84,
287
+ 36,
288
+ 45,
289
+ 67,
290
+ 81,
291
+ 25,
292
+ 78,
293
+ 71,
294
+ 89,
295
+ 66,
296
+ 17,
297
+ 6,
298
+ 51,
299
+ 28,
300
+ 5,
301
+ 42,
302
+ 16,
303
+ 98,
304
+ 26,
305
+ 6
306
+ ],
307
+ "output": 39
308
+ },
309
+ {
310
+ "input": [
311
+ 24,
312
+ 4,
313
+ 29,
314
+ 24,
315
+ 61,
316
+ 68,
317
+ 77,
318
+ 40,
319
+ 24,
320
+ 54,
321
+ 56,
322
+ 41,
323
+ 41,
324
+ 74,
325
+ 23,
326
+ 54,
327
+ 57,
328
+ 78,
329
+ 4,
330
+ 7,
331
+ 34,
332
+ 35,
333
+ 76,
334
+ 4,
335
+ 32,
336
+ 18,
337
+ 11,
338
+ 27,
339
+ 59,
340
+ 82,
341
+ 100,
342
+ 68
343
+ ],
344
+ "output": 25
345
+ },
346
+ {
347
+ "input": [
348
+ 16,
349
+ 22,
350
+ 93,
351
+ 97,
352
+ 5,
353
+ 77,
354
+ 47,
355
+ 76,
356
+ 98,
357
+ 71,
358
+ 18,
359
+ 17,
360
+ 95,
361
+ 0,
362
+ 33,
363
+ 84,
364
+ 12,
365
+ 83,
366
+ 66,
367
+ 54,
368
+ 28,
369
+ 47,
370
+ 1,
371
+ 43,
372
+ 39,
373
+ 26,
374
+ 82,
375
+ 86,
376
+ 88,
377
+ 96,
378
+ 75,
379
+ 26,
380
+ 34,
381
+ 8,
382
+ 56,
383
+ 96
384
+ ],
385
+ "output": 32
386
+ },
387
+ {
388
+ "input": [
389
+ 58,
390
+ 4,
391
+ 39,
392
+ 72,
393
+ 42,
394
+ 63,
395
+ 32,
396
+ 51,
397
+ 3,
398
+ 80,
399
+ 91,
400
+ 42,
401
+ 8,
402
+ 74,
403
+ 51,
404
+ 36,
405
+ 43,
406
+ 23,
407
+ 80,
408
+ 55,
409
+ 22,
410
+ 74,
411
+ 96,
412
+ 72,
413
+ 26,
414
+ 23,
415
+ 63,
416
+ 59,
417
+ 5,
418
+ 78,
419
+ 55,
420
+ 39,
421
+ 48,
422
+ 41,
423
+ 91,
424
+ 70,
425
+ 27,
426
+ 49,
427
+ 51,
428
+ 58,
429
+ 55,
430
+ 81,
431
+ 24,
432
+ 55,
433
+ 2,
434
+ 15,
435
+ 12,
436
+ 6,
437
+ 44,
438
+ 9,
439
+ 93,
440
+ 73,
441
+ 33,
442
+ 21,
443
+ 89,
444
+ 47,
445
+ 84,
446
+ 36,
447
+ 100,
448
+ 53,
449
+ 77,
450
+ 79,
451
+ 90,
452
+ 54
453
+ ],
454
+ "output": 49
455
+ },
456
+ {
457
+ "input": [
458
+ 43,
459
+ 83,
460
+ 39,
461
+ 100,
462
+ 9,
463
+ 9,
464
+ 5,
465
+ 55,
466
+ 85,
467
+ 0,
468
+ 75,
469
+ 8,
470
+ 3,
471
+ 100,
472
+ 60,
473
+ 31,
474
+ 37,
475
+ 79,
476
+ 30,
477
+ 48,
478
+ 27,
479
+ 40,
480
+ 29,
481
+ 45,
482
+ 50,
483
+ 89,
484
+ 22,
485
+ 99,
486
+ 54,
487
+ 24,
488
+ 16,
489
+ 91,
490
+ 51,
491
+ 36,
492
+ 7,
493
+ 88,
494
+ 94,
495
+ 0,
496
+ 100,
497
+ 11,
498
+ 57,
499
+ 44,
500
+ 52,
501
+ 53,
502
+ 75,
503
+ 2,
504
+ 42,
505
+ 14,
506
+ 99,
507
+ 67,
508
+ 81,
509
+ 21,
510
+ 49,
511
+ 16,
512
+ 29,
513
+ 46
514
+ ],
515
+ "output": 47
516
+ }
517
+ ],
518
+ "haskell_template": "minimumOperations :: [Int] -> Int\nminimumOperations nums ",
519
+ "ocaml_template": "let minimumOperations (nums: int list) : int = ",
520
+ "scala_template": "def minimumOperations(nums: List[Int]): Int = { \n \n}",
521
+ "java_template": "public static int minimumOperations(List<Integer> nums) {\n\n}",
522
+ "python_template": "class Solution(object):\n def minimumOperations(self, nums):\n \"\"\"\n :type nums: List[int]\n :rtype: int\n \"\"\"\n "
523
+ }
make_array_zero_by_subtracting_equal_amounts/ocaml_tests/main.ml ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ module Main = struct
3
+ open OUnit2
4
+
5
+ (* Program start *)
6
+
7
+ (* Program end *)
8
+
9
+ (* Test cases *)
10
+
11
+ let test1 _ = assert_equal 3 (minimumOperations [1;5;0;3;5])
12
+
13
+ let test2 _ = assert_equal 0 (minimumOperations [0])
14
+
15
+
16
+ (* Grouping test cases *)
17
+ let suite = "Test Suite for minimumOperations" >::: [
18
+
19
+ "test1" >:: test1;
20
+ "test2" >:: test2;
21
+ ]
22
+
23
+
24
+ (* Running the tests *)
25
+ let () = run_test_tt_main suite
26
+ end
make_array_zero_by_subtracting_equal_amounts/scala_tests/MySuite.scala ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ class MySuite extends munit.FunSuite {
3
+
4
+ test("test1") {
5
+ assertEquals(Main.minimumOperations(List(1,5,0,3,5)), 3)
6
+ }
7
+
8
+ test("test2") {
9
+ assertEquals(Main.minimumOperations(List(0)), 0)
10
+ }
11
+
12
+ }
make_costs_of_paths_equal_in_a_binary_tree/haskell_tests/Main.hs ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 (minIncrements 7 [1,5,2,2,3,3,1])," 6 (minIncrements 7 [1,5,2,2,3,3,1]))
13
+
14
+ test2 :: Test
15
+ test2 = TestCase (assertEqual "for (minIncrements 3 [5,3,3])," 0 (minIncrements 3 [5,3,3]))
16
+
17
+ test3 :: Test
18
+ test3 = TestCase (assertEqual "for (minIncrements 91 [54506, 46962, 38953, 44268, 33262, 30383, 27509, 19998, 38001, 19460, 26826, 12609, 23154, 14675, 20205, 12446, 16397, 28915, 24617, 16522, 11533, 17099, 11407, 11874, 8087, 13698, 12237, 6629, 6737, 12003, 5467, 10583, 7558, 14702, 11766, 6977, 19088, 9114, 19135, 15576, 13892, 9789, 9440, 13306, 8197, 9643, 1212, 4983, 7724, 582, 278, 1399, 6456, 1917, 5946, 2279, 4306, 4026, 4330, 6561, 8641, 2883, 4646, 4561, 3000, 3238, 2263, 4823, 9956, 718, 9141, 6650, 397, 4155, 9799, 7056, 6231, 481, 9191, 6726, 3293, 3811, 4447, 1263, 5865, 9388, 2130, 5726, 3192, 2083, 3226])," 213256 (minIncrements 91 [54506, 46962, 38953, 44268, 33262, 30383, 27509, 19998, 38001, 19460, 26826, 12609, 23154, 14675, 20205, 12446, 16397, 28915, 24617, 16522, 11533, 17099, 11407, 11874, 8087, 13698, 12237, 6629, 6737, 12003, 5467, 10583, 7558, 14702, 11766, 6977, 19088, 9114, 19135, 15576, 13892, 9789, 9440, 13306, 8197, 9643, 1212, 4983, 7724, 582, 278, 1399, 6456, 1917, 5946, 2279, 4306, 4026, 4330, 6561, 8641, 2883, 4646, 4561, 3000, 3238, 2263, 4823, 9956, 718, 9141, 6650, 397, 4155, 9799, 7056, 6231, 481, 9191, 6726, 3293, 3811, 4447, 1263, 5865, 9388, 2130, 5726, 3192, 2083, 3226]))
19
+
20
+ test4 :: Test
21
+ test4 = TestCase (assertEqual "for (minIncrements 25 [27629, 20639, 25908, 18529, 16808, 23533, 16713, 10878, 9752, 10779, 10392, 14828, 7821, 4110, 8126, 6440, 1090, 7087, 7556, 7911, 61, 4345, 2526, 4402, 7142])," 44574 (minIncrements 25 [27629, 20639, 25908, 18529, 16808, 23533, 16713, 10878, 9752, 10779, 10392, 14828, 7821, 4110, 8126, 6440, 1090, 7087, 7556, 7911, 61, 4345, 2526, 4402, 7142]))
22
+
23
+ test5 :: Test
24
+ test5 = TestCase (assertEqual "for (minIncrements 73 [46603, 45639, 25273, 38538, 25610, 22383, 24229, 31653, 15832, 13260, 16164, 14971, 15993, 22382, 17843, 24769, 17597, 11393, 14889, 10583, 3465, 8560, 6704, 14541, 5262, 7135, 15087, 13603, 12730, 17493, 4472, 10705, 16412, 17417, 8997, 10504, 2641, 9788, 1254, 7524, 2263, 2907, 1208, 3755, 5494, 272, 2384, 5053, 8238, 3541, 2081, 4761, 4239, 6505, 669, 4509, 2963, 3170, 3667, 9617, 6503, 257, 2932, 1824, 1449, 7869, 4881, 6890, 9355, 5120, 8726, 3749, 9999])," 186047 (minIncrements 73 [46603, 45639, 25273, 38538, 25610, 22383, 24229, 31653, 15832, 13260, 16164, 14971, 15993, 22382, 17843, 24769, 17597, 11393, 14889, 10583, 3465, 8560, 6704, 14541, 5262, 7135, 15087, 13603, 12730, 17493, 4472, 10705, 16412, 17417, 8997, 10504, 2641, 9788, 1254, 7524, 2263, 2907, 1208, 3755, 5494, 272, 2384, 5053, 8238, 3541, 2081, 4761, 4239, 6505, 669, 4509, 2963, 3170, 3667, 9617, 6503, 257, 2932, 1824, 1449, 7869, 4881, 6890, 9355, 5120, 8726, 3749, 9999]))
25
+
26
+ test6 :: Test
27
+ test6 = TestCase (assertEqual "for (minIncrements 77 [35837, 35040, 30337, 32331, 18373, 25627, 29796, 19741, 31305, 17457, 17625, 24040, 17924, 12926, 24562, 18305, 17576, 21709, 15425, 8527, 10359, 4255, 12368, 14500, 14728, 15374, 16566, 12774, 11771, 16975, 9511, 17613, 13898, 7023, 10463, 17393, 12405, 11455, 3779, 1112, 226, 2210, 8294, 3024, 3703, 234, 9571, 7353, 4456, 8263, 14, 3240, 9082, 9929, 5015, 7316, 9090, 5052, 6420, 7910, 463, 7156, 1603, 7796, 1239, 1078, 5634, 6734, 1569, 8549, 9821, 445, 7846, 6151, 1860, 3068, 4720])," 184902 (minIncrements 77 [35837, 35040, 30337, 32331, 18373, 25627, 29796, 19741, 31305, 17457, 17625, 24040, 17924, 12926, 24562, 18305, 17576, 21709, 15425, 8527, 10359, 4255, 12368, 14500, 14728, 15374, 16566, 12774, 11771, 16975, 9511, 17613, 13898, 7023, 10463, 17393, 12405, 11455, 3779, 1112, 226, 2210, 8294, 3024, 3703, 234, 9571, 7353, 4456, 8263, 14, 3240, 9082, 9929, 5015, 7316, 9090, 5052, 6420, 7910, 463, 7156, 1603, 7796, 1239, 1078, 5634, 6734, 1569, 8549, 9821, 445, 7846, 6151, 1860, 3068, 4720]))
28
+
29
+
30
+ -- Grouping test cases
31
+ tests :: Test
32
+ tests = TestList [TestLabel "Test1" test1, TestLabel "Test2" test2, TestLabel "Test3" test3, TestLabel "Test4" test4, TestLabel "Test5" test5]
33
+
34
+ -- Running the tests
35
+ main :: IO Counts
36
+ main = runTestTT tests
make_costs_of_paths_equal_in_a_binary_tree/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(6, minIncrements(7, new ArrayList<>(Arrays.asList(1,5,2,2,3,3,1))));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals(0, minIncrements(3, new ArrayList<>(Arrays.asList(5,3,3))));
19
+ }
20
+
21
+ }
make_costs_of_paths_equal_in_a_binary_tree/meta.json ADDED
@@ -0,0 +1,325 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "id": 2780,
3
+ "name": "make_costs_of_paths_equal_in_a_binary_tree",
4
+ "difficulty": "Medium",
5
+ "link": "https://leetcode.com/problems/make-costs-of-paths-equal-in-a-binary-tree/",
6
+ "date": "2023-04-30 00:00:00",
7
+ "task_description": "You are given an integer `n` representing the number of nodes in a **perfect binary tree** consisting of nodes numbered from `1` to `n`. The root of the tree is node `1` and each node `i` in the tree has two children where the left child is the node `2 * i` and the right child is `2 * i + 1`. Each node in the tree also has a **cost** represented by a given **0-indexed** integer array `cost` of size `n` where `cost[i]` is the cost of node `i + 1`. You are allowed to **increment** the cost of **any** node by `1` **any** number of times. Return _the **minimum** number of increments you need to make the cost of paths from the root to each **leaf** node equal_. **Note**: A **perfect binary tree **is a tree where each node, except the leaf nodes, has exactly 2 children. The **cost of a path** is the sum of costs of nodes in the path. **Example 1:** ``` **Input:** n = 7, cost = [1,5,2,2,3,3,1] **Output:** 6 **Explanation:** We can do the following increments: - Increase the cost of node 4 one time. - Increase the cost of node 3 three times. - Increase the cost of node 7 two times. Each path from the root to a leaf will have a total cost of 9. The total increments we did is 1 + 3 + 2 = 6. It can be shown that this is the minimum answer we can achieve. ``` **Example 2:** ``` **Input:** n = 3, cost = [5,3,3] **Output:** 0 **Explanation:** The two paths already have equal total costs, so no increments are needed. ``` **Constraints:** `3 <= n <= 105` `n + 1` is a power of `2` `cost.length == n` `1 <= cost[i] <= 104`",
8
+ "public_test_cases": [
9
+ {
10
+ "label": "Example 1",
11
+ "input": "n = 7, cost = [1,5,2,2,3,3,1]",
12
+ "output": "6 "
13
+ },
14
+ {
15
+ "label": "Example 2",
16
+ "input": "n = 3, cost = [5,3,3]",
17
+ "output": "0 "
18
+ }
19
+ ],
20
+ "private_test_cases": [
21
+ {
22
+ "input": [
23
+ 91,
24
+ [
25
+ 54506,
26
+ 46962,
27
+ 38953,
28
+ 44268,
29
+ 33262,
30
+ 30383,
31
+ 27509,
32
+ 19998,
33
+ 38001,
34
+ 19460,
35
+ 26826,
36
+ 12609,
37
+ 23154,
38
+ 14675,
39
+ 20205,
40
+ 12446,
41
+ 16397,
42
+ 28915,
43
+ 24617,
44
+ 16522,
45
+ 11533,
46
+ 17099,
47
+ 11407,
48
+ 11874,
49
+ 8087,
50
+ 13698,
51
+ 12237,
52
+ 6629,
53
+ 6737,
54
+ 12003,
55
+ 5467,
56
+ 10583,
57
+ 7558,
58
+ 14702,
59
+ 11766,
60
+ 6977,
61
+ 19088,
62
+ 9114,
63
+ 19135,
64
+ 15576,
65
+ 13892,
66
+ 9789,
67
+ 9440,
68
+ 13306,
69
+ 8197,
70
+ 9643,
71
+ 1212,
72
+ 4983,
73
+ 7724,
74
+ 582,
75
+ 278,
76
+ 1399,
77
+ 6456,
78
+ 1917,
79
+ 5946,
80
+ 2279,
81
+ 4306,
82
+ 4026,
83
+ 4330,
84
+ 6561,
85
+ 8641,
86
+ 2883,
87
+ 4646,
88
+ 4561,
89
+ 3000,
90
+ 3238,
91
+ 2263,
92
+ 4823,
93
+ 9956,
94
+ 718,
95
+ 9141,
96
+ 6650,
97
+ 397,
98
+ 4155,
99
+ 9799,
100
+ 7056,
101
+ 6231,
102
+ 481,
103
+ 9191,
104
+ 6726,
105
+ 3293,
106
+ 3811,
107
+ 4447,
108
+ 1263,
109
+ 5865,
110
+ 9388,
111
+ 2130,
112
+ 5726,
113
+ 3192,
114
+ 2083,
115
+ 3226
116
+ ]
117
+ ],
118
+ "output": 213256
119
+ },
120
+ {
121
+ "input": [
122
+ 25,
123
+ [
124
+ 27629,
125
+ 20639,
126
+ 25908,
127
+ 18529,
128
+ 16808,
129
+ 23533,
130
+ 16713,
131
+ 10878,
132
+ 9752,
133
+ 10779,
134
+ 10392,
135
+ 14828,
136
+ 7821,
137
+ 4110,
138
+ 8126,
139
+ 6440,
140
+ 1090,
141
+ 7087,
142
+ 7556,
143
+ 7911,
144
+ 61,
145
+ 4345,
146
+ 2526,
147
+ 4402,
148
+ 7142
149
+ ]
150
+ ],
151
+ "output": 44574
152
+ },
153
+ {
154
+ "input": [
155
+ 73,
156
+ [
157
+ 46603,
158
+ 45639,
159
+ 25273,
160
+ 38538,
161
+ 25610,
162
+ 22383,
163
+ 24229,
164
+ 31653,
165
+ 15832,
166
+ 13260,
167
+ 16164,
168
+ 14971,
169
+ 15993,
170
+ 22382,
171
+ 17843,
172
+ 24769,
173
+ 17597,
174
+ 11393,
175
+ 14889,
176
+ 10583,
177
+ 3465,
178
+ 8560,
179
+ 6704,
180
+ 14541,
181
+ 5262,
182
+ 7135,
183
+ 15087,
184
+ 13603,
185
+ 12730,
186
+ 17493,
187
+ 4472,
188
+ 10705,
189
+ 16412,
190
+ 17417,
191
+ 8997,
192
+ 10504,
193
+ 2641,
194
+ 9788,
195
+ 1254,
196
+ 7524,
197
+ 2263,
198
+ 2907,
199
+ 1208,
200
+ 3755,
201
+ 5494,
202
+ 272,
203
+ 2384,
204
+ 5053,
205
+ 8238,
206
+ 3541,
207
+ 2081,
208
+ 4761,
209
+ 4239,
210
+ 6505,
211
+ 669,
212
+ 4509,
213
+ 2963,
214
+ 3170,
215
+ 3667,
216
+ 9617,
217
+ 6503,
218
+ 257,
219
+ 2932,
220
+ 1824,
221
+ 1449,
222
+ 7869,
223
+ 4881,
224
+ 6890,
225
+ 9355,
226
+ 5120,
227
+ 8726,
228
+ 3749,
229
+ 9999
230
+ ]
231
+ ],
232
+ "output": 186047
233
+ },
234
+ {
235
+ "input": [
236
+ 77,
237
+ [
238
+ 35837,
239
+ 35040,
240
+ 30337,
241
+ 32331,
242
+ 18373,
243
+ 25627,
244
+ 29796,
245
+ 19741,
246
+ 31305,
247
+ 17457,
248
+ 17625,
249
+ 24040,
250
+ 17924,
251
+ 12926,
252
+ 24562,
253
+ 18305,
254
+ 17576,
255
+ 21709,
256
+ 15425,
257
+ 8527,
258
+ 10359,
259
+ 4255,
260
+ 12368,
261
+ 14500,
262
+ 14728,
263
+ 15374,
264
+ 16566,
265
+ 12774,
266
+ 11771,
267
+ 16975,
268
+ 9511,
269
+ 17613,
270
+ 13898,
271
+ 7023,
272
+ 10463,
273
+ 17393,
274
+ 12405,
275
+ 11455,
276
+ 3779,
277
+ 1112,
278
+ 226,
279
+ 2210,
280
+ 8294,
281
+ 3024,
282
+ 3703,
283
+ 234,
284
+ 9571,
285
+ 7353,
286
+ 4456,
287
+ 8263,
288
+ 14,
289
+ 3240,
290
+ 9082,
291
+ 9929,
292
+ 5015,
293
+ 7316,
294
+ 9090,
295
+ 5052,
296
+ 6420,
297
+ 7910,
298
+ 463,
299
+ 7156,
300
+ 1603,
301
+ 7796,
302
+ 1239,
303
+ 1078,
304
+ 5634,
305
+ 6734,
306
+ 1569,
307
+ 8549,
308
+ 9821,
309
+ 445,
310
+ 7846,
311
+ 6151,
312
+ 1860,
313
+ 3068,
314
+ 4720
315
+ ]
316
+ ],
317
+ "output": 184902
318
+ }
319
+ ],
320
+ "haskell_template": "minIncrements :: Int -> [Int] -> Int\nminIncrements n cost ",
321
+ "ocaml_template": "let minIncrements (n: int) (cost: int list) : int = ",
322
+ "scala_template": "def minIncrements(n: Int,cost: List[Int]): Int = { \n \n}",
323
+ "java_template": "class Solution {\n public int minIncrements(int n, int[] cost) {\n \n }\n}",
324
+ "python_template": "class Solution(object):\n def minIncrements(self, n, cost):\n \"\"\"\n :type n: int\n :type cost: List[int]\n :rtype: int\n \"\"\"\n "
325
+ }
make_costs_of_paths_equal_in_a_binary_tree/ocaml_tests/main.ml ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 6 (minIncrements 7 [1;5;2;2;3;3;1])
12
+
13
+ let test2 _ = assert_equal 0 (minIncrements 3 [5;3;3])
14
+
15
+ let test3 _ = assert_equal 213256 (minIncrements 91 [54506; 46962; 38953; 44268; 33262; 30383; 27509; 19998; 38001; 19460; 26826; 12609; 23154; 14675; 20205; 12446; 16397; 28915; 24617; 16522; 11533; 17099; 11407; 11874; 8087; 13698; 12237; 6629; 6737; 12003; 5467; 10583; 7558; 14702; 11766; 6977; 19088; 9114; 19135; 15576; 13892; 9789; 9440; 13306; 8197; 9643; 1212; 4983; 7724; 582; 278; 1399; 6456; 1917; 5946; 2279; 4306; 4026; 4330; 6561; 8641; 2883; 4646; 4561; 3000; 3238; 2263; 4823; 9956; 718; 9141; 6650; 397; 4155; 9799; 7056; 6231; 481; 9191; 6726; 3293; 3811; 4447; 1263; 5865; 9388; 2130; 5726; 3192; 2083; 3226])
16
+
17
+ let test4 _ = assert_equal 44574 (minIncrements 25 [27629; 20639; 25908; 18529; 16808; 23533; 16713; 10878; 9752; 10779; 10392; 14828; 7821; 4110; 8126; 6440; 1090; 7087; 7556; 7911; 61; 4345; 2526; 4402; 7142])
18
+
19
+ let test5 _ = assert_equal 186047 (minIncrements 73 [46603; 45639; 25273; 38538; 25610; 22383; 24229; 31653; 15832; 13260; 16164; 14971; 15993; 22382; 17843; 24769; 17597; 11393; 14889; 10583; 3465; 8560; 6704; 14541; 5262; 7135; 15087; 13603; 12730; 17493; 4472; 10705; 16412; 17417; 8997; 10504; 2641; 9788; 1254; 7524; 2263; 2907; 1208; 3755; 5494; 272; 2384; 5053; 8238; 3541; 2081; 4761; 4239; 6505; 669; 4509; 2963; 3170; 3667; 9617; 6503; 257; 2932; 1824; 1449; 7869; 4881; 6890; 9355; 5120; 8726; 3749; 9999])
20
+
21
+ let test6 _ = assert_equal 184902 (minIncrements 77 [35837; 35040; 30337; 32331; 18373; 25627; 29796; 19741; 31305; 17457; 17625; 24040; 17924; 12926; 24562; 18305; 17576; 21709; 15425; 8527; 10359; 4255; 12368; 14500; 14728; 15374; 16566; 12774; 11771; 16975; 9511; 17613; 13898; 7023; 10463; 17393; 12405; 11455; 3779; 1112; 226; 2210; 8294; 3024; 3703; 234; 9571; 7353; 4456; 8263; 14; 3240; 9082; 9929; 5015; 7316; 9090; 5052; 6420; 7910; 463; 7156; 1603; 7796; 1239; 1078; 5634; 6734; 1569; 8549; 9821; 445; 7846; 6151; 1860; 3068; 4720])
22
+
23
+
24
+ (* Grouping test cases *)
25
+ let suite = "Test Suite for minIncrements" >::: [
26
+
27
+ "test1" >:: test1;
28
+ "test2" >:: test2;
29
+ "test3" >:: test3;
30
+ "test4" >:: test4;
31
+ "test5" >:: test5;
32
+ "test6" >:: test6;
33
+ ]
34
+
35
+
36
+ (* Running the tests *)
37
+ let () = run_test_tt_main suite
38
+ end
make_costs_of_paths_equal_in_a_binary_tree/scala_tests/MySuite.scala ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ class MySuite extends munit.FunSuite {
3
+
4
+ test("test1") {
5
+ assertEquals(Main.minIncrements(7,List(1,5,2,2,3,3,1)), 6)
6
+ }
7
+
8
+ test("test2") {
9
+ assertEquals(Main.minIncrements(3,List(5,3,3)), 0)
10
+ }
11
+
12
+ test("test3") {
13
+ assertEquals(Main.minIncrements(91,List(54506, 46962, 38953, 44268, 33262, 30383, 27509, 19998, 38001, 19460, 26826, 12609, 23154, 14675, 20205, 12446, 16397, 28915, 24617, 16522, 11533, 17099, 11407, 11874, 8087, 13698, 12237, 6629, 6737, 12003, 5467, 10583, 7558, 14702, 11766, 6977, 19088, 9114, 19135, 15576, 13892, 9789, 9440, 13306, 8197, 9643, 1212, 4983, 7724, 582, 278, 1399, 6456, 1917, 5946, 2279, 4306, 4026, 4330, 6561, 8641, 2883, 4646, 4561, 3000, 3238, 2263, 4823, 9956, 718, 9141, 6650, 397, 4155, 9799, 7056, 6231, 481, 9191, 6726, 3293, 3811, 4447, 1263, 5865, 9388, 2130, 5726, 3192, 2083, 3226)), 213256)
14
+ }
15
+
16
+ test("test4") {
17
+ assertEquals(Main.minIncrements(25,List(27629, 20639, 25908, 18529, 16808, 23533, 16713, 10878, 9752, 10779, 10392, 14828, 7821, 4110, 8126, 6440, 1090, 7087, 7556, 7911, 61, 4345, 2526, 4402, 7142)), 44574)
18
+ }
19
+
20
+ test("test5") {
21
+ assertEquals(Main.minIncrements(73,List(46603, 45639, 25273, 38538, 25610, 22383, 24229, 31653, 15832, 13260, 16164, 14971, 15993, 22382, 17843, 24769, 17597, 11393, 14889, 10583, 3465, 8560, 6704, 14541, 5262, 7135, 15087, 13603, 12730, 17493, 4472, 10705, 16412, 17417, 8997, 10504, 2641, 9788, 1254, 7524, 2263, 2907, 1208, 3755, 5494, 272, 2384, 5053, 8238, 3541, 2081, 4761, 4239, 6505, 669, 4509, 2963, 3170, 3667, 9617, 6503, 257, 2932, 1824, 1449, 7869, 4881, 6890, 9355, 5120, 8726, 3749, 9999)), 186047)
22
+ }
23
+
24
+ test("test6") {
25
+ assertEquals(Main.minIncrements(77,List(35837, 35040, 30337, 32331, 18373, 25627, 29796, 19741, 31305, 17457, 17625, 24040, 17924, 12926, 24562, 18305, 17576, 21709, 15425, 8527, 10359, 4255, 12368, 14500, 14728, 15374, 16566, 12774, 11771, 16975, 9511, 17613, 13898, 7023, 10463, 17393, 12405, 11455, 3779, 1112, 226, 2210, 8294, 3024, 3703, 234, 9571, 7353, 4456, 8263, 14, 3240, 9082, 9929, 5015, 7316, 9090, 5052, 6420, 7910, 463, 7156, 1603, 7796, 1239, 1078, 5634, 6734, 1569, 8549, 9821, 445, 7846, 6151, 1860, 3068, 4720)), 184902)
26
+ }
27
+
28
+ }
make_k_subarray_sums_equal/.DS_Store ADDED
Binary file (6.15 kB). View file
 
make_k_subarray_sums_equal/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 (makeSubKSumEqual [1,4,1,3] 2)," 1 (makeSubKSumEqual [1,4,1,3] 2))
13
+
14
+ test2 :: Test
15
+ test2 = TestCase (assertEqual "for (makeSubKSumEqual [2,5,5,7] 3)," 5 (makeSubKSumEqual [2,5,5,7] 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
make_k_subarray_sums_equal/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, makeSubKSumEqual(new ArrayList<>(Arrays.asList(1,4,1,3)), 2));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals(5, makeSubKSumEqual(new ArrayList<>(Arrays.asList(2,5,5,7)), 3));
19
+ }
20
+
21
+ }
make_k_subarray_sums_equal/meta.json ADDED
The diff for this file is too large to render. See raw diff
 
make_k_subarray_sums_equal/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 (makeSubKSumEqual [1;4;1;3] 2)
12
+
13
+ let test2 _ = assert_equal 5 (makeSubKSumEqual [2;5;5;7] 3)
14
+
15
+
16
+ (* Grouping test cases *)
17
+ let suite = "Test Suite for makeSubKSumEqual" >::: [
18
+
19
+ "test1" >:: test1;
20
+ "test2" >:: test2;
21
+ ]
22
+
23
+
24
+ (* Running the tests *)
25
+ let () = run_test_tt_main suite
26
+ end
make_k_subarray_sums_equal/scala_tests/MySuite.scala ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ class MySuite extends munit.FunSuite {
3
+
4
+ test("test1") {
5
+ assertEquals(Main.makeSubKSumEqual(List(1,4,1,3),2), 1)
6
+ }
7
+
8
+ test("test2") {
9
+ assertEquals(Main.makeSubKSumEqual(List(2,5,5,7),3), 5)
10
+ }
11
+
12
+ }
make_number_of_distinct_characters_equal/.DS_Store ADDED
Binary file (6.15 kB). View file
 
make_number_of_distinct_characters_equal/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 (isItPossible \"ac \" \"b \")," False (isItPossible "ac" "b"))
13
+
14
+ test2 :: Test
15
+ test2 = TestCase (assertEqual "for (isItPossible \"abcc \" \"aab \")," True (isItPossible "abcc" "aab"))
16
+
17
+ test3 :: Test
18
+ test3 = TestCase (assertEqual "for (isItPossible \"abcde \" \"fghij \")," True (isItPossible "abcde" "fghij"))
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
make_number_of_distinct_characters_equal/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(false, isItPossible("ac", "b"));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals(true, isItPossible("abcc", "aab"));
19
+ }
20
+ @Test
21
+ public void test3() {
22
+ assertEquals(true, isItPossible("abcde", "fghij"));
23
+ }
24
+
25
+ }
make_number_of_distinct_characters_equal/meta.json ADDED
The diff for this file is too large to render. See raw diff
 
make_number_of_distinct_characters_equal/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 false (isItPossible "ac" "b")
12
+
13
+ let test2 _ = assert_equal true (isItPossible "abcc" "aab")
14
+
15
+ let test3 _ = assert_equal true (isItPossible "abcde" "fghij")
16
+
17
+
18
+ (* Grouping test cases *)
19
+ let suite = "Test Suite for isItPossible" >::: [
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
make_number_of_distinct_characters_equal/scala_tests/MySuite.scala ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ class MySuite extends munit.FunSuite {
3
+
4
+ test("test1") {
5
+ assertEquals(Main.isItPossible("ac","b"), false)
6
+ }
7
+
8
+ test("test2") {
9
+ assertEquals(Main.isItPossible("abcc","aab"), true)
10
+ }
11
+
12
+ test("test3") {
13
+ assertEquals(Main.isItPossible("abcde","fghij"), true)
14
+ }
15
+
16
+ }
make_string_a_subsequence_using_cyclic_increments/haskell_tests/Main.hs ADDED
The diff for this file is too large to render. See raw diff
 
make_string_a_subsequence_using_cyclic_increments/java_tests/Main.java ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import static org.junit.jupiter.api.Assertions.*;
3
+ import org.junit.jupiter.api.Test;
4
+ import java.util.List;
5
+ import java.util.Arrays;
6
+ import java.util.ArrayList;
7
+ public class Main {
8
+ //Program start
9
+
10
+ //Program end
11
+
12
+ @Test
13
+ public void test1() {
14
+ assertEquals(true, canMakeSubsequence("abc", "ad"));
15
+ }
16
+ @Test
17
+ public void test2() {
18
+ assertEquals(true, canMakeSubsequence("zc", "ad"));
19
+ }
20
+ @Test
21
+ public void test3() {
22
+ assertEquals(false, canMakeSubsequence("ab", "d"));
23
+ }
24
+
25
+ }