• + 0 comments

    terminate called after throwing an instance of 'std::out_of_range' what(): vector::_M_range_check: __n (which is 2) >= this->size() (which is 2) Reading symbols from Solution...done. [New LWP 497118] Core was generated by `./Solution'. Program terminated with signal SIGABRT, Aborted.

    why i got this error on c++11 and c++20? btw this is my code

    int connectingTowns(int n, vector<int> routes) {
        int res = 1;
        for (int i= 0; i < n; i++) {
            res = res * routes.at(i);
        }
        return (res % 1234567);
    }