Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

日刷leetcode--简单版(三) | 墨殇的技术博客 #26

Open
gooohlan opened this issue Jul 13, 2021 · 0 comments
Open

日刷leetcode--简单版(三) | 墨殇的技术博客 #26

gooohlan opened this issue Jul 13, 2021 · 0 comments

Comments

@gooohlan
Copy link
Owner

https://www.inkdp.cn/leetcode3.html

返回总目录日刷leetcode–简单版 58. 最后一个单词的长度题目描述 解题思路 定义一个变量统计,从前往后遍历,遇到空格归零就可以了,注意处理最后几个个字符全为空格的情况 定义一个变量统计,从后往前便利,虽然时间复杂度同为 O(n),但是第二个明显快很多 示例代码1234567891011121314func lengthOfLastWord(s string) int {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant