MCPcopy Index your code
hub / github.com/Seogeurim/CS-study / lis

Function lis

contents/algorithm/code/lis_brute.cpp:13–35  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11
12
13int lis(vector<int> arr) {
14
15 if(arr.empty()) return 0;
16
17 int len = arr.size(), answer = 1;
18
19 for(int i=0; i < len; i++) {
20
21 vector<int> next;
22
23 for(int j=i+1; j < len; j++) {
24
25 if(arr[j] > arr[i]) next.push_back(arr[j]);
26
27 }
28
29 answer = max(answer, 1 + lis(next));
30
31 }
32
33 return answer;
34
35}
36
37
38int main(){

Callers

nothing calls this directly

Calls 1

sizeMethod · 0.65

Tested by

no test coverage detected