Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

double_vowels Given a string, return a copy of the string with all of the vowels doubled. Consider the five letters 'aeiou' as vowels. double_vowels('pencil') 'peenciil'

double_vowels

Given a string, return a copy of the string with all of the vowels doubled. Consider the five letters 'aeiou' as vowels.

double_vowels('pencil') 'peenciil' double_vowels('xyzzy') 'xyzzy' double_vowels('catalog') 'caataaloog'

middle_hash

Given a string, do three hash marks '###' appear in the middle of the string? To define middle, we'll say that the number of chars to the left and right of the '###' must differ by at most one.

middle_hash('aa###bb') True middle_hash('aaa###bb') True middle_hash('a###bbb') False

fence_post

Given two strings, fence and post, return a string made up of count instances of post, separated by instances of fence. Note: This is an example of the classic "fence post" programming problem. It's a variant of the off-by-one-error (OBOE).

fence_post('X', 'Word', 3) 'WordXWordXWord' fence_post('And', 'This', 2) 'ThisAndThis' fence_post('And', 'This', 1) 'This'

balanced_x_y

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.

balanced_x_y('aaxbby') True balanced_x_y('aaxbb') False balanced_x_y('yaaxbb') False

repeated_prefix

Given a string, consider the prefix string made of the first N chars of the string. Does that prefix string appear somewhere else in the string? Assume that the string is not empty and that N is in the range 1..len(str).

repeated_prefix('abXYabc', 1) True repeated_prefix('abXYabc', 2) True repeated_prefix('abXYabc', 3) False

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems On GPUs In Databases

Authors: Johns Paul ,Shengliang Lu ,Bingsheng He

1st Edition

1680838482, 978-1680838480

More Books

Students also viewed these Databases questions