Fork me on GitHub
上一页 1 ··· 31 32 33 34 35
摘要: 计算给定二叉树的所有左叶子之和。示例: 3 / \ 9 20 / \ 15 7在这个二叉树中,有两个左叶子,分别是 9 和 15,所以返回 24 class Solution {public: in... 阅读全文
posted @ 2018-10-23 21:12 lMonster81 阅读(97) 评论(0) 推荐(0) 编辑
摘要: 给定一个字符串,找到它的第一个不重复的字符,并返回它的索引。如果不存在,则返回 -1。案例:s = "leetcode" 返回 0. s = "loveleetcode", 返回 2. 注意事项:您可以假定该字符串只包含小写字母。class Solution {pub... 阅读全文
posted @ 2018-10-23 21:09 lMonster81 阅读(90) 评论(0) 推荐(0) 编辑
摘要: 用1,2,3,...9组成3个3位数abc, def, ghi;每个数字恰好用一次,要求 abc:def :ghi = 1: 2 : 3;按照abc : def : ghi的格式输出。 通常想到的思路为枚举9个数, 然后再去判断;这样的话最小复杂度为9 * 9 * 9; 枚举消耗的时间相对来说较大, 阅读全文
posted @ 2017-03-30 10:57 lMonster81 阅读(222) 评论(1) 推荐(0) 编辑
摘要: A character string is said to have period k if it can be formed by concatenating one or more repetitions of another string of length k. For example, t 阅读全文
posted @ 2017-03-30 10:53 lMonster81 阅读(420) 评论(0) 推荐(0) 编辑
上一页 1 ··· 31 32 33 34 35
/*评论*/ /*top按钮*/

/* 网易云控件 */