inblog logo
|
goho
    알고리즘문제풀기

    [프로그래머스/JAVA]문자열안에 문자열

    gov's avatar
    gov
    Nov 29, 2024
    [프로그래머스/JAVA]문자열안에 문자열
    Contents
    문제풀이

    문제

    notion image

    풀이

    contains() 메서드 : 특정 문자열이 다른 문자열이 포함했는지, 대소문자를 구별하여 확인함
    class Solution { public int solution(String str1, String str2) { int answer = 0; if(str1. contains(str2)) { answer = 1; } else { answer = 2; } return answer; } }
    Share article

    goho

    RSS·Powered by Inblog