Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ebcd7a4

Browse files
authored
Merge pull request neetcode-gh#1460 from RHRafi009/main
Create: 58-Length-of-Last-Word.cs
2 parents 32f3f53 + 88d6717 commit ebcd7a4

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

csharp/58-Length-of-Last-Word.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
public class Solution {
2+
public int LengthOfLastWord(string s) {
3+
s = s.TrimEnd();
4+
string[] arr = s.Split(' ');
5+
return arr[arr.Length - 1].Length;
6+
}
7+
}
8+

0 commit comments

Comments
 (0)