https://school.programmers.co.kr/learn/courses/30/lessons/181921
import java.util.*;
class Solution {
public ArrayList solution(int l, int r) {
ArrayList<Integer> answer = new ArrayList<>();
for(int i=l; i<=r; i++){
String numStr = i + ""; //50
String[] arr = numStr.split(""); //arr[0] = "5", arr[1] = "0"
boolean isCorr = true;
for(int j=0;j<arr.length;j++){
if(!arr[j].equals("5") && !arr[j].equals("0")){ //5가 아니고 0이 아닌 것
isCorr = false;
break;
}
}
if(isCorr){
answer.add(i);
}
}
if(answer.size() == 0){
answer.add(-1);
}
return answer;
}
}