c++ using kadane algo
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:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\nlong long kadane(vector<int> &arr,int n,int k)\n{\n\tlong long sum=0,maxi=INT_MIN;\n\tfor(int i=0;i<n*k;i++)\n\t{\n\t\tsum+=arr[i%n];\n\t\tmaxi=max(maxi,sum);\n\t\tif(sum<0)\n\t\t{\n\t\t\tsum=0;\n\t\t}\n\t}\n\treturn maxi;\n\n}\n    long long kConcatenationMaxSum(vector<int>& arr, int k) {\n        int n=arr.size();\n        long long maxSubsum;\n\t if (k == 1) {\n                        maxSubsum=kadane(arr, n, k);\n\t\t\t\t\t\t\t\t\t\t\t\tif(maxSubsum<0)\n\t\t\t\t\t\t\t\t\t\t\t\treturn 0;\n\t\t\t\t\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\n                                    return maxSubsum%1000000007;\n\t\t\t\t\t\t\t\t\t\t\t\t}\n                }\n\tint arrSum = 0;\n\t\tfor (int i=0;i<n;i++) {\n\t\t\tarrSum += arr[i];\n\t\t}\n\n               \n                if (arrSum <= 0) {\n                        maxSubsum=kadane(arr, n, 2);\n\t\t\t\t\t\t\t\t\t\t\t\tif(maxSubsum<0)\n\t\t\t\t\t\t\t\t\t\t\t\treturn 0;\n\t\t\t\t\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\n                                          return maxSubsum%1000000007;\n\t\t\t\t\t\t\t\t\t\t\t\t}\n                } \n\t\t\t\telse {\n                        maxSubsum=kadane(arr,n,2);\n\t\t\t\t\t\tmaxSubsum+=(long long)(k-2)*(long long)arrSum;\n\t\t\t\t\t\tif(maxSubsum<0)\n\t\t\t\t\t\treturn 0;\n\t\t\t\t\t\telse\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\treturn maxSubsum%1000000007;\n\t\t\t\t\t\t}\n                }\n    }\n};\n```
['C++']