These problems evaluate string-manipulation and algorithmic-simulation competencies—specifically lexicographic ordering and prefix/suffix transformations for the first problem, and cumulative-time aggregation with elimination and lexicographic tie-breaking for the second.

You remember two coding questions from an online assessment.
You are given a string s (length n). You may perform at most one operation:
k
where
1 <= k <= n
.
k characters
of
s
(reverse a prefix of length
k
), leaving the rest unchanged,
or
k characters
of
s
(reverse a suffix of length
k
), leaving the rest unchanged.
Return the lexicographically (alphabetically) smallest string that can be obtained among:
Output: the smallest resulting string.
You are given laps, an array of length n representing a multi-lap race.
laps[i]
is an array of pairs
[driverName, lapTime]
.
lapTime
is a positive integer.
Maintain each driver’s history so far using cumulative total time across all completed laps. After each lap is processed:
driverName
in ascending lexicographic order.
Return the elimination order as an array of driver names, from first eliminated to last eliminated.
Output: string[] elimination order.
Notes / assumptions to make the task well-defined: