easy c++ sol
class Solution {\npublic:\n    int minSumOfLengths(vector& arr, int target) {\n        \n        int start=0;\n        int len=INT_MAX;\n        \n        int n
class Solution {\npublic:\n    int minSumOfLengths(vector<int>& arr, int target) {\n        \n        int start=0;\n        int len=INT_MAX;\n        \n        int n=arr.size();\n        \n        int sum=0;\n        int res=INT_MAX;\n        \n        vector<int> dp(n,INT_MAX);\n        \n        for(int end=0;end<n;end++)\n        {\n            sum+=arr[end];\n            \n            while(sum>target)\n            {\n                sum-=arr[start];\n                start++;\n            }\n            \n            if(sum==target)\n            {\n                int curlen=end-start+1;\n                \n                if(start>0  &&   dp[start-1]!=INT_MAX)\n                {\n                    res=min(curlen+dp[start-1],res);\n                }\n                \n                len=min(curlen,len);\n            }\n            \n            dp[end]=len;\n            \n        }\n        \n        if(res==INT_MAX)\n            return -1;\n        \n        \n        return res;\n        \n    }\n};
['Dynamic Programming', 'C']