prefix sum application
\nclass Solution {\npublic:\n    int minSumOfLengths(vector<int>& a, int t) {\n        \n        unordered_map<int,int> mp;\n        \n        mp[0] = -1;\n    
```\nclass Solution {\npublic:\n    int minSumOfLengths(vector<int>& a, int t) {\n        \n        unordered_map<int,int> mp;\n        \n        mp[0] = -1;\n        int sum = 0;\n        int lsz = INT_MAX;\n        int res = INT_MAX;\n        int n = a.size();\n        \n        for(int i=0;i<n;i++)\n        {\n            sum+=a[i];\n            mp[sum] = i; \n        }\n        \n        sum = 0;\n        for(int i=0;i<n;i++)\n        {\n            sum+=a[i];\n            if(mp.find(sum-t)!=mp.end())\n            {\n                lsz = min(lsz,i-mp[sum-t]);\n            }\n            \n            \n            if(mp.find(sum+t)!=mp.end() && lsz !=INT_MAX)\n            {\n                res = min(res,mp[sum+t]-i + lsz );\n            }\n        }\n        \n        return res==INT_MAX?-1:res;\n    }\n};\n```
['C']