上一页 1 ··· 28 29 30 31 32 33 34 35 36 ··· 53 下一页

2019年6月26日

摘要: problem 703. Kth Largest Element in a Stream 题意: solution1: priority_queue这个类型没有看明白。。。 参考 1. Leetcode_easy_703. Kth Largest Element in a Stream; 2. Gr 阅读全文
posted @ 2019-06-26 17:55 鹅要长大 阅读(151) 评论(0) 推荐(0) 编辑
摘要: problem 700. Search in a Binary Search Tree 参考1. Leetcode_easy_700. Search in a Binary Search Tree; 完 阅读全文
posted @ 2019-06-26 17:54 鹅要长大 阅读(104) 评论(0) 推荐(0) 编辑
摘要: problem 697. Degree of an Array 题意:首先是原数组的度,其次是和原数组具有相同的度的最短子数组。那么最短子数组就相当于子数组的首末数字都是统计度的数字。 solution1: solution2: 参考 1. Leetcode_easy_697. Degree of 阅读全文
posted @ 2019-06-26 17:53 鹅要长大 阅读(198) 评论(0) 推荐(0) 编辑
摘要: problem 696. Count Binary Substrings 题意:具有相同个数的1和0的连续子串的数目; solution1:还不是特别理解。。。 遍历元数组,如果是第一个数字,那么对应的ones或zeros自增1。然后进行分情况讨论,如果当前数字是1,然后判断如果前面的数字也是1,则 阅读全文
posted @ 2019-06-26 17:52 鹅要长大 阅读(207) 评论(0) 推荐(0) 编辑
摘要: problem 693. Binary Number with Alternating Bits solution1: solution2: 通过异或操作判断最低位是否在0/1之间转换进行。 参考 1. Leetcode_easy_693. Binary Number with Alternatin 阅读全文
posted @ 2019-06-26 17:50 鹅要长大 阅读(207) 评论(0) 推荐(0) 编辑
摘要: problem 690. Employee Importance 题意:所有下属和自己的重要度之和,所有下属包括下属的下属即直接下属和间接下属。 solution:DFS; solution:BFS; 参考 1. Leetcode_easy_690. Employee Importance; 2. 阅读全文
posted @ 2019-06-26 17:49 鹅要长大 阅读(134) 评论(0) 推荐(0) 编辑
摘要: problem 687. Longest Univalue Path 参考 1. Leetcode_easy_687. Longest Univalue Path; 2. Grandyang; 完 阅读全文
posted @ 2019-06-26 17:47 鹅要长大 阅读(106) 评论(0) 推荐(0) 编辑
摘要: problem 686. Repeated String Match solution1: 使用string类的find函数; solution2: 其实可以直接算出最多需要增加的个数,即B的长度除以A的长度再加上2,当B小于A的时候,那么可能需要两个A,所以i就是小于等于2,这样每次在t中找B,如 阅读全文
posted @ 2019-06-26 17:46 鹅要长大 阅读(93) 评论(0) 推荐(0) 编辑
摘要: problem 682. Baseball Game solution: 没想到使用vector! 参考 1. Leetcode_easy_682. Baseball Game; 2. Grandyang; 完 阅读全文
posted @ 2019-06-26 17:45 鹅要长大 阅读(154) 评论(0) 推荐(0) 编辑
摘要: problem 680. Valid Palindrome II solution: 不理解判断函数中的节点的问题。。。 参考 1. Leetcode_easy_680. Valid Palindrome II; 2. Grandyang; 3. C++ Easy to Understand Cle 阅读全文
posted @ 2019-06-26 17:44 鹅要长大 阅读(128) 评论(0) 推荐(0) 编辑
摘要: problem 674. Longest Continuous Increasing Subsequence solution solution2: 参考 1. Leetcode_easy_674. Longest Continuous Increasing Subsequence; 2. Gran 阅读全文
posted @ 2019-06-26 17:22 鹅要长大 阅读(138) 评论(0) 推荐(0) 编辑
摘要: problem 671. Second Minimum Node In a Binary Tree 参考 1. Leetcode_easy_671. Second Minimum Node In a Binary Tree; 完 阅读全文
posted @ 2019-06-26 17:21 鹅要长大 阅读(109) 评论(0) 推荐(0) 编辑
摘要: problem 669. Trim a Binary Search Tree 参考 1. Leetcode_easy_669. Trim a Binary Search Tree; 完 阅读全文
posted @ 2019-06-26 17:20 鹅要长大 阅读(90) 评论(0) 推荐(0) 编辑
摘要: problem 665. Non-decreasing Array 题意:是否能够将数组转换为非减数组。 solution: 难点在于理解如何对需要修改的元素进行赋值; 参考 1. Leetcode_easy_665. Non-decreasing Array; 完 阅读全文
posted @ 2019-06-26 17:19 鹅要长大 阅读(112) 评论(0) 推荐(0) 编辑
摘要: problem 661. Image Smoother 题意:其实类似于图像处理的均值滤波。 solution: 妙处在于使用了一个dirs变量来计算邻域数值,看起来更简洁! 参考 1. Leetcode_easy_661. Image Smoother; 完 阅读全文
posted @ 2019-06-26 17:15 鹅要长大 阅读(135) 评论(0) 推荐(0) 编辑
摘要: problem 657. Robot Return to Origin 题意: solution1: solution2: 参考 1. Leetcode_easy_657. Robot Return to Origin; 完 阅读全文
posted @ 2019-06-26 17:12 鹅要长大 阅读(143) 评论(0) 推荐(0) 编辑
摘要: problem 653. Two Sum IV - Input is a BST 参考 1. Leetcode_easy_653. Two Sum IV - Input is a BST; 完 阅读全文
posted @ 2019-06-26 17:10 鹅要长大 阅读(121) 评论(0) 推荐(0) 编辑

2019年6月25日

摘要: problem 645. Set Mismatch 题意: solution1: 统计每个数字出现的次数了,然后再遍历次数数组,如果某个数字出现了两次就是重复数,如果出现了0次,就是缺失数。 注意:如何统计每个数字出现的次数; solution2:相反数; 参考 1. Leetcode_easy_6 阅读全文
posted @ 2019-06-25 18:00 鹅要长大 阅读(155) 评论(0) 推荐(0) 编辑
摘要: problem 643. Maximum Average Subarray I 题意:一定长度的子数组的最大平均值。 solution1:计算子数组之后的常用方法是建立累加数组,然后再计算任意一定长度的子数组之和,迭代更新得到最大值。 注意:1)累加数组;2)数值类型; solution2: 子数组 阅读全文
posted @ 2019-06-25 17:59 鹅要长大 阅读(110) 评论(0) 推荐(0) 编辑
摘要: problem 637. Average of Levels in Binary Tree 参考 1. Leetcode_easy_637. Average of Levels in Binary Tree; 完 阅读全文
posted @ 2019-06-25 17:58 鹅要长大 阅读(114) 评论(0) 推荐(0) 编辑
上一页 1 ··· 28 29 30 31 32 33 34 35 36 ··· 53 下一页

导航