Questions 1
Questions 1
2.If this chosen prefix contains at least two characters, cut this prefix from s and go back to the first
step with the updated string. Otherwise, end the algorithm with the current string s as a result.
Your task is to implement the above algorithm and return its result when applied to string s.
Note: you can click on the prefixes and palindrome words to see the definition of the terms if you're not
familiar with them.
Example
•[input] string s
Guaranteed constraints:
0 ≤ s.length ≤ 1000.
•[output] string
•For
a = [[3, 3, 4, 2],
[4, 4],
[4, 0, 3, 3],
[2, 3],
[3, 3, 3]]
nor
•For
a = [[-5, 2, 3],
[0, 0],
[0],
[-100, 100]]
•[input] array.array.integer a
Guaranteed constraints:
1 ≤ a.length ≤ 100,
1 ≤ a[i].length ≤ 100,
-100 ≤ a[i][j] ≤ 100.
•[output] array.array.integer
•[input] array.integer a
Guaranteed constraints:
2 ≤ a.length ≤ 105,
-104 ≤ a[i] ≤ 104.
•[input] array.integer b
Guaranteed constraints:
b.length = a.length,
-104 ≤ b[i] ≤ 104.
•[output] integer
The minimum possible difference between a and b after replacing at most one element of a to any
element from the same array, or leaving everything intact.
[Java] Syntax Tips