58. Length of Last Word

Easy — String

Reverse Scan
Split
Press "Play" or "Step" to walk through the algorithm.

Step

0 / 0

Pointer i

--

Phase

--

Length

0
Cursor i
Skipped (trailing space)
Counting
Counted
Algorithm Complexity
Split
O(n) / O(n)
Time / Space: O(n) / O(n)
Reverse Scan
O(k) / O(1)
Time / Space: O(k) / O(1)