Skip to content

Code passes system test on arena, but fails with topcoditor #3

Description

@shivshnkr

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions