https://school.programmers.co.kr/learn/courses/30/lessons/120908
프로그래머스
SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프
programmers.co.kr
자바
class Solution {
public int solution(String str1, String str2) {
if(str1.contains(str2))
return 1;
else
return 2;
}
}
자바스크립트
function solution(str1, str2) {
if (str1.includes(str2))
return 1;
else
return 2;
}
javascript 부분은 아래의 stackoverflow 링크를 참고하세요.
Why is this returning the error .contains() is not a function
Am getting the error .contains() is not a function. Full code is here, probably too much to paste here so here's the relevant bits. Locations is globally set as well as query, then set state in the
stackoverflow.com
'Portpolio > codingtest' 카테고리의 다른 글
python 내장 함수 (0) | 2025.02.23 |
---|---|
프로그래머스 가습기 풀이 (0) | 2025.02.19 |
프로그래머스 피자 나눠 먹기 (3) 풀이 (0) | 2025.02.16 |
프로그래머스 병과분류 풀이 (3) | 2025.02.10 |
프로그래머스 삼각형의 완성조건(1) 풀이 (2) | 2025.02.03 |
댓글