File tree 2 files changed +12
-2
lines changed
2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change 3
3
![ Hits] ( https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https://github.com/anishLearnsToCode/leetcode-algorithms )
4
4
![ made-with-java] ( https://img.shields.io/badge/Made%20with-Java-1f425f.svg )
5
5
![ made-with-python] ( https://img.shields.io/badge/Made%20with-Python-1f425f.svg )
6
- ![ problems-solved] ( https://img.shields.io/badge/Problems%20Solved-12 /1412-1abc9c.svg )
7
- ![ problems-solved-java] ( https://img.shields.io/badge/Java-12 /1412-1abc9c.svg )
6
+ ![ problems-solved] ( https://img.shields.io/badge/Problems%20Solved-13 /1412-1abc9c.svg )
7
+ ![ problems-solved-java] ( https://img.shields.io/badge/Java-13 /1412-1abc9c.svg )
8
8
![ problems-solved-python] ( https://img.shields.io/badge/Python-2/1412-1abc9c.svg )
9
9
[ ![ license] ( https://img.shields.io/badge/LICENSE-MIT-<COLOR>.svg )] ( LICENSE )
10
10
[ ![ PRs Welcome] ( https://img.shields.io/badge/PRs-welcome-brightgreen.svg )] ( CONTRIBUTING.md )
Original file line number Diff line number Diff line change
1
+ public class LengthOfLastWord {
2
+ public int lengthOfLastWord (String sentence ) {
3
+ String [] words = sentence .split (" " );
4
+ if (words .length == 0 ) {
5
+ return 0 ;
6
+ }
7
+
8
+ return words [words .length - 1 ].length ();
9
+ }
10
+ }
You can’t perform that action at this time.
0 commit comments