摘要: 以空格为分隔符,判断一个string可以被分成几部分。 注意几种情况:(1)全都是空格 (2)空字符串(3)结尾有空格 思路: 只要统计出单词的数量即可。那么我们的做法是遍历字符串,遇到空格直接跳过,如果不是空格,则计数器加1,然后用个while循环找到下一个空格的位置,这样就遍历完了一个单词,再重 阅读全文
posted @ 2018-02-19 23:11 Sherry_Yang 阅读(125) 评论(0) 推荐(0) 编辑
摘要: Given an array containing n distinct numbers taken from 0, 1, 2, ..., n, find the one that is missing from the array. Example 1 Example 2 阅读全文
posted @ 2018-02-19 23:09 Sherry_Yang 阅读(107) 评论(0) 推荐(0) 编辑
摘要: 题意大概是,找两个节点的最低公共祖先 阅读全文
posted @ 2018-02-19 19:03 Sherry_Yang 阅读(109) 评论(0) 推荐(0) 编辑
摘要: 题目一: 一个极其简单的动态规划。 参考一个很好的blog:http://www.cnblogs.com/grandyang/p/4383632.html 题目二:形成环 参考一个很好的blog:https://www.cnblogs.com/grandyang/p/4518674.html 题目三 阅读全文
posted @ 2018-02-19 11:56 Sherry_Yang 阅读(125) 评论(0) 推荐(0) 编辑