Length of Last Word
来源:互联网 发布:阿里云主营业务 编辑:程序博客网 时间:2024/05/17 17:54
public int lengthOfLastWord(String s) { // Start typing your Java solution below // DO NOT write main() function if(s == null | s.length() == 0) return 0; int end = s.length() - 1; int count = 0; while(end >= 0 && s.charAt(end) == ' ') { end--; } while(end >= 0 && s.charAt(end) != ' ') { end--; count++; } return count; }
- Length of Last Word
- Length of Last Word
- Length of Last Word
- Length of Last Word
- Length of Last Word
- Length of Last Word
- Length of Last Word
- Length of Last Word
- Length of Last Word
- Length of Last Word
- Length of Last Word
- Length of Last Word
- Length of Last Word
- Length of Last Word
- Length of Last Word
- Length of Last Word
- Length of Last Word
- Length of Last Word
- centos64位lamp配置第二步:源码编译apache2.2.25
- C使用 stdarg 宏来实现函数的可变参数列表
- Linux编辑器vi使用方法详细介绍
- Android在主UI中使用Socket服务
- jdbc mysql 中文乱码问题的解决
- Length of Last Word
- Activity中的onCreate(Bundle savedInstanceState)
- linux下使用python进行opencv开发
- 关于栈的习题的解答
- 控制随机抽中几率 [ C# | Random ]
- 服务器双网卡的作用
- 编程原则
- ldd3 scull代码理解
- UNIX 环境高级编程之我见