Easy c++ solution
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity: O(N)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(1)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\n// class Solution {\n// public:\n// const int mod=1e9+7;\n//     int kConcatenationMaxSum(vector<int>& arr, int k) {\n//         long long sum=0,i,n=arr.size(),curr=0,maxi=0;\n// vector<long long> pref(n,0);\n// pref[0]=arr[0];\n// for(i=1;i<n;i++){\n//     pref[i]=(pref[i-1]+arr[i])%mod;\n// }\n//         for(i=0;i<n;i++){\n//             curr=(curr+arr[i])%mod;\n//             sum=(sum+arr[i])%mod;\n\n//             if(curr<0){\n//                 maxi=max(maxi,curr);\n//                 curr=0;\n//             }\n//         }\n//         long long all=(sum*k)%mod,ans=0,pre=INT_MIN,suf=INT_MIN;\n\n//         for(i=1;i<n;i++){\n//             // ans=max(ans,pref)\n//             pre=max(pre,pref[i]);\n//             suf=max(suf,pref[n-1-i]);\n//         }\n\n//         long long z=pre+suf+(k-2)*sum;\n//         maxi=max({maxi,all,z});\n\n//         return maxi;\n        \n//     }\n// };\n\n\n\n#include <vector>\nusing namespace std;\n\nclass Solution {\npublic:\n    const int MOD = 1e9 + 7;\n\n    int kConcatenationMaxSum(vector<int>& arr, int k) {\n        int n = arr.size();\n        long long sum = 0, maxSum = 0, currSum = 0;\n\n        // Calculate the sum of elements in the array\n        for (int i = 0; i < n; ++i) {\n            sum += arr[i];\n        }\n\n        // Find the maximum sub-array sum in a single array\n        for (int i = 0; i < n * min(k, 2); ++i) {\n            currSum = max(1LL * arr[i % n], currSum + arr[i % n]);\n            maxSum = max(maxSum, currSum);\n        }\n\n        // If k is greater than 2, calculate the maximum sub-array sum in the concatenated array\n        if (k > 2) {\n            maxSum = max(maxSum, sum * (k - 2) + maxSum);\n        }\n\n        return maxSum % MOD;\n    }\n};\n\n```
['C++']