प्रश्न
00:00

8. Length of Last Word

आसानस्ट्रिंगAmazonMicrosoft

Given a string s, return the length of its last word.

उदाहरण 1:

इनपुट: s = "Hello World"
आउटपुट: 5

उदाहरण 2:

इनपुट: s = "   fly me   to   the moon  "
आउटपुट: 4

सीमाएँ:

  • 1 <= s.length <= 10^4
मुख्य कोड मोड
● अपने आप सहेजा गयापंक्ति 1, कॉलम 1