LeetCode Length of Last Word Solution
A fairly simple problem with a couple of gotcha’s in what can be inputted. So let’s go through the details of it.
Problem
So given a string s
consisting of some words separated by spaces, return the length of the last word. The key part, is that a word in this context contains only non-space characters. In short, l337
is considered a word for simplicity sake.