Algorithm · Bloomberg · Medium
Examples Example 1 Example 2 Requirements For a given string s, find and return its longest contiguous segment whose characters are identical when read left-to-right or right-to-left. When multiple longest segments have equal length, returning any of them is valid. Function signature: Follow-up topics: Begin with the expand-from-center approach, which runs in O(n^2) time and uses O(1) extra space; afterward, cover the dynamic-programming-table option and explain why it needs…
Checking your access…