Update exam/packet.tex

This commit is contained in:
2025-11-22 22:00:27 -06:00
parent 6ecc701134
commit 6d169bb163
+9 -10
View File
@@ -144,19 +144,18 @@ Output:
% ========================= Problem 4 ========================= % ========================= Problem 4 =========================
\problem{Problem 3: Merge Intervals} \problem{Problem 3: Merge Intervals}
\textit{Difficulty: Hard} \textit{Difficulty: Hard}
\begin{itemize}
You are given a string S composed of only the characters ‘6', ‘7’, ‘A', ‘B', and ‘\#' (without the quotation marks). This string is processed from left to right, and you must maintain a sequence of chracters that changes according to these rules:
You are given a string S composed of only the characters \‘6\’, \‘7\’, \'A\’, \'B\’, and \‘#\’ (without the quotation marks). This string is processed from left to right, and you must maintain a sequence of chracters that changes according to these rules: \item 6 - add a 6 to the end of the sequence
1. The sequence starts out empty. \item 7 - if the sequence is non-empty and its last chracter is ‘6', remove that last ‘6', otherwise, add ‘7' to the end of the sequence
2. 6 - add a 6 to the end of the sequences \item A - reverse the sequence
3. 7 - if the sequence is non-empty and its last chracter is \‘6\’, remove that last \‘6\’, otherwise, add \‘7\’ to the end of the sequence \item B - add a duplicate of the current sequence to the end of it
4. A - reverse the sequence \item \# - clear the sequence
5. B - add a duplicate of the current sequence to the end of it \end{itemize}
6. # - clear the sequence
\inputformat \inputformat
\begin{itemize} \begin{itemize}
\item The first line consists of the string S. The string consists only of the characters 6, 7, A, B, and #. \item The first line consists of the string S. The string consists only of the characters 6, 7, A, B, and \#.
\item It is guaranteed that \texttt{s} ($1 \leq |s| \leq 10^5$)
\end{itemize} \end{itemize}
\outputformat \outputformat