Coding Test - cpp/Sort
[HackerRank/C++] Big Sorting
에드윈H
2021. 7. 1. 11:32
https://www.hackerrank.com/challenges/big-sorting/problem
#include <bits/stdc++.h>
using namespace std;
bool check(string a, string b){
return a.length() == b.length() ? a > b : a.length() > b.length();
}
vector<string> bigSorting(vector<string> unsorted) {
vector<string> result;
sort(unsorted.begin(),unsorted.end(),check);
for(int i = unsorted.size() - 1; i >= 0; i--)
{
result.push_back(unsorted[i]);
}
return result;
}
hackerrank 풀어보다가 큰수 정렬에 관해