이 코드는 작동하지 않습니다. 고칠 수 있도록 도와주세요 .............................................. .................................................. .................자바는 재귀를 사용하여 문자열에서 부분 문자열을 찾습니다.
/**
Recursive method for looking for a substring in a string.
@param text look in
@param target look for as substring
@return true if target is a substring of text
*/
public static boolean find(String text, String target)
{
//-----------Start below here. To do: approximate lines of code = 4
// 1. base case: null
if (text == null) {return false;}
//2. base case: target too long
if (target.length() > text.length()) {return false;}
//3. base case: same length
if (text.length() == target.length()) {return false;}
//4. base case: startsWith OR 5. recursive case
return true;
}
읽어 보시기 바랍니다 시도 [요청하는 방법 (https://stackoverflow.com/questions/ how-to-ask)를 입력하고 그에 따라 질문을 편집하십시오. –
어떤 오류가 발생합니까? –
여기에 재귀가 없습니다. 나는 코드가 불완전하다고 생각한다. – Rami