2015年3月31日

[leetcode] House Robber

摘要: House RobberYou are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint... 阅读全文

posted @ 2015-03-31 20:16 cha1992 阅读(151) 评论(0) 推荐(0) 编辑

2015年3月24日

利用位运算实现加减乘除

摘要: 参考http://www.cnblogs.com/dandingyy/archive/2012/10/29/2745570.html和http://blog.csdn.net/hackbuteer1/article/details/7390093面试必备。#include#includeusing ... 阅读全文

posted @ 2015-03-24 13:38 cha1992 阅读(161) 评论(0) 推荐(0) 编辑

2015年3月15日

[leetcode] Best Time to Buy and Sell Stock IV

摘要: Best Time to Buy and Sell Stock IVSay you have an array for which theithelement is the price of a given stock on dayi.Design an algorithm to find the ... 阅读全文

posted @ 2015-03-15 10:57 cha1992 阅读(210) 评论(0) 推荐(0) 编辑

2015年3月11日

[leetcode] Number of 1 Bits

摘要: Number of 1 BitsWrite a function that takes an unsigned integer and returns the number of ’1' bits it has (also known as theHamming weight).For exampl... 阅读全文

posted @ 2015-03-11 10:16 cha1992 阅读(127) 评论(0) 推荐(0) 编辑

2015年3月7日

[poj]1088-滑雪

摘要: 滑雪思路:从leetcode过来要自己写输入输出,很不习惯,leetcode果然只是针对面试的。这个题目典型的动态规划,额外开辟一个二维数组f记录(i,j)点能够滑雪多少高度,最后f(i,j)中最大的值就是滑雪的最大高度。因为f(i,j)记录了相对高度,比如在求点(0,0)时,点(0,1)与点(1,... 阅读全文

posted @ 2015-03-07 11:28 cha1992 阅读(759) 评论(0) 推荐(0) 编辑

2015年2月7日

[leetcode] First Missing Positive

摘要: First Missing PositiveGiven an unsorted integer array, find the first missing positive integer.For example,Given[1,2,0]return3,and[3,4,-1,1]return2.Yo... 阅读全文

posted @ 2015-02-07 19:31 cha1992 阅读(129) 评论(0) 推荐(0) 编辑

2015年2月6日

[leetcode] Recover Binary Search Tree

摘要: Recover Binary Search TreeTwo elements of a binary search tree (BST) are swapped by mistake.Recover the tree without changing its structure.Note:A sol... 阅读全文

posted @ 2015-02-06 14:23 cha1992 阅读(161) 评论(0) 推荐(0) 编辑

2015年2月5日

[leetcode] Clone Graph

摘要: Clone GraphClone an undirected graph. Each node in the graph contains alabeland a list of itsneighbors.OJ's undirected graph serialization:Nodes are l... 阅读全文

posted @ 2015-02-05 17:30 cha1992 阅读(188) 评论(0) 推荐(0) 编辑

2015年2月4日

[leetcode] Anagrams

摘要: AnagramsGiven an array of strings, return all groups of strings that are anagrams.Note: All inputs will be in lower-case.思路:什么是anagrams?傻逼了,百度吧。一百度全是别... 阅读全文

posted @ 2015-02-04 21:48 cha1992 阅读(166) 评论(0) 推荐(0) 编辑

2015年2月2日

[leetcode] Copy List with Random Pointer

摘要: Copy List with Random PointerA linked list is given such that each node contains an additional random pointer which could point to any node in the lis... 阅读全文

posted @ 2015-02-02 10:50 cha1992 阅读(98) 评论(0) 推荐(0) 编辑

导航