自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 [LeetCode] Binary Tree Preorder Traversal

The recursive method is trivial. Just record the root and go left and go right. To do it iteratively, we need a stack to record the path. We go left until it's null. And pop the back out then go

2015-10-29 04:42:25 181

原创 [LeetCode] Paint House

This is a DP problem. Actually, most problems with minimum or maximum are DP. One thing need to notice in this problem is the symmetric. Paint from the first one is equal with paint from the last one.

2015-10-29 03:57:04 207

原创 [LeetCode] Product of Array Except Self

This problem is easy if we can use divide. The idea is get the product of all numbers and divide each of them to get the result we want. Linear time and constant space. Here we can't use this met

2015-10-29 00:31:22 149

原创 [LeetCode] Single Number III

This problem can also be solved using Hash map and this idea is quite simple on implementation. But how to do it in linear time and constant space?  First of all, we know that if we do XOR t

2015-10-28 23:45:40 204

原创 [LeetCode] Best Time to Buy and Sell Stock II

The difference with previous one is: this time we can buy and sell the share multiple times. We can use greedy to solve this problem. Every time, if we have a local minimum, we buy it and sell it at t

2015-10-28 23:35:59 201

原创 [LeetCode] Best Meeting Point

Problem Description: A group of two or more people wants to meet and minimize the total travel distance. You are given a 2D grid of values 0 or 1, where each 1 marks the home of someone in the grou

2015-10-28 11:42:38 264

原创 [LeetCode] Two Sum II – Input array is sorted

This problem is similar with Two Sum. The solution is easy. Since they are sorted, we only need to get two pointers that point to head and tail respectively. Then move head one if the sum is smaller

2015-10-28 08:57:24 196

原创 [LeetCode] Wiggle Sort

Given an unsorted array nums, reorder it in-place such that nums[0] = nums[2] . For example, given nums = [3, 5, 2, 1, 6, 4], one possible answer is [1, 6, 2, 5, 3, 4]. For the given example,

2015-10-28 06:47:46 136

原创 LeetCode, Single Number

Given an array, each number appears twice except one, find that single one.  First thinking is using Hash map, the key is each number and the value is their appearance times. This is a very intui

2015-10-28 03:29:25 144

空空如也

空空如也

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

TA关注的人

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