online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
/****************************************************************************** Welcome to GDB Online. GDB online is an online compiler and debugger tool for C, C++, Python, Java, PHP, Ruby, Perl, C#, OCaml, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly, HTML, CSS, JS, SQLite, Prolog. Code, Compile, Run and Debug online from anywhere in world. *******************************************************************************/ #include <iostream> #include <vector> using namespace std; vector<int> getMaxSubArr(const vector<int> &arr) { if (arr.empty()) return {}; int start = 0, end = 0, start_tmp = 0; int curMax = std::numeric_limits<int>::min(); int curSum = arr[0]; for (int i = 1; i < arr.size(); ++i) { if (arr[i] > arr[i-1]) { curSum += arr[i]; } else { if (curSum > curMax) { curMax = curSum; end = i; start = start_tmp; } start_tmp = i; curSum = arr[i]; } } return vector<int>(arr.begin() + start, arr.begin() + end); } int main() { vector<int> arr = {1,3,2,8,10,12,7,29,6,6,30}; auto ret = getMaxSubArr(arr); for (auto x : ret) cout<<x<<" "; cout<<endl; return 0; }

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text
×

                

                

Program is not being debugged. Click "Debug" button to start program in debug mode.

#FunctionFile:Line
VariableValue
RegisterValue
ExpressionValue