You are viewing a single comment's thread. Return to all comments →
sort(arr.begin(), arr.end()); vector ans(100,0); for (int i = 0; i <= arr[arr.size() - 1]; i++) ans[i] = (count(arr.begin(), arr.end(), i)); return ans;
Thanks, I just took the initialization step from your solution.
Seems like cookies are disabled on this browser, please enable them to open this website
Counting Sort 1
You are viewing a single comment's thread. Return to all comments →
sort(arr.begin(), arr.end()); vector ans(100,0); for (int i = 0; i <= arr[arr.size() - 1]; i++) ans[i] = (count(arr.begin(), arr.end(), i)); return ans;
Thanks, I just took the initialization step from your solution.