Skip to content

Commit

Permalink
Merge pull request #227 from 1chooo/fix/#225
Browse files Browse the repository at this point in the history
Fix/#225
  • Loading branch information
1chooo authored Sep 10, 2024
2 parents 16cae1c + c1e66c5 commit a3264ee
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion apps/web/src/components/markdown/code-block.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const CodeBlock: React.FC<CodeBlockProps> = ({ language, children }) => (
wrapLines={true}
showInlineLineNumbers={true}
>
{String(children)}
{String(children).trimEnd()}
</SyntaxHighlighter>
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,23 +116,23 @@ Take `head = [0, 3, 1, 0, 4, 5, 2, 0]` as an example, let's go through the code
- `cur` points to the second node (value 3).
- Since `cur.Val` is not 0, add `cur.Val` to `sum`:

```
```go
sum = 0 + 3 = 3
```

### Iteration 2
- Move `cur` to the third node (value 1).
- Since `cur.Val` is not 0, add `cur.Val` to `sum`:

```
```go
sum = 3 + 1 = 4
```

### Iteration 3
- Move `cur` to the fourth node (value 0).
- Since `cur.Val` is 0, update `n.Val` and move `n`:

```
```go
n.Val = sum = 4
n.Next = cur.Next (points to node with value 4)
sum = 0
Expand All @@ -144,36 +144,37 @@ Take `head = [0, 3, 1, 0, 4, 5, 2, 0]` as an example, let's go through the code
- Move `cur` to the fifth node (value 4).
- Since `cur.Val` is not 0, add `cur.Val` to `sum`:

```
```go
sum = 0 + 4 = 4
```

### Iteration 5
- Move `cur` to the sixth node (value 5).
- Since `cur.Val` is not 0, add `cur.Val` to `sum`:

```
```go
sum = 4 + 5 = 9
```

### Iteration 6
- Move `cur` to the seventh node (value 2).
- Since `cur.Val` is not 0, add `cur.Val` to `sum`:

```
```go
sum = 9 + 2 = 11
```

### Iteration 7
- Move `cur` to the eighth node (value 0).
- Since `cur.Val` is 0, update `n.Val` and move `n`:

```
```go
n.Val = sum = 11
n.Next = cur.Next (points to nil, end of the list)
sum = 0
n = cur.Next (points to nil)
```

The linked list now looks like this: `[0, 4, 11]`

### End
Expand Down

0 comments on commit a3264ee

Please sign in to comment.