随笔分类 -  leetcode

上一页 1 ··· 7 8 9 10 11 12 13 14 15 ··· 19 下一页

【Leetcode_easy】748. Shortest Completing Word
摘要:problem 748. Shortest Completing Word 题意: solution1: class Solution { public: string shortestCompletingWord(string licensePlate, vector<string>& words 阅读全文

posted @ 2019-07-11 17:47 鹅要长大 阅读(196) 评论(0) 推荐(0)

【Leetcode_easy】754. Reach a Number
摘要:problem 754. Reach a Number solution1: solution2: solution3:solution1的精简版; 参考 1. Leetcode_easy_754. Reach a Number; 2. Grandyang; 完 阅读全文

posted @ 2019-07-11 17:47 鹅要长大 阅读(169) 评论(0) 推荐(0)

【Leetcode_easy】747. Largest Number At Least Twice of Others
摘要:problem 747. Largest Number At Least Twice of Others 题意: solution1: solution2: 参考 1. Leetcode_easy_747. Largest Number At Least Twice of Others; 2. Gr 阅读全文

posted @ 2019-07-11 17:45 鹅要长大 阅读(168) 评论(0) 推荐(0)

【Leetcode_easy】1089. Duplicate Zeros
摘要:problem 1089. Duplicate Zeros 题意: solution: 其中关于虚拟新数组的下标的计算还是有点迷糊。。。 参考 1. Leetcode_easy_1089. Duplicate Zeros; 2. discuss; 完 阅读全文

posted @ 2019-07-10 14:18 鹅要长大 阅读(171) 评论(0) 推荐(0)

【Leetcode_easy】1103. Distribute Candies to People
摘要:problem 1103. Distribute Candies to People solution:没看明白代码。。。 参考 1. Leetcode_easy_1103. Distribute Candies to People; 2. Discuss; 完 阅读全文

posted @ 2019-07-09 14:37 鹅要长大 阅读(162) 评论(0) 推荐(0)

【Leetcode_easy】1108. Defanging an IP Address
摘要:problem 1108. Defanging an IP Address solution: 参考 1. Leetcode_easy_1108. Defanging an IP Address; 完 阅读全文

posted @ 2019-07-09 14:34 鹅要长大 阅读(132) 评论(0) 推荐(0)

【Leetcode_easy】746. Min Cost Climbing Stairs
摘要:problem 746. Min Cost Climbing Stairs 题意: solution1:动态规划; 定义一个一维的dp数组,其中dp[i]表示爬到第i层的最小cost,然后来想dp[i]如何推导。思考一下如何才能到第i层呢?是不是只有两种可能性,一个是从第i-2层上直接跳上来,一个是 阅读全文

posted @ 2019-07-01 17:02 鹅要长大 阅读(172) 评论(0) 推荐(0)

【Leetcode_easy】744. Find Smallest Letter Greater Than Target
摘要:problem 744. Find Smallest Letter Greater Than Target 题意:一堆有序的字母,然后又给了一个target字母,让求字母数组中第一个大于target的字母,数组是循环的,如果没有,那就返回第一个字母。 solution1:注意数组已经是有序数组啦。。 阅读全文

posted @ 2019-07-01 16:59 鹅要长大 阅读(161) 评论(0) 推荐(0)

【Leetcode_easy】733. Flood Fill
摘要:problem 733. Flood Fill 题意:图像处理中的泛洪填充算法,常见的有四邻域像素填充法、八邻域像素填充法、基于扫描线的像素填充法,实现方法分为递归与非递归(基于栈)。 泛洪填充算法原理:从某个像素点开始,将封闭区域内的所有此像素值位置的元素填充为新颜色。 solution1: 递归 阅读全文

posted @ 2019-07-01 16:58 鹅要长大 阅读(329) 评论(0) 推荐(0)

【Leetcode_easy】728. Self Dividing Numbers
摘要:problem 728. Self Dividing Numbers solution1: 使用string类型来表示每位上的数字; solution2: 使用数学计算来check每一个数字; 问题1:求解余数的语句; 问题2:需要先求解一次余数,再计算除数,即下一次计算需要用到的被除数。 参考 1 阅读全文

posted @ 2019-07-01 16:57 鹅要长大 阅读(170) 评论(0) 推荐(0)

【Leetcode_easy】724. Find Pivot Index
摘要:problem 724. Find Pivot Index 题意:先求出数组的总和,然后维护一个当前数组之和curSum,然后对于遍历到的位置,用总和减去当前数字,看得到的结果是否是curSum的两倍,是的话,那么当前位置就是中枢点,返回即可;否则就将当前数字加到curSum中继续遍历,遍历结束后还 阅读全文

posted @ 2019-07-01 16:56 鹅要长大 阅读(127) 评论(0) 推荐(0)

【Leetcode_easy】720. Longest Word in Dictionary
摘要: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 鹅要长大 阅读(196) 评论(0) 推荐(0)

【Leetcode_easy】717. 1-bit and 2-bit Characters
摘要: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 鹅要长大 阅读(160) 评论(0) 推荐(0)

【Leetcode_easy】709. To Lower Case
摘要:problem 709. To Lower Case solution1: solution2: 参考 1. Leetcode_easy_709. To Lower Case; 2. Grandyang; 完 阅读全文

posted @ 2019-07-01 16:24 鹅要长大 阅读(135) 评论(0) 推荐(0)

【Leetcode_easy】707. Design Linked List
摘要:problem 707. Design Linked List 参考 1. Leetcode_easy_707. Design Linked List; 完 阅读全文

posted @ 2019-07-01 16:22 鹅要长大 阅读(167) 评论(0) 推荐(0)

【Leetcode_easy】706. Design HashMap
摘要:problem 706. Design HashMap solution1: solution2: 参考 1. Leetcode_easy_706. Design HashMap; 2. Grandyang; 完 阅读全文

posted @ 2019-07-01 16:21 鹅要长大 阅读(149) 评论(0) 推荐(0)

【Leetcode_easy】705. Design HashSet
摘要:problem 705. Design HashSet 题意: solution1: solution2: 参考 1. Leetcode_easy_705. Design HashSet; 2. Grandyang; 完 阅读全文

posted @ 2019-07-01 16:19 鹅要长大 阅读(121) 评论(0) 推荐(0)

【Leetcode_easy】704. Binary Search
摘要:problem 704. Binary Search solution: 参考 1. Leetcode_easy_704. Binary Search; 完 阅读全文

posted @ 2019-07-01 16:18 鹅要长大 阅读(164) 评论(0) 推荐(0)

【Leetcode_easy】703. Kth Largest Element in a Stream
摘要: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 鹅要长大 阅读(164) 评论(0) 推荐(0)

【Leetcode_easy】700. Search in a Binary Search Tree
摘要:problem 700. Search in a Binary Search Tree 参考1. Leetcode_easy_700. Search in a Binary Search Tree; 完 阅读全文

posted @ 2019-06-26 17:54 鹅要长大 阅读(131) 评论(0) 推荐(0)

上一页 1 ··· 7 8 9 10 11 12 13 14 15 ··· 19 下一页

导航