就是个大暴力?
n <= 50 :直接sort了,当然也可以和 n > 50 一样做
n > 50 :用一个dfs按字典序枚举 [ 1 , n ] 中的数,为了方便直接用一下字符串流转成字符串就行了。

#include <bits/stdc++.h>
using namespace std;
vector<string> a;
string s;
int L=0;

class FoxAndMp3 {
public:
    vector <string> playList( int n );
};

void dfs(int x,int n){
    if (x>n||L==50) return;
    stringstream ss;
    ss<<x;
    ss>>s;
    if (x) a.push_back(s+".mp3"),L++;
    if (L==50) return;
    for(int i=(x==0?1:0);i<=9;i++){
        dfs(x*10+i,n);
        if (L==50) return;
    }
}

vector <string> FoxAndMp3::playList(int n) {
    while(!a.empty()) a.pop_back();
    if (n<=50){
        for(int i=1;i<=n;i++){
            stringstream ss;
            ss<<i;
            ss>>s;
            a.push_back(s+".mp3");
        }
        sort(a.begin(),a.end());
        return a;
    }
    dfs(0,n);
    return a;
}