Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

You're given a string that contains only letters 'a' to 'z' and character '?'. Write an efficient algorithm that's replacing all characters '?' with letters

You're given a string that contains only letters 'a' to 'z' and character '?'. Write an efficient algorithm that's replacing all characters '?' with letters 'a' to 'z' in such a way, that return string doesn't contain adjacently repeating characters. You aren't allowed to change any character value or position in an input string except for the value of '?'. Presume that the input string doesn't contain adjacently repeating characters, except for '?'.

Example 1 Input: "?b?a" Output: "abca" (Other characters for '?' are valid as well, as long as output string is valid)

Example 2 Input: "ab?cde????fo??" Output: "abacdeabcdfode"

Example 3 Input: "??axzb??def??g" Output: "abaxzbcedefefg"

Example 4 Input: "??????????????" Output: "abcdefghijklmn"

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

OCA Oracle Database SQL Exam Guide Exam 1Z0-071

Authors: Steve O'Hearn

1st Edition

1259585492, 978-1259585494

More Books

Students also viewed these Databases questions

Question

Different types of Grading?

Answered: 1 week ago

Question

Explain the functions of financial management.

Answered: 1 week ago

Question

HOW MANY TOTAL WORLD WAR?

Answered: 1 week ago

Question

Discuss the scope of financial management.

Answered: 1 week ago

Question

Why is repatriation orientation and training needed?

Answered: 1 week ago