ディジタル配列

import java.util.*;
class Solution {
public ArrayList<Integer> solution(int[] arr, int divisor) {
ArrayList<Integer> list = new ArrayList<Integer>();
boolean flag = false;
for(int n : arr){
if(n%divisor==0) {
list.add(n);
flag = true;
}
}
if(!flag) list.add(-1);
Collections.sort(list);
return list;
}
}

Reference
この問題について(ディジタル配列), 我々は、より多くの情報をここで見つけました https://velog.io/@ppnrn/나누어-떨어지는-숫자-배열テキストは自由に共有またはコピーできます。ただし、このドキュメントのURLは参考URLとして残しておいてください。
Collection and Share based on the CC Protocol