Leetcode
文章平均质量分 52
bakergus
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
118. Pascal's Triangle
Given numRows, generate the first numRows of Pascal’s triangle.For example, given numRows = 5, Return[ [1], [1,1], [1,2,1], [1,3,3,1], [1,4,6,4,1] ]思路: 首先定义一个二位vector,也就是vector原创 2016-11-13 09:54:24 · 265 阅读 · 0 评论 -
121. Best Time to Buy and Sell Stock
Say you have an array for which the ith element is the price of a given stock on day i.If you were only permitted to complete at most one transaction (ie, buy one and sell one share of the stock), desi原创 2016-11-13 12:51:43 · 339 阅读 · 0 评论 -
122. Best Time to Buy and Sell Stock II
Say you have an array for which the i th element is the price of a given stock on day i.Design an algorithm to find the maximum profit. You may complete as many transactions as you like (ie, buy one an原创 2016-11-13 13:01:47 · 446 阅读 · 0 评论 -
123. Best Time to Buy and Sell Stock III
Say you have an array for which the ith element is the price of a given stock on day i.Design an algorithm to find the maximum profit. You may complete at most two transactions.Note: You may not engag原创 2016-11-13 13:53:12 · 265 阅读 · 0 评论 -
188. Best Time to Buy and Sell Stock IV
Say you have an array for which the ith element is the price of a given stock on day i.Design an algorithm to find the maximum profit. You may complete at most k transactions.Note: You may not engage原创 2016-11-14 07:20:47 · 260 阅读 · 0 评论 -
169. Majority Element
Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times.You may assume that the array is non-empty and the majority element always原创 2016-11-16 07:53:17 · 264 阅读 · 0 评论 -
189. Rotate Array
Rotate an array of n elements to the right by k steps.For example, with n = 7 and k = 3, the array [1,2,3,4,5,6,7] is rotated to [5,6,7,1,2,3,4].Note: Try to come up as many solutions as you can, ther原创 2016-11-17 13:35:02 · 374 阅读 · 0 评论 -
217. Contains Duplicate
Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice in the array, and it should return false if every element is原创 2016-11-17 16:09:35 · 281 阅读 · 0 评论 -
119. Pascal's Triangle II
Given an index k, return the kth row of the Pascal’s triangle.For example, given k = 3, Return [1,3,3,1].Note: Could you optimize your algorithm to use only O(k) extra space?思路: 这道题目是118. Pascal’s T原创 2016-11-13 10:15:44 · 290 阅读 · 0 评论 -
88. Merge Sorted Array
Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array.Note: You may assume that nums1 has enough space (size that is greater or equal to m + n) to hold additional原创 2016-11-13 09:42:29 · 324 阅读 · 0 评论 -
1.Two Sum
Click here to try this problem on LeetcodeProblems with tag: Array Problems with tag : Hash Table Given an array of integers, return indices of the two numbers such that they add up to a specific tar原创 2016-11-12 23:59:49 · 237 阅读 · 0 评论 -
2. Add Two Numbers
Click here to try this problem on LeetcodeProblems with tag “Linked List”:Linked List的head,是一个指针,里面存储了链表的第一个节点的内存地址。 有了head指针以后,在第一个节点前面插入或者删除第一个节点,操作就和对其他节点的操作统一了。不管链表是否为空,head指针一定不为空。.You are given a target value to search. If found in the array return its index原创 2016-11-13 08:54:00 · 308 阅读 · 0 评论 -
66. Plus One
Given a non-negative number represented as an array of digits, plus one to the number. The digits are stored such that the most significant digit is at the head of the list.思路: 作为一道Array的题目,这个题目比较简单。原创 2016-11-13 09:21:41 · 229 阅读 · 0 评论 -
分类一:Best Time to Buy and Sell Stock I/ II/ III/ IV/ with Cooldown
121 Best Time to Buy and Sell Stock 122 Best Time to Buy and Sell Stock II 123 Best Time to Buy and Sell Stock III 188 Best Time to Buy and Sell Stock IV 309 Best Time to Buy and Sell Stock with C原创 2016-11-30 17:06:54 · 348 阅读 · 0 评论
分享