문제 :
https://school.programmers.co.kr/learn/courses/30/lessons/181906
해결 :
class Solution {
public int solution(String my_string, String is_prefix) {
int answer = 0;
for(int i = 0; i<my_string.length(); i++){
if(is_prefix.equals(my_string.substring(0,i))){
answer = 1;
}
}
return answer;
}
}
'알고리즘 > [프로그래머스] JAVA' 카테고리의 다른 글
[코딩 기초 트레이닝] 세로 읽기 (0) | 2024.02.12 |
---|---|
[코딩 기초 트레이닝] 문자열 뒤집기 (0) | 2024.02.12 |
[코딩 기초 트레이닝] 문자열의 앞의 n글자 (0) | 2024.02.12 |
[코딩 기초 트레이닝] 이차원 배열 대각선 순회하기 (0) | 2024.02.10 |
[코딩 기초 트레이닝] 커피 심부름 (0) | 2024.02.10 |