내풀이
import java.util.*;
class Solution {
public int solution(String my_string, String is_prefix) {
int answer = 0;
char[] cutArr = Arrays.copyOfRange(my_string.toCharArray(),0,is_prefix.toCharArray().length);
String[] strArr = new String[is_prefix.toCharArray().length];
for(int i = 0; i<strArr.length; i++){
strArr[i] = String.valueOf(cutArr[i]);
}
String ans = String.join("",strArr);
answer = ans.contains(is_prefix) ? 1 : 0;
return answer;
}
}
다른사람풀이
class Solution {
public int solution(String my_string, String is_prefix) {
if (my_string.startsWith(is_prefix)) return 1;
return 0;
}
}