Skip to content

Commit d9c850c

Browse files
authored
Improve readme formatting and explanations
Updated explanations in the readme for clarity and formatting.
1 parent 3be15c5 commit d9c850c

File tree

1 file changed

+26
-5
lines changed
  • src/main/java/g0001_0100/s0008_string_to_integer_atoi

1 file changed

+26
-5
lines changed

src/main/java/g0001_0100/s0008_string_to_integer_atoi/readme.md

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,13 @@ Return the integer as the final result.
2121

2222
**Explanation:**
2323

24-
The underlined characters are what is read in and the caret is the current reader position. Step 1: "42" (no characters read because there is no leading whitespace) ^ Step 2: "42" (no characters read because there is neither a '-' nor '+') ^ Step 3: "<ins>42</ins>" ("42" is read in) ^
24+
The underlined characters are what is read in and the caret is the current reader position.
25+
Step 1: "42" (no characters read because there is no leading whitespace)
26+
^
27+
Step 2: "42" (no characters read because there is neither a '-' nor '+')
28+
^
29+
Step 3: "42" ("42" is read in)
30+
^
2531

2632
**Example 2:**
2733

@@ -31,7 +37,12 @@ The underlined characters are what is read in and the caret is the current reade
3137

3238
**Explanation:**
3339

34-
Step 1: " \-042" (leading whitespace is read and ignored) ^ Step 2: " <ins>\-</ins>042" ('-' is read, so the result should be negative) ^ Step 3: " -<ins>042</ins>" ("042" is read in, leading zeros ignored in the result) ^
40+
Step 1: "___-042" (leading whitespace is read and ignored)
41+
^
42+
Step 2: " -042" ('-' is read, so the result should be negative)
43+
^
44+
Step 3: " -042" ("042" is read in, leading zeros ignored in the result)
45+
^
3546

3647
**Example 3:**
3748

@@ -41,7 +52,12 @@ Step 1: " \-042" (leading whitespace is read and ignored) ^ Step 2: " <ins>\-</i
4152

4253
**Explanation:**
4354

44-
Step 1: "1337c0d3" (no characters read because there is no leading whitespace) ^ Step 2: "1337c0d3" (no characters read because there is neither a '-' nor '+') ^ Step 3: "<ins>1337</ins>c0d3" ("1337" is read in; reading stops because the next character is a non-digit) ^
55+
Step 1: "1337c0d3" (no characters read because there is no leading whitespace)
56+
^
57+
Step 2: "1337c0d3" (no characters read because there is neither a '-' nor '+')
58+
^
59+
Step 3: "1337c0d3" ("1337" is read in; reading stops because the next character is a non-digit)
60+
^
4561

4662
**Example 4:**
4763

@@ -51,7 +67,12 @@ Step 1: "1337c0d3" (no characters read because there is no leading whitespace) ^
5167

5268
**Explanation:**
5369

54-
Step 1: "0-1" (no characters read because there is no leading whitespace) ^ Step 2: "0-1" (no characters read because there is neither a '-' nor '+') ^ Step 3: "<ins>0</ins>\-1" ("0" is read in; reading stops because the next character is a non-digit) ^
70+
Step 1: "0-1" (no characters read because there is no leading whitespace)
71+
^
72+
Step 2: "0-1" (no characters read because there is neither a '-' nor '+')
73+
^
74+
Step 3: "0-1" ("0" is read in; reading stops because the next character is a non-digit)
75+
^
5576

5677
**Example 5:**
5778

@@ -66,4 +87,4 @@ Reading stops at the first non-digit character 'w'.
6687
**Constraints:**
6788

6889
* `0 <= s.length <= 200`
69-
* `s` consists of English letters (lower-case and upper-case), digits (`0-9`), `' '`, `'+'`, `'-'`, and `'.'`.
90+
* `s` consists of English letters (lower-case and upper-case), digits (`0-9`), `' '`, `'+'`, `'-'`, and `'.'`.

0 commit comments

Comments
 (0)