首页 > 其他 > 详细

LeetCode--Length of Last Word

时间:2014-12-29 21:28:11      阅读:287      评论:0      收藏:0      [点我收藏+]

题目:

技术分享

解决方法:

public class Solution {
    public int lengthOfLastWord(String s) {
        if (s.trim().length() == 0) {
            return 0;
        }
        String[] str = s.split(" ");
        return str[str.length - 1].length();
    }
}


LeetCode--Length of Last Word

原文:http://blog.csdn.net/wj512416359/article/details/42243405

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!