LeetCodeLength of Last WordLength of Last WordEasyStringSolution export function lengthOfLastWord(s: string): number { let [start, end] = [s.length - 1, -1]; while (0 <= start && (s[start] !== ' ' || end < 0)) { if (s[start] !== ' ' && end < 0) { end = start; } start -= 1; } return end - start; }LeetCodeLength of Last Wordhttps://leetcode.com/problems/length-of-last-word