MCPcopy Create free account
hub / github.com/careercup/ctci / seqWithMaxLength

Method seqWithMaxLength

java/Chapter 11/Question11_7/Question.java:9–16  ·  view source on GitHub ↗
(ArrayList<HtWt> seq1, ArrayList<HtWt> seq2)

Source from the content-addressed store, hash-verified

7
8 // Returns longer sequence
9 private static ArrayList<HtWt> seqWithMaxLength(ArrayList<HtWt> seq1, ArrayList<HtWt> seq2) {
10 if (seq1 == null) {
11 return seq2;
12 } else if (seq2 == null) {
13 return seq1;
14 }
15 return seq1.size() > seq2.size() ? seq1 : seq2;
16 }
17
18 private static void longestIncreasingSubsequence(ArrayList<HtWt> array, ArrayList<HtWt>[] solutions, int current_index) {
19 if (current_index >= array.size() || current_index < 0) {

Callers 1

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected