leetcode - Reverse Linked List @ Sun, Feb 19, 2023 9:27 AM
leetcode - Reverse Linked List @ Sun, Feb 19, 2023 6:08 PM
Expand 12 lines ...
13

13

14
## recursive
14
## recursive
15

15

16
+
+ Base Case: Rather than a **condition** to keep running, recursive algorithms reach a point to **stop and return**. This point is commonly referred to as the **base case**.
17
+
+ Each time you call the function, an argument must change. One argument in particular should be changing *towards* the **base case**.
18
+
+ **Establish your base case**. Figure out when the recursion ends! Without a place to stop you’ll wind up overflowing the [call stack](https://en.wikipedia.org/wiki/Call_stack).
19
+

16
```typescript
20
```typescript
17
/**
21
/**
18
 * Definition for singly-linked list.
22
 * Definition for singly-linked list.
Expand 48 lines ...