自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(21)
  • 收藏
  • 关注

原创 分类之四:Tree

109 Convert Sorted List to Binary Search Tree 27.90% Medium 108 Convert Sorted Array to Binary Search Tree 34.00% Medium 107 Binary Tree Level Order Traversal II 31.10% Easy 106 Construct B

2016-12-17 00:49:44 316

原创 分类之三: Water

分类之三: 42 Trapping Rain Water 407 Trapping Rain Water II 11 Container With Most Water 84 Largest Rectangle in Histogram

2016-12-17 00:49:15 371

原创 分类之二:Hash Table-模板一:if...else mp[nums[i]] = i

分类之二:Hash Table-模板一: if(nums.find() != nums.end()) return … else mp[nums[i]] = i;

2016-12-17 00:47:10 721

原创 分类一: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 297

原创 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 241

原创 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 326

原创 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 221

原创 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 221

原创 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 216

原创 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 404

原创 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 294

原创 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 254

原创 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 205

原创 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 272

原创 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 187

原创 33. Search 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).You are given a target value to search. If found in the array return its index

2016-11-13 08:54:00 254

原创 80. Remove Duplicates from Sorted Array II

Click here to try this problem on Leetcode Follow up for “Remove Duplicates”: What if duplicates are allowed at most twice?For example, Given sorted array nums = [1,1,1,2,2,3],Your function should r

2016-11-13 00:46:19 213

原创 27. Remove Element

Click here to try this problem on Leetcode Given an array and a value, remove all instances of that value in place and return the new length.Do not allocate extra space for another array, you must do

2016-11-13 00:26:52 248

原创 26.Remove Duplicates from Sorted Array

Click here to try this problem on Leetcode Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length.Do not allocate extra space for anothe

2016-11-13 00:17:00 271

原创 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 198

原创 2. Add Two Numbers

Click here to try this problem on LeetcodeProblems with tag “Linked List”:Linked List的head,是一个指针,里面存储了链表的第一个节点的内存地址。 有了head指针以后,在第一个节点前面插入或者删除第一个节点,操作就和对其他节点的操作统一了。不管链表是否为空,head指针一定不为空。![这里写图片描述](http

2016-11-11 16:46:12 416

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

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