cswork / OAOpen practice workspace

UberOA #55

Reverse and Append

Estimated EasyStatement and editorial — judging is being prepared

Topics (AI-labelled)Strings

Given a string, you can reverse part of it from any index towards left or right. Output all possible list of strings. Function Description Complete the function reverseAndAppend in the editor. reverseAndAppend has the following parameter:

  • String s: the original string Returns List: the list of all possible strings after reversing and appending Halooo~~ Uber assessment comes with 4 coding questions. The other 3 are in here - Generate Arrays (Click to view surprise :)

Example 1

Input:

s = "dbaacca"

Output:

["bdaacca", "abdacca", "dbaacac"]

Explanation: From index 1, reverse db-> append with rest of original -> bdaacca From index 2, reverse dba -> append with rest of original -> abdacca From index 5, reverse ca towards right -> append with rest of original -> dbaacac Output all possible list of strings PPS: I have a strong gut feeling that these might not be the correct versions of the output. The current outputs are just placeholders. I'll come back to update them once I find a more reliable source in the future. As for how far in the future… that's a myth no one knows. I'll see you next time!

Editorial

Loading solution…