码迷,mamicode.com
首页 >  
搜索关键字:given a n n matrix    ( 24496个结果
LeetCode OJ - Minimum && Maximum Depth of Binary Tree
这两道题用递归的解法都很简单,只是稍有不同。下面是AC代码: 1 /** 2 * Given a binary tree, find its minimum depth. 3 * the minimum depth is the number of nodes along th...
分类:其他好文   时间:2014-05-10 08:47:32    阅读次数:271
LeetCode OJ - construct Binary Tree from Inorder and Postorder/Preorder Traversal
不断递归的实现!!!!下面是AC代码: 1 /** 2 * Given inorder and postorder traversal of a tree, construct the binary tree. 3 * @param inorder 4 * @param...
分类:其他好文   时间:2014-05-10 08:40:40    阅读次数:297
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 fol...
分类:其他好文   时间:2014-05-08 21:08:25    阅读次数:407
水题一枚
Description Given a code (not optimized), and necessary inputs, you have to find the output of the code for the inputs. The code is as follows: int a,...
分类:其他好文   时间:2014-05-07 09:56:16    阅读次数:310
Leetcode | 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.For example:Given the below binary tree, 1 ...
分类:其他好文   时间:2014-05-07 09:36:09    阅读次数:300
LeetCode OJ - Validate Binary Search Tree
验证二叉树是否是查找树,可以通过查看它的中序遍历是否是升序的。下面是AC代码: 1 /** 2 * Given a binary tree, determine if it is a valid binary search tree (BST). 3 * solution : 4...
分类:其他好文   时间:2014-05-07 09:01:45    阅读次数:250
HDU1806 Frequent values
Problem Description You are given a sequence of n integers a1 , a2 , ... , an in non-decreasing order. In addition to that, you are given several queries consisting of indices i and j (1 ≤ i ≤ j ≤ ...
分类:其他好文   时间:2014-05-07 07:59:11    阅读次数:309
[容斥原理] zoj 2836 Number Puzzle
题目链接: http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=1836 Number Puzzle Time Limit: 2 Seconds      Memory Limit: 65536 KB Given a list of integers (A1, A2, ..., An), and a posi...
分类:其他好文   时间:2014-05-07 07:42:49    阅读次数:332
【Leetcode】3Sum
【Question】 Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero. Note: Elements in ...
分类:其他好文   时间:2014-05-06 14:57:29    阅读次数:318
LeetCode::Trapping Rain Water
1、到今天完成39题,还需要不停的加油。今天再分析下装雨水这道题Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water i...
分类:移动开发   时间:2014-05-06 14:08:48    阅读次数:490
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!