| 11 | |
| 12 | |
| 13 | int 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 | |
| 38 | int main(){ |