[프로그래머스/Java] Lv.0 접두사인지 확인하기
문제 풀이 1 2 3 4 5 6 7 8 class Solution { public int solution(String my_string, String is_prefix) { return my_string.substring(0, Math.min(is_prefix.length(), my_string.length())).equals(is_prefix) ? 1 : 0; } } Colored by Color Scripter cs