sort strings by length and by alphabet

Solutions on MaxInterview for sort strings by length and by alphabet by the best coders in the world

showing results for - "sort strings by length and by alphabet"
Stefano
27 Nov 2019
1bool comp(string a, string b) {
2	if (a.size() != b.size()) return a.size() < b.size(); // primarily by length
3	return a < b;  //secondarily by alphabetical
4}
5
similar questions
queries leading to this page
sort strings by length and by alphabet