162. Find Peak Element

A peak element is an element that is greater than its neighbors. Given an input array where num[i] ≠ num[i+1], find a peak element and return its ...

2017-09-13 12:44:36

阅读数 134

评论数 0

154. Find Minimum in Rotated Sorted Array II

Follow up for "Find Minimum in Rotated Sorted Array": What if duplicates are allowed? Would this affect the run-time complexity? How and ...

2017-09-13 12:22:32

阅读数 168

评论数 1

153. Find Minimum in Rotated Sorted Array

Suppose an array sorted in ascending order 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)....

2017-09-13 11:24:18

阅读数 209

评论数 1

152. 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,...

2017-09-13 11:08:19

阅读数 165

评论数 1

binary tree traver

1. preorder travel class Solution { public: vector preorderTraversal(TreeNode* root) { vector result; stack myStack; Tre...

2017-09-12 15:51:55

阅读数 146

评论数 1

139. Word Break

Given a non-empty string s and a dictionary wordDict containing a list of non-empty words, determine if s can be segmented into a space-separated s...

2017-09-11 21:16:19

阅读数 145

评论数 1

137. Single Number II

Given an array of integers, every element appears three times except for one, which appears exactly once. Find that single one. Note: Your algo...

2017-09-11 18:53:57

阅读数 147

评论数 1

135. 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 followin...

2017-09-11 16:31:01

阅读数 98

评论数 1

134. 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 ...

2017-09-11 15:30:33

阅读数 141

评论数 1

131. 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 exa...

2017-09-10 16:29:25

阅读数 120

评论数 1

刷题七

给定一个N位数,例如12345,从里面去掉k个数字,得到一个N-k位的数,例如去掉2,4,得到135,去掉1,5,得到234。设计算法,求出所有得到的N-k位数里面最小的那一个? class Solution{ bool myFunc(vector & array, int m,...

2017-09-05 21:17:25

阅读数 187

评论数 0

刷题六

求最大连续子序列和 #include #include #include "math.h" #include "limits.h" using namespace std; class Solution{ public: int my...

2017-09-05 19:17:52

阅读数 152

评论数 0

刷题五

字符串A和字符串B。是否B包含了A所有的字符 #include #include using namespace std; class Solution{ public: bool myCheck(string & str1, string & str2){...

2017-09-05 16:59:02

阅读数 134

评论数 0

刷题四

两个有序链表的合并 class Solution{ public: Node * myMerge(Node * list1, Node * list2){ if(list1 == null) return list2; if(list2 == nu...

2017-09-05 16:45:47

阅读数 102

评论数 0

刷题三

给出一串数字,判断是否为有效二叉查找树的后序遍历序列(及是否能够通过这串后序遍历序列构造出二叉查找树) #include #include using namespace std; class Solution{ public: bool myCheck(vector &a...

2017-09-05 16:13:52

阅读数 103

评论数 0

刷题二

实现带有重复元素的二分查找,如果查找的元素重复,返回重复元素的起始位置。 #include #include using namespace std; class Solution{ public: int binarySearch(vector & array, ...

2017-09-05 15:37:12

阅读数 114

评论数 0

刷题

对于数组A[0,1,2,3,4,...,k],求得0 #include #include #include "math.h" using namespace std; class Solution{ public: bool maxSum(vector ...

2017-09-05 15:08:25

阅读数 143

评论数 0

130. Surrounded Regions

Given a 2D board containing 'X' and 'O' (the letter O), capture all regions surrounded by 'X'. A region is captured by flipping all 'O's into 'X...

2017-06-27 15:16:08

阅读数 105

评论数 0

127. Word Ladder

Given two words (beginWord and endWord), and a dictionary's word list, find the length of shortest transformation sequence from beginWord to endWord,...

2017-06-27 11:06:56

阅读数 200

评论数 1

下次涨点记性吧

到今天,一波实习已经结束了,国内公司倒了一片,好在还有微软。虽然转正不易,但能去实习我也知足了。 回顾长达两个月的实习厮杀,自己前期准备的太少,导致前面的面试都非常不理想。 2月13号开学,那会儿只是单纯的刷刷LeetCode,因为之前完全没刷过,同桌已经刷了半年,拼命赶进度,差不多刷了两周,...

2017-04-27 17:17:50

阅读数 270

评论数 0

提示
确定要删除当前文章?
取消 删除
关闭
关闭