Most of us are addicted to using global variables, and arrays and also assign it value at global scope. Such codes give an incorrect response when using topcoditor.
Example: Find the minimum element in an vector a;
#include <iostream>
using namespace std;
int glo = 1e9;
class FindMin {
int getMin(vector <int> a)
{
int n = a.size();
for (int i = 0; i < n; i++) {
glo = min (glo, a[i]);
}
return glo;
}
};
Such a code passes system test on Topcoder arena practice rooms, but fails here.