Problem Brief
Reverse and Append
FULLTIMEOA
See Uber online assessment and hiring insights
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 🍉 -
1Example 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!