2689. Extract Kth Character From The Rope Tree¶
Approach 1: Recursive¶
- Time: $O(n)$
- Space: $O(\log n)$
1 2 3 4 5 6 7 8 9 10 11 12 13 |
|
1 2 3 4 5 6 7 8 |
|
1 2 3 4 5 6 7 8 9 10 |
|
Approach 2: Iterative¶
- Time: $O(n)$
- Space: $O(\log n)$
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
|