We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
This is the code that I have solved this problem but it is failing two test cases because the execution is taking longer time since there are 1000 inputs. I can't think of any other solution!
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Arrays Introduction
You are viewing a single comment's thread. Return to all comments →
include
include
using namespace std; int main(){ int n, i; while(!(cin>>n) || n<1 ||n>=1000){ cin.clear(); cin.ignore(numeric_limits::max(), '\n'); } int arr[n]; for(i=0; i>arr[i] || arr[i]<1 || arr[i]<=10000)){ cin.clear(); cin.ignore(numeric_limits::max(), '\n'); }
}