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

2019年7月9日

摘要: problem 1103. Distribute Candies to People solution:没看明白代码。。。 参考 1. Leetcode_easy_1103. Distribute Candies to People; 2. Discuss; 完 阅读全文
posted @ 2019-07-09 14:37 鹅要长大 阅读(159) 评论(0) 推荐(0)
摘要: problem 1108. Defanging an IP Address solution: 参考 1. Leetcode_easy_1108. Defanging an IP Address; 完 阅读全文
posted @ 2019-07-09 14:34 鹅要长大 阅读(126) 评论(0) 推荐(0)

2019年7月1日

摘要: problem 746. Min Cost Climbing Stairs 题意: solution1:动态规划; 定义一个一维的dp数组,其中dp[i]表示爬到第i层的最小cost,然后来想dp[i]如何推导。思考一下如何才能到第i层呢?是不是只有两种可能性,一个是从第i-2层上直接跳上来,一个是 阅读全文
posted @ 2019-07-01 17:02 鹅要长大 阅读(168) 评论(0) 推荐(0)
摘要: problem 744. Find Smallest Letter Greater Than Target 题意:一堆有序的字母,然后又给了一个target字母,让求字母数组中第一个大于target的字母,数组是循环的,如果没有,那就返回第一个字母。 solution1:注意数组已经是有序数组啦。。 阅读全文
posted @ 2019-07-01 16:59 鹅要长大 阅读(157) 评论(0) 推荐(0)
摘要: problem 733. Flood Fill 题意:图像处理中的泛洪填充算法,常见的有四邻域像素填充法、八邻域像素填充法、基于扫描线的像素填充法,实现方法分为递归与非递归(基于栈)。 泛洪填充算法原理:从某个像素点开始,将封闭区域内的所有此像素值位置的元素填充为新颜色。 solution1: 递归 阅读全文
posted @ 2019-07-01 16:58 鹅要长大 阅读(326) 评论(0) 推荐(0)
摘要: problem 728. Self Dividing Numbers solution1: 使用string类型来表示每位上的数字; solution2: 使用数学计算来check每一个数字; 问题1:求解余数的语句; 问题2:需要先求解一次余数,再计算除数,即下一次计算需要用到的被除数。 参考 1 阅读全文
posted @ 2019-07-01 16:57 鹅要长大 阅读(165) 评论(0) 推荐(0)
摘要: problem 724. Find Pivot Index 题意:先求出数组的总和,然后维护一个当前数组之和curSum,然后对于遍历到的位置,用总和减去当前数字,看得到的结果是否是curSum的两倍,是的话,那么当前位置就是中枢点,返回即可;否则就将当前数字加到curSum中继续遍历,遍历结束后还 阅读全文
posted @ 2019-07-01 16:56 鹅要长大 阅读(125) 评论(0) 推荐(0)
摘要: problem 720. Longest Word in Dictionary 题意: solution1: BFS; solution2: 参考 1. Leetcode_easy_720. Longest Word in Dictionary; 2. Grandyang; 完 阅读全文
posted @ 2019-07-01 16:27 鹅要长大 阅读(190) 评论(0) 推荐(0)
摘要: problem 717. 1-bit and 2-bit Characters 题意:solution1: solution2:根据数组的特性计算。 参考 1. Leetcode_easy_717. 1-bit and 2-bit Characters; 2. Grandyang; 完 阅读全文
posted @ 2019-07-01 16:26 鹅要长大 阅读(159) 评论(0) 推荐(0)
摘要: problem 709. To Lower Case solution1: solution2: 参考 1. Leetcode_easy_709. To Lower Case; 2. Grandyang; 完 阅读全文
posted @ 2019-07-01 16:24 鹅要长大 阅读(131) 评论(0) 推荐(0)
摘要: problem 707. Design Linked List 参考 1. Leetcode_easy_707. Design Linked List; 完 阅读全文
posted @ 2019-07-01 16:22 鹅要长大 阅读(165) 评论(0) 推荐(0)
摘要: problem 706. Design HashMap solution1: solution2: 参考 1. Leetcode_easy_706. Design HashMap; 2. Grandyang; 完 阅读全文
posted @ 2019-07-01 16:21 鹅要长大 阅读(147) 评论(0) 推荐(0)
摘要: problem 705. Design HashSet 题意: solution1: solution2: 参考 1. Leetcode_easy_705. Design HashSet; 2. Grandyang; 完 阅读全文
posted @ 2019-07-01 16:19 鹅要长大 阅读(118) 评论(0) 推荐(0)
摘要: problem 704. Binary Search solution: 参考 1. Leetcode_easy_704. Binary Search; 完 阅读全文
posted @ 2019-07-01 16:18 鹅要长大 阅读(162) 评论(0) 推荐(0)

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 鹅要长大 阅读(159) 评论(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 鹅要长大 阅读(126) 评论(0) 推荐(0)
摘要: problem 697. Degree of an Array 题意:首先是原数组的度,其次是和原数组具有相同的度的最短子数组。那么最短子数组就相当于子数组的首末数字都是统计度的数字。 solution1: solution2: 参考 1. Leetcode_easy_697. Degree of 阅读全文
posted @ 2019-06-26 17:53 鹅要长大 阅读(209) 评论(0) 推荐(0)
摘要: problem 696. Count Binary Substrings 题意:具有相同个数的1和0的连续子串的数目; solution1:还不是特别理解。。。 遍历元数组,如果是第一个数字,那么对应的ones或zeros自增1。然后进行分情况讨论,如果当前数字是1,然后判断如果前面的数字也是1,则 阅读全文
posted @ 2019-06-26 17:52 鹅要长大 阅读(215) 评论(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 鹅要长大 阅读(217) 评论(0) 推荐(0)
摘要: problem 690. Employee Importance 题意:所有下属和自己的重要度之和,所有下属包括下属的下属即直接下属和间接下属。 solution:DFS; solution:BFS; 参考 1. Leetcode_easy_690. Employee Importance; 2. 阅读全文
posted @ 2019-06-26 17:49 鹅要长大 阅读(140) 评论(0) 推荐(0)
上一页 1 ··· 28 29 30 31 32 33 34 35 36 ··· 54 下一页

导航