https://leetcode.com/problems/length-of-last-word/?envType=daily-question&envId=2024-04-01
/**
* @param {string} s
* @return {number}
*/
var lengthOfLastWord = function(s) {
const words = s.trim().split(' ')
return words[words.length - 1].length
};
Top comments (0)