kt: add «58. Length of Last Word»

URL:	https://leetcode.com/problems/length-of-last-word/
Signed-off-by: Matej Focko <me@mfocko.xyz>
This commit is contained in:
Matej Focko 2025-02-04 21:22:59 +01:00
parent a28c619756
commit 1f6394137d
Signed by: mfocko
SSH key fingerprint: SHA256:icm0fIOSJUpy5+1x23sfr+hLtF9UhY8VpMC7H4WFJP8

View file

@ -0,0 +1,3 @@
class Solution {
fun lengthOfLastWord(s: String): Int = s.trim().split(Regex("\\s+")).last().length
}