Vajad kellegagi rääkida?
Küsi julgelt abi LasteAbi
Logi sisse
Sulge

"yza" - 1 õppematerjal

PPK outdated
24
doc

PPK(outdated)

compute recursively a new string made of only of the parenthesis and their contents parenBit("x(hello)") → "(hello)" if(str.startsWith("(") && str.endsWith(")")) return str; return parenBit(str.substring(str.indexOf('('), str.indexOf(')')+1)); 13. Given a string, return recursively a "cleaned" string where adjacent chars that are the same have been reduced to a single char. stringClean("yyzzza") → "yza" if(str.length()<2) return str; if(str.charAt(1)==str.charAt(0)) return stringClean(str.substring(1)); return str.charAt(0) + stringClean(str.substring(1)); 14. Given a string and a non-empty substring sub, compute recursively the largest substring which starts and ends with sub and return its length. strDist("catcowcat", "cat") → 9 return func(str, sub).length(); } private String func(String str, String sub) {

Informaatika → Java programmeerimine
35 allalaadimist


Sellel veebilehel kasutatakse küpsiseid. Kasutamist jätkates nõustute küpsiste ja veebilehe üldtingimustega Nõustun