Soal
00:00

8. Length of Last Word

MudahStringAmazonMicrosoft

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

Contoh 1:

Input: s = "Hello World"
Output: 5

Contoh 2:

Input: s = "   fly me   to   the moon  "
Output: 4

Batasan:

  • 1 <= s.length <= 10^4
Mode kode inti
● Tersimpan otomatisBaris 1, kolom 1