- 博客(19)
- 资源 (1)
- 收藏
- 关注
原创 Find Minimum in Rotated Sorted Array II
Suppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2).Find the minimum element.The array may contain duplicates.解
2015-02-10 14:36:39 575
原创 Maximum Product Subarray
Find the contiguous subarray within an array (containing at least one number) which has the largest product.For example, given the array [2,3,-2,4],the contiguous subarray [2,3] has the larg
2015-02-10 14:07:31 528
原创 Find Minimum in Rotated Sorted Array
Suppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2).Find the minimum element.You may assume no duplicate exists in
2015-02-07 12:52:32 533
原创 Binary Tree Inorder Traversal
Given a binary tree, return the inorder traversal of its nodes' values.For example:Given binary tree {1,#,2,3}, 1 \ 2 / 3return [1,3,2].解题思路:简单的中序非递归遍历,用栈实现;#i
2015-02-06 12:58:27 604
原创 Binary Tree Preorder Traversal
Given a binary tree, return the preorder traversal of its nodes' values.For example:Given binary tree {1,#,2,3}, 1 \ 2 / 3return [1,2,3].解题思路:先序遍历较为简单,直接按顺序存栈即可.
2015-02-06 12:44:39 503
原创 Binary Tree Postorder Traversal
Given a binary tree, return the postorder traversal of its nodes' values.For example:Given binary tree {1,#,2,3}, 1 \ 2 / 3return [3,2,1].解题思路:后序遍历的过程是首先左-右-父,首先
2015-02-06 12:37:15 606
原创 Word Break
Given a string s and a dictionary of words dict, determine if s can be segmented into a space-separated sequence of one or more dictionary words.For example, givens = "leetcode",dict = ["leet"
2015-02-05 19:21:02 605
原创 Copy List with Random Pointer
A linked list is given such that each node contains an additional random pointer which could point to any node in the list or null.Return a deep copy of the list.解题思路:简单的深拷贝思想,重点在于如何处理random结点
2015-02-05 14:29:16 465
原创 candy
There are N children standing in a line. Each child is assigned a rating value.You are giving candies to these children subjected to the following requirements:Each child must have at least on
2015-02-04 14:31:18 540
原创 Gas Station
There are N gas stations along a circular route, where the amount of gas at station i is gas[i].You have a car with an unlimited gas tank and it costs cost[i] of gas to travel from station i to
2015-02-04 13:47:46 514
原创 Set Matrix Zeroes
Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in place.解题思路:题目很简单,可就是没想到有什么高效的方法.我遍历了两遍vector,显得有点复杂.#include#includeusing namespace std;void setZeroes(v
2015-02-03 20:45:54 802
原创 Palindrome Partitioning II
Given a string s, partition s such that every substring of the partition is a palindrome.Return the minimum cuts needed for a palindrome partitioning of s.For example, given s = "aab",Retu
2015-02-03 19:24:47 573
原创 Palindrome Partitioning
Given a string s, partition s such that every substring of the partition is a palindrome.Return all possible palindrome partitioning of s.For example, given s = "aab",Return [ ["aa","
2015-02-03 14:16:43 493
原创 Rotate List
Given a list, rotate the list to the right by k places, where k is non-negative.For example:Given 1->2->3->4->5->NULL and k = 2,return 4->5->1->2->3->NULL.解题思路:一开始想到比较简单的方法是用哈希,建立一个索引与结点的m
2015-02-02 15:52:08 537
原创 Reverse Nodes in k-Group
Given a linked list, reverse the nodes of a linked list k at a time and return its modified list.If the number of nodes is not a multiple of k then left-out nodes in the end should remain as it is
2015-02-02 13:45:38 665
原创 Remove Duplicates from Sorted List
Given a sorted linked list, delete all duplicates such that each element appear only once.For example,Given 1->1->2, return 1->2.Given 1->1->2->3->3, return 1->2->3.解题思路:与之前刷过的一题有所不同,这里要求保
2015-02-02 12:38:35 609
原创 Directshow_驱动摄像头预览视频
出于兴趣一直以来都断断续续看过dshow的东西,可没怎么系统地总结过(学习还是要多实践,多总结啊).dshow预览摄像头捕捉的视频比较简单基础,网上相关的资料很多,简单的思路由下面代码所示:ICaptureGraphBuilder2 *pBuild; // Capture Graph Builder// Initialize pBuild (not shown).IBaseFilter
2015-02-01 23:16:17 1209
原创 Remove Nth Node From End of List
Given a linked list, remove the nth node from the end of list and return its head.For example, Given linked list: 1->2->3->4->5, and n = 2. After removing the second node from the end, the
2015-02-01 21:13:38 625
原创 Remove Duplicates from Sorted List II
Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list.For example,Given 1->2->3->3->4->4->5, return 1->2->5.Given 1->
2015-02-01 15:59:08 639
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人