-
프로그래머스 - 문자열 다루기 기본 [자바]Algorithms/- 프로그래머스 2022. 2. 2. 11:29
- 문제 링크 : 문자열 다루기 기본
정답
class Solution { public boolean solution(String s) { if(s.length() == 4 || s.length() == 6){ s = s.replaceAll("\\d", ""); if(s.length() > 0){ return false; }else{ return true; } } return false; } }
분석
- 길이가 4 또는 6이라는 조건을 걸어줘야 함.
반응형