Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Writ Write Code in C++ Write a function solution that, given two integers A and B, returns a string containing exactly A letters 'a' and

image text in transcribedWrit

Write Code in C++

Write a function solution that, given two integers A and B, returns a string containing exactly A letters 'a' and exactly B letters'b' with no three consecutive letters being the same (in other words, neither "aaa" nor "bbb" may occur in the returned string) Examples: 1. Given A 5 and B 3, your function may return "aabaabab" Note that "abaabbaa" would also be a correct answer. Your function may return any correct answer. 2. Given A 3 and B 3, your function should return "ababab", "aababb", "abaabb" or any of several other strings. 3. Given A 1 and B4, your function should return "bbabb", which is the only correct answer in this case. Assume that: A and B are integers within the range [0..100]; . at least one solution exists for the given A and B. In your solution, focus on correctness. The performance of your solution will not be the focus of the assessment. Copyright 2009-2018 by Codility Limited. All Rights Reserved. Unauthorized copying, publication or disclosure prohibited

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 Security

Authors: Alfred Basta, Melissa Zgola

1st Edition

1435453905, 978-1435453906

More Books

Students also viewed these Databases questions

Question

Explain Coulomb's law with an example

Answered: 1 week ago

Question

What is operating system?

Answered: 1 week ago

Question

What is Ohm's law and also tell about Snell's law?

Answered: 1 week ago