自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 LeetCode: Edit Distance

应该是文本搜索里面最最基本的一个DP算法了。 题意很简单,比较两个字符串的相似度。你有三种更改字符串的方式:插入一个字符,删除一个字符,替换一个字符。 比如String A = abc,String B = ac 那么你可以通过在B中插入b使得String B与字符串A一样。但是必须返回操作数目最少的步骤, 比如String A = abcd String B = ccd 你可以把B去掉一个c然

2016-05-25 04:09:51 339

原创 Leetcode:Validate Binary Tree 判断一个二叉树是否为二叉搜索树

判断一个二叉树为二叉搜索树的四种算法分析。

2016-03-22 09:35:56 498

原创 Leetcode: Binary Tree Paths 从一道Easy题看Java String链接效率

从一到Leetcode简单题看Java字符串链接方法之间的效率差异

2016-03-21 06:53:55 454

原创 LintCode:Maximum Subarray III

题目: Maximum Subarray III 45:00  Start Given an array of integers and a number k, find knon-overlapping subarrays which have the largest sum. The number in each subarray

2016-03-02 08:55:16 1330

原创 LintCode:Add Two Numbers

You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a link

2016-02-21 07:00:49 546

原创 LintCode: Word Break

Word Break Show result  30:00  Start Given a string s and a dictionary of words dict, determine if s can be break into a space-separated sequence of one or more dictionary words.

2016-02-05 08:06:42 780

原创 Unique Path II

Unique Paths II Show result  Follow up for "Unique Paths": Now consider if some obstacles are added to the grids. How many unique paths would there be? An obstacle and empty space is m

2016-01-24 01:18:08 416

原创 Triangle: Dynamic Programming解法

研究了一会,贴上Triangle的Dynamic Programming的解法。 Dynamic Programming的解题其实一般有四个关键点: 1.定义:一般DP问题都是求出一个最优解,所以你首先要定义出一个最优解的定义。在这道题中设OPT[i][j]为从点( i,j )到顶点Triangle[0][0]的最短距离,当然解决问题的方向不一样最优解的定义一般也不一样。我这里选的是从上往下的

2016-01-23 14:15:00 300

原创 Triangle 递归解法

被402折磨的不要不要的。时隔了四年重新捡起了在学校公寓北门5块钱盗版的《C和指针》,突然觉得习惯了高级语言,重新静下心来研究C这样的底层语言有一种不一样的感觉,自己第一个接触的编程语言就是C,当时候指针引用这些概念理解的糊里糊涂的。现在突然觉得这种能吆喝操作系统还能吆喝硬件的语言还是有点牛逼的。 好了不废话了,上题!  Triangle Show result 

2016-01-23 10:44:57 526 1

原创 逐层宽度优先搜索(BFS)二叉树各种解法

BFS宽度优先搜索二叉树实事求是确实是很基本很基本的基本功了。 但是以前都只会在纸上画哈哈哈哈哈哈哈 今天终于耐下心来自己写代码跑一跑了。 Binary Tree Level Order Traversal Given a binary tree, return the level order traversal of its nodes' values

2016-01-14 08:02:24 820

原创 Binary Tree Maximum Path Sum Java 递归解法

原题:  Binary Tree Maximum Path Sum Given a binary tree, find the maximum path sum. The path may start and end at any node in the tree. Have you met this question in a real inter

2016-01-14 04:44:13 716

原创 立个FLAG 希望半年之后再看看自己的进步

最近看了很多文章,越来越觉得自己本科过得太颓废了,身边的大神那么多,感觉自己那种畸形的好胜心又被激发了出来,感觉自己不是一个努力的人,偶尔小勤奋一下会取得一点点成就然后错觉又会让自己懒惰下来,踏踏实实沉下心来学习吧,不要有那么多的功利心,让自己的青春有更多可以回味的东西。

2015-11-20 07:09:16 374

空空如也

空空如也

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

TA关注的人

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