Can someone please tell me why is this program showing runtime error?
class Solution {
public:
    vector<int> twoSum(vector<int>& nums, int target) {
        int arr[5] = {2,3,4,5,6};
    
    for(int i = 0; i<5; i++){
        for(int n=0;n<4;n++){
        if(arr[i] + arr[i+n]==5){
            cout<<"Elements having sum 5 = ["<<i<<","<<i+n<<"]"<<endl;
            
        }
        }
    }
 
   return {}; }
};
Comments (2)