getSandwich(s)
that will return the string that is between the first and
last appearance of "bread" in the given string, or return the empty string "" if there
are not two pieces of bread.
getSandwich("breadjambread") → "jam" getSandwich("xxbreadjambreadyy") → "jam" getSandwich("xxbreadyy") → ""
xyBalance(s)
that will return True if the given string is xy-balanced.
xyBalance("aaxbby") → True xyBalance("aaxbb") → False xyBalance("yaaxbb") → False
tripleUp(t)
that will return True if the list contains,
somewhere, three increasing adjacent numbers like .... 4, 5, 6, ... or 23, 24, 25.
tripleUp([1, 4, 5, 6, 2]) → True tripleUp([1, 2, 3]) → True tripleUp([1, 2, 4]) → False
evenOdd(t)
that will return a list that contains the exact
same numbers as the given list, but rearranged so that all the even numbers come before all
the odd numbers. Other than that, the numbers can be in any order. You may modify and return
the given list, or make a new list.
evenOdd([1, 0, 1, 0, 0, 1, 1]) → [0, 0, 0, 1, 1, 1, 1] evenOdd([3, 3, 2]) → [2, 3, 3] evenOdd([2, 2, 2]) → [2, 2, 2]
canBalance(t)
that will return True if
there is a place to split the list so that the sum of the numbers on one side is equal to the
sum of the numbers on the other side.
canBalance([1, 1, 1, 2, 1]) → True canBalance([2, 1, 1, 2, 1]) → False canBalance([10, 10]) → True