01 2015 档案

[Jobdu] 题目1139:最大子矩阵
摘要:题目描述:已知矩阵的大小定义为矩阵中所有元素的和。给定一个矩阵,你的任务是找到最大的非空(大小至少是1 * 1)子矩阵。比如,如下4 * 4的矩阵0 -2 -7 09 2 -6 2-4 1 -4 1-1 8 0 -2的最大子矩阵是9 2-4 1-1 8这个子矩阵的大小是15。输入:输入是一个N * ... 阅读全文

posted @ 2015-01-29 14:04 Eason Liu 阅读(4576) 评论(0) 推荐(0)

[LeetCode] Clone Graph
摘要:Clone an undirected graph. Each node in the graph contains alabeland a list of itsneighbors.OJ's undirected graph serialization:Nodes are labeled uniq... 阅读全文

posted @ 2015-01-22 16:35 Eason Liu 阅读(169) 评论(0) 推荐(0)

[LeetCode] Binary Search Tree Iterator
摘要:Implement an iterator over a binary search tree (BST). Your iterator will be initialized with the root node of a BST.Callingnext()will return the next... 阅读全文

posted @ 2015-01-21 14:49 Eason Liu 阅读(180) 评论(0) 推荐(0)

[Jobdu] 题目1507:不用加减乘除做加法
摘要:题目描述:写一个函数,求两个整数之和,要求在函数体内不得使用+、-、*、/四则运算符号。输入:输入可能包含多个测试样例。对于每个测试案例,输入为两个整数m和n(1 2 3 int add(int a, int b) { 4 int n1, n2; 5 do { 6 ... 阅读全文

posted @ 2015-01-21 13:26 Eason Liu 阅读(516) 评论(0) 推荐(0)

[LeetCode] Dungeon Game
摘要:The demons had captured the princess (P) and imprisoned her in the bottom-right corner of a dungeon. The dungeon consists of M x N rooms laid out in a... 阅读全文

posted @ 2015-01-20 22:42 Eason Liu 阅读(1665) 评论(0) 推荐(0)

C/C++函数参数读取顺序
摘要:说到C/C++函数参数读取顺序,很多人都知道在入栈时是从右至左的,可是真的有那么简单吗?先看一个例子:1 #include 2 3 int main() {4 int a = 10;5 printf("%d %d %d\n", a++, ++a, a);6 return 0;... 阅读全文

posted @ 2015-01-14 15:46 Eason Liu 阅读(8677) 评论(2) 推荐(4)

[LeetCode] Largest Number
摘要:Given a list of non negative integers, arrange them such that they form the largest number.For example, given[3, 30, 34, 5, 9], the largest formed num... 阅读全文

posted @ 2015-01-13 17:02 Eason Liu 阅读(2807) 评论(0) 推荐(0)

[LeetCode] Text Justification
摘要:Given an array of words and a lengthL, format the text such that each line has exactlyLcharacters and is fully (left and right) justified.You should p... 阅读全文

posted @ 2015-01-12 16:56 Eason Liu 阅读(264) 评论(0) 推荐(0)

[LeetCode] Compare Version Numbers
摘要:Compare two version numbersversion1andversion1.Ifversion1>version2return 1, ifversion1 val2) return 1;26 if (val1 < val2) return -1;27 ... 阅读全文

posted @ 2015-01-12 15:49 Eason Liu 阅读(3594) 评论(0) 推荐(0)

[LeetCode] Find Peak Element
摘要:A peak element is an element that is greater than its neighbors.Given an input array wherenum[i] ≠ num[i+1], find a peak element and return its index.... 阅读全文

posted @ 2015-01-12 14:05 Eason Liu 阅读(321) 评论(0) 推荐(0)

[LeetCode] Factorial Trailing Zeroes
摘要:Given an integern, return the number of trailing zeroes inn!.Note:Your solution should be in logarithmic time complexity.Credits:Special thanks to@tsf... 阅读全文

posted @ 2015-01-12 13:40 Eason Liu 阅读(214) 评论(0) 推荐(0)

[LeetCode] Insert Interval
摘要:Given a set ofnon-overlappingintervals, insert a new interval into the intervals (merge if necessary).You may assume that the intervals were initially... 阅读全文

posted @ 2015-01-12 13:24 Eason Liu 阅读(169) 评论(0) 推荐(0)

[LeetCode] Merge Intervals
摘要:Given a collection of intervals, merge all overlapping intervals.For example,Given[1,3],[2,6],[8,10],[15,18],return[1,6],[8,10],[15,18]. 1 /** 2 * De... 阅读全文

posted @ 2015-01-10 22:18 Eason Liu 阅读(175) 评论(0) 推荐(0)

[LeetCode] Excel Sheet Column Number
摘要:Related to questionExcel Sheet Column TitleGiven a column title as appear in an Excel sheet, return its corresponding column number.For example: A ... 阅读全文

posted @ 2015-01-09 19:48 Eason Liu 阅读(156) 评论(0) 推荐(0)

[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 ->... 阅读全文

posted @ 2015-01-09 19:47 Eason Liu 阅读(151) 评论(0) 推荐(0)

[LeetCode] Intersection of Two Linked Lists
摘要:Write a program to find the node at which the intersection of two singly linked lists begins.For example, the following two linked lists:A: a... 阅读全文

posted @ 2015-01-09 19:44 Eason Liu 阅读(171) 评论(0) 推荐(0)

[LeetCode] Find Minimum in Rotated Sorted Array II
摘要:Follow upfor "Find Minimum in Rotated Sorted Array":What ifduplicatesare allowed?Would this affect the run-time complexity? How and why?Suppose a sort... 阅读全文

posted @ 2015-01-09 19:42 Eason Liu 阅读(142) 评论(0) 推荐(0)

[LeetCode] Min Stack
摘要:Design a stack that supports push, pop, top, and retrieving the minimum element in constant time.push(x) -- Push element x onto stack.pop() -- Removes... 阅读全文

posted @ 2015-01-08 11:58 Eason Liu 阅读(421) 评论(0) 推荐(0)

[LeetCode] Find Minimum in Rotated Sorted Array
摘要:Suppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e.,0 1 2 4 5 6 7might become4 5 6 7 0 1 2).Find the minimum element.You m... 阅读全文

posted @ 2015-01-08 11:45 Eason Liu 阅读(178) 评论(0) 推荐(0)

[LeetCode] Maximum Product Subarray
摘要:Find the contiguous subarray within an array (containing at least one number) which has the largest product.For example, given the array[2,3,-2,4],the... 阅读全文

posted @ 2015-01-08 11:26 Eason Liu 阅读(131) 评论(0) 推荐(0)