#include <string>
#include <vector>

using namespace std;
vector<int> sort(vector<int> a){
    int tmp = 0;
    for(int i=0; i < a.size()-1; i++){
        for(int j  = i+1;j < a.size(); j++){
            if(a[i]>a[j]){
                tmp = a[i];
                a[i] = a[j];
                a[j] = tmp;
            }
        }
    }
    return a;
}
vector<int> solution(vector<int> arr, int divisor) {
    vector<int> answer;
    for(int i=0; i < arr.size(); i++){
        if(arr[i] % divisor == 0 )
            answer.push_back(arr[i]);
    }
    if(answer.size()==0)
        answer.push_back(-1);
    else
        answer = sort(answer);
    return answer;
}

+ Recent posts