Given a string, return a string where for every char in the original, there are two chars


Berilgan satrda boshlanish qismi nuqta (.) bilan ajratilmagan “xyz” ketma ketligi bo`lsa true qiymat qaytarilsin. Masalan, “xxyz” true, lekin “x.xyz” false


Download 86.5 Kb.
bet3/4
Sana08.01.2022
Hajmi86.5 Kb.
#234727
1   2   3   4
Bog'liq
CodingBat String 2

Berilgan satrda boshlanish qismi nuqta (.) bilan ajratilmagan “xyz” ketma ketligi bo`lsa true qiymat qaytarilsin. Masalan, “xxyz” true, lekin “x.xyz” false

xyzThere("abcxyz") → true


xyzThere("abc.xyz") → false
xyzThere("xyz.abc") → true

String-2 > bobThere 
prev  |  next  |  chance

Return true if the given string contains a "bob" string, but where the middle 'o' char can be any char.

bobBormi

Berilgan satrda “bob” so`zi bo`lsa true qiymat qaytarilsin, bunda o`rtadagi ‘o’ belgisi istalgan belgi qabul qilishi mumkin.

bobThere("abcbob") → true


bobThere("b9b") → true
bobThere("bac") → false

String-2 > xyBalance 
prev  |  next  |  chance

We'll say that a String is xy-balanced if for all the 'x' chars in the string, there exists a 'y' char somewhere later in the string. So "xxy" is balanced, but "xyx" is not. One 'y' can balance multiple 'x's. Return true if the given string is xy-balanced.

xyMuvozanati

Agar berilgan satrdagi ‘y’ belgisi barcha ‘x’ belgilaridan keyin kelsa bunday satrni biz xy-muvozanatlashgan satr deymiz va true qiymat qaytaramiz. Masalan, “xxy”true, “xyx” false.

xyBalance("aaxbby") → true


xyBalance("aaxbb") → false
xyBalance("yaaxbb") → false

String-2 > mixString 
prev  |  next  |  chance

Given two stringsa and b, create a bigger string made of the first char of a, the first char of b, the second char of a, the second char of b, and so on. Any leftover chars go at the end of the result.

aralashSatr

Ikkita a va b satr berilgan bo`lib, ular yoramida a satrdan bitta va b satrdan bittadan begilar ketma-ket qo`shilishdan va uzunroq satrning ortib qolgan belgilarini yangi satr oxiriga qo`shilishidan hosil bo`lgan natijani qaytaring.

mixString("abc", "xyz") → "axbycz"


mixString("Hi", "There") → "HTihere"
mixString("xxxx", "There") → "xTxhxexre"

String-2 > repeatEnd 
prev  |  next  |  chance

Given a string and an int n, return a string made of n repetitions of the last n characters of the string. You may assume that n is between 0 and the length of the string, inclusive.


Download 86.5 Kb.

Do'stlaringiz bilan baham:
1   2   3   4




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling