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

"pairstar" - 1 õppematerjal

PPK outdated
24
doc

PPK(outdated)

substring(1)); 4. Given a string, compute recursively a new string where all the adjacent chars are now separated by a "*". if(str.length()==1 || str.equals("")) return str; return str.charAt(0) + "*" + allStar(str.substring(1)); 5. Given a string, compute recursively a new string where identical chars that are adjacent in the original string are separated from each other by a "*". if (str.length()<2) return str; if(str.charAt(0)==str.charAt(1)) return str.charAt(0) + "*" + pairStar(str.substring(1)); return str.charAt(0) + pairStar(str.substring(1)); 10. We'll say that a "pair" in a string is two instances of a char separated by a char. countPairs("axa") → 1 if(str.length() < 3) return 0; if(str.charAt(0)==str.charAt(2)) return 1 + countPairs(str.substring(1)); return countPairs(str.substring(1)); 11. Put certain letter in the end of given string if(str.length()==1 || str.equals("")) return str; if(str

Informaatika → Java programmeerimine
35 allalaadimist


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