自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

渣渣

一个IT愤青的自我告白

  • 博客(20)
  • 资源 (1)
  • 收藏
  • 关注

原创 LeetCode Sum Root to Leaf Numbers

题目:Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number.An example is the root-to-leaf path 1->2->3 which represents the number 123.Find

2015-11-30 19:44:15 285

原创 LeetCode Path Sum II

题目:Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum.For example:Given the below binary tree and sum = 22, 5

2015-11-30 10:12:39 253

原创 LeetCode Construct Binary Tree from Inorder and Postorder Traversal

题目:Given inorder and postorder traversal of a tree, construct the binary tree.题意:给定一棵树的中序遍历和后序遍历序列,求这棵二叉树的结构。题解:首先我们可以确定中序遍历和后序遍历是可以唯一确定一棵二叉树的,然后此题和之前的通过先序和中序遍历序列确定二叉树类似,都是通过递归来做,那么具体还是有一些

2015-11-26 11:18:57 273

原创 LeetCode Construct Binary Tree from Preorder and Inorder Traversal

题目:Given preorder and inorder traversal of a tree, construct the binary tree.题意:根据一棵树的前序遍历和中序遍历结果,来构建一棵二叉树。题解:首先此题一般用递归来做,怎么分析出用递归呢?此题在《剑指offer》一书中,有讲到。因为在前序遍历中,第一个节点往往是根节点,那么我们在中序遍历的序列中也找

2015-11-25 09:32:00 370

原创 LeetCode Range Sum Query 2D - Immutable

题目:Given a 2D matrix matrix, find the sum of the elements inside the rectangle defined by its upper left corner (row1, col1) and lower right corner (row2, col2).The above rectangle (with t

2015-11-23 22:33:45 263

原创 LeetCode Triangle

题目:Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below.For example, given the following triangle[ [2], [3

2015-11-23 20:48:57 259

原创 LeetCode Product of Array Except Self

题目:Given an array of n integers where n > 1, nums, return an array output such that output[i] is equal to the product of all the elements of nums except nums[i].Solve it without division

2015-11-22 21:50:31 263

原创 LeetCode House Robber I and II

在这里,我将这两题放在一起来解决,因为这两道都是在Dynamic Programming(动态规划)的类型里面,所以放在一起比较好,只是第二题比第一题多了一个条件,其他都是一样的。首先是第一题:You are a professional robber planning to rob houses along a street. Each house has a certain a

2015-11-21 22:40:44 266

原创 LeetCode Unique Paths II

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 marked as 1 and 0 respectively in the

2015-11-21 10:10:24 268

原创 LeetCode Unique Paths

题目:A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below).The robot can only move either down or right at any point in time. The robot is trying to r

2015-11-19 21:01:16 252

原创 LeetCode Minimum Path Sum

题目:Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its path.Note: You can only move either down or

2015-11-18 09:04:43 254

原创 LeetCode Longest Increasing Subsequence

题目:Given an unsorted array of integers, find the length of longest increasing subsequence.For example,Given [10, 9, 2, 5, 3, 7, 101, 18],The longest increasing subsequence is [2, 3, 7, 1

2015-11-17 21:17:33 380

原创 LeetCode Linked List Cycle

题目: Given a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using extra space?题意:给定一个单链表,然后确定在这个单链表中是否存在环?发现这道题在面试中经常会出现,因为是单链表,所以要么出现环,要么就没有出现,没有第三种情况出现。所...

2015-11-15 11:31:19 335

原创 LeetCode Missing Number

题目:Given an array containing n distinct numbers taken from 0, 1, 2, ..., n, find the one that is missing from the array.For example,Given nums = [0, 1, 3] return 2.Note:Your algori

2015-11-13 10:49:14 309

原创 二进制的位运算

最近在看面试书的时候,经常看到关于一个数字的位运算,比如求一个十进制数转化成二进制后的1的个数,可以采用下面这种做法,将要求的那个数字n和1做比较,然后判断最低位是不是1,;接着把1左移一位得到2,再和n做位运算,,就能判断n的次低位是不是1,这样反复左移,每次就能判断n的其中一位是不是1。public class Test{ public static int Number(int

2015-11-12 10:57:02 528

原创 二叉树的各种遍历算法的递归和非递归实现

二叉树在数据结构中是非常常用的,尤其是关于它的各种遍历算法,经常有关于递归和非递归的实现。下面来一一介绍各种遍历方式。下面是先序遍历:先序遍历:首先遍历根节点,然后再遍历左子树,再遍历右子树,那么如果采用递归来遍历,就是首先每一次先输出那个根节点的值,然后接着采用递归方式来遍历。代码如下:class TreeNode{ int val; TreeN

2015-11-08 14:53:00 521

原创 LeetCode Integer to Roman

题目:Given an integer, convert it to a roman numeral.Input is guaranteed to be within the range from 1 to 3999.题意:就是给定一个整数,将其转化为一个罗马数字。其中确保这个整数是在1到3999的范围内。因为看罗马数字的定义,发现其实如果罗马数字比较大,那么就

2015-11-05 11:07:37 274

原创 LeetCode Single Number

题目:Given an array of integers, every element appears twice except for one. Find that single one.Note:Your algorithm should have a linear runtime complexity. Could you implement it without

2015-11-04 23:39:15 270

原创 LeetCode Bulls and Cows

题目:You are playing the following Bulls and Cows game with your friend: You write a 4-digit secret number and ask your friend to guess it. Each time your friend guesses a number, you give a hin

2015-11-04 00:13:08 372

原创 LeetCode Excel Sheet Column Title

题目:Given a positive integer, return its corresponding column title as appear in an Excel sheet.For example: 1 -> A 2 -> B 3 -> C ... 26 -> Z 27 -> AA 28 -> AB

2015-11-01 13:25:15 296

开发Struts应用的步骤及中文乱码处理.doc

这个是一个关于Struts1.x的中文乱码的处理文档,可以帮助我们有效地处理中文乱码问题。

2015-07-04

空空如也

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

TA关注的人

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