728x90
반응형

class Solution {
public boolean solution(String s) {
return isValidLength(s) && isMatchPattern(s);
}
private boolean isValidLength(String s) {
return s.length() == 4 || s.length() == 6;
}
private boolean isMatchPattern(String s) {
try {
int n = Integer.parseInt(s);
return true;
} catch (Exception e) {
return false;
}
}
}
개인적으로 깔끔하게 풀었다고 생각해서 기록하는 중 ᜊʕ ྀི ܸ. . .ܸ ྀིʔᜊ
728x90
반응형
댓글