8000 Fixed atoi · w-x-github/leetcode@bbea1b3 · GitHub
[go: up one dir, main page]

Skip to content

Commit bbea1b3

Browse files
committed
Fixed atoi
1 parent 938534e commit bbea1b3

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

C++/chapString.tex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,10 +206,10 @@ \subsubsection{代码}
206206
// 时间复杂度O(n),空间复杂度O(1)
207207
class Solution {
208208
public:
209-
int atoi(const char *str) {
209+
int myAtoi(const string &str) {
210210
int num = 0;
211211
int sign = 1;
212-
const int n = strlen(str);
212+
const int n = str.length();
213213
int i = 0;
214214

215215
while (str[i] == ' ' && i < n) i++;

C++/leetcode-cpp.pdf

43 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)
0