You are viewing a single comment's thread. Return to all comments →
this code is ok when input given,,its give the correct output,,but hackkerrank it gives the wrong ,,where is the problem?
using namespace std;
int main(){ int n; cin >> n; vector unsorted(n); for(int i = 0; i < n; i++){ cin >> unsorted[i]; } vector::iterator it=unsorted.begin(); sort(it,unsorted.end()); for(int i = 0; i < unsorted.size(); i++){ cout << unsorted[i] << " "; } return 0; }
Seems like cookies are disabled on this browser, please enable them to open this website
Big Sorting
You are viewing a single comment's thread. Return to all comments →
this code is ok when input given,,its give the correct output,,but hackkerrank it gives the wrong ,,where is the problem?
include
include
include
include
using namespace std;
int main(){ int n; cin >> n; vector unsorted(n); for(int i = 0; i < n; i++){ cin >> unsorted[i]; } vector::iterator it=unsorted.begin(); sort(it,unsorted.end()); for(int i = 0; i < unsorted.size(); i++){ cout << unsorted[i] << " "; } return 0; }