MCPcopy Create free account
hub / github.com/ROUTINE-STUDY/Algorithm / Sanghoo

Class Sanghoo

LeetCode/String/58. Length of Last Word/Sanghoo.java:3–10  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1package String.Length_of_Last_Word;
2
3public class Sanghoo {
4
5 public static int lengthOfLastWord(String s) {
6 String[] arr = s.split(" ");
7 return arr.length == 0 ? 0 : arr[arr.length-1].length();
8 }
9
10}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected