[프로그래머스, 181906] 접두사인지 확인하기 (java)
Problem Solving/Programmers

[프로그래머스, 181906] 접두사인지 확인하기 (java)

728x90

https://school.programmers.co.kr/learn/courses/30/lessons/181906

 

프로그래머스

SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프

programmers.co.kr

728x90

메모리: 103 MB, 시간: 0.05 ms

사용 알고리즘: 문자열

class Solution {
    public int solution(String my_string, String is_prefix) {
        
        for(int i = 1; i <= my_string.length(); i++)
            if(my_string.substring(0, i).equals(is_prefix)) return 1;
        
        return 0;
    }
}
728x90