C++ | Just need some quick help

Hey guys so I've just started learning C++ and thought id jump in and have a crack at one of the problems on here. Anyway my codes below and works but It is giving me a wack runtime error. If someone could let me know where im going wrong thatd be real good. ~ Thanks

class Solution {
public:
    vector<int> twoSum(vector<int>& nums, int target) {
        for (int i = 0; i < nums.size(); i++)
            for (int j = 1; j < nums.size(); j++)
                if (nums[i] + nums[i+j] == target) {
            cout << "[" << i << ", " << i+j << "].";
            }
        return {};
    }
};
Comments (1)