✅ [C++] EASY Solution || LIS+Slight Modification
Just the Longest Increasing Subsequence Code+ Slight modification.\nWe need continuous LIS which means difference between adjacent index should be 1. That\'s it
Just the ***Longest Increasing Subsequence Code+ Slight modification.***\nWe need ***continuous LIS*** which means difference between adjacent index should be 1. That\'s it \uD83D\uDE42\n```\nclass Solution {\npublic:\n    int findLengthOfLCIS(vector<int>& nums) {\n        int n=nums.size();\n        vector<vector<int>>dp(n+1,vector<int>(n+1,0));\n        for(int ind=n-1;ind>=0;ind--){\n            for(int prev_ind=ind-1;prev_ind>=-1;prev_ind--){\n                int len=dp[ind+1][prev_ind+1];\n                if(prev_ind==-1 || nums[ind]>nums[prev_ind]) {\n                    if(ind-prev==1)   // Here we add the condition, rest code is same as of LIS\n                    len= max(len,1+dp[ind+1][ind+1]);\n                }\n                dp[ind][prev_ind+1]=len;\n            }\n        }\n                \n        return dp[0][0];\n    }\n};\n```\nThanks \nNitin Manoj
['Dynamic Programming']