You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: C++/chapString.tex
+251Lines changed: 251 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -53,3 +53,254 @@ \subsubsection{相关题目}
53
53
\item Add Two Numbers,见 \S\ref{sec:add-two-numbers}
54
54
\myenddot
55
55
56
+
57
+
\section{String to Integer (atoi)} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
58
+
\label{sec:string-to-integer}
59
+
60
+
61
+
\subsubsection{描述}
62
+
Implement \fn{atoi} to convert a string to an integer.
63
+
64
+
\textbf{Hint}: Carefully consider all possible input cases. If you want a challenge, please do not see below and ask yourself what are the possible input cases.
65
+
66
+
\textbf{Notes}: It is intended for this problem to be specified vaguely (ie, no given input specs). You are responsible to gather all the input requirements up front.
67
+
68
+
\textbf{Requirements for atoi}:
69
+
70
+
The function first discards as many whitespace characters as necessary until the first non-whitespace character is found. Then, starting from this character, takes an optional initial plus or minus sign followed by as many numerical digits as possible, and interprets them as a numerical value.
71
+
72
+
The string can contain additional characters after those that form the integral number, which are ignored and have no effect on the behavior of this function.
73
+
74
+
If the first sequence of non-whitespace characters in str is not a valid integral number, or if no such sequence exists because either str is empty or it contains only whitespace characters, no conversion is performed.
75
+
76
+
If no valid conversion could be performed, a zero value is returned. If the correct value is out of the range of representable values, \code{INT_MAX (2147483647)} or \code{INT_MIN (-2147483648)} is returned.
Given a string $S$, find the longest palindromic substring in $S$. You may assume that the maximum length of $S$ is 1000, and there exists one unique longest palindromic substring.
0 commit comments