problem
949. Largest Time for Given Digits
solution:
class Solution { public: string largestTimeFromDigits(vector<int>& A) { sort(A.begin(), A.end(), greater<int>());//errr..largest.. do { if((A[0]<2 || (A[0]==2&&A[1]<4)) && A[2]<6)//err.. { return to_string(A[0])+to_string(A[1])+":"+to_string(A[2])+to_string(A[3]);//err. } } while(prev_permutation(A.begin(), A.end()));//err.. return ""; } };
参考
1. Leetcode_easy_949. Largest Time for Given Digits;
2. discuss;
3. cplusplus_prev_permutation;
4. cplusplus_sort;
完