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.
I dont think my code (repeating for loop twice) looks beautiful, anyway it was very easy to "just solve" the problem.
Wondering is there anything else i could learn from this problem.
#include<cmath>#include<cstdio>#include<vector>#include<iostream>#include<algorithm>usingnamespacestd;intmain(){/* Enter your code here. Read input from STDIN. Print output to STDOUT */vector<int>v;intn,x;cin>>n;for(inti=0;i<n;i++){cin>>x;v.push_back(x);}sort(v.begin(),v.end());for(inti=0;i<n;i++){cout<<v[i]<<" ";}return0;}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Vector-Sort
You are viewing a single comment's thread. Return to all comments →
I dont think my code (repeating for loop twice) looks beautiful, anyway it was very easy to "just solve" the problem.
Wondering is there anything else i could learn from this problem.