- 博客(12)
- 收藏
- 关注
原创 leetcode:Multiply Strings
Given two numbers represented as strings, return multiplication of the numbers as a string. Note: The numbers can be arbitrarily large and are non-negative. class Solution { public:
2015-02-27 22:57:22 306
转载 enable_shared_from_this模板类使用完全解析
转自:http://hahaya.github.io/use-enable-shared-from-this/ enable_shared_from_this模板类使用完全解析 作者:hahaya 日期:2013-11-28 以前都没有用过enable_shared_from_this模板类,虽然经常遇到但是也没怎么去关注,今天抽时间好好学习了下enable_share
2015-02-26 16:51:54 2694
原创 leetcode:Maximal Rectangle
Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing all ones and return its area. 这道题要参考 Largest Rectangle in Histogram 中一次扫描并利用stack的方法 class Solution
2015-02-09 15:35:52 369
原创 leetcode: Plus One
Given a non-negative number represented as an array of digits, plus one to the number. The digits are stored such that the most significant digit is at the head of the list. class Solution
2015-02-09 14:27:50 338
原创 leetcode:Container With Most Water
Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of line i is at (i, ai) and (i, 0). Fin
2015-02-09 12:19:00 327
转载 A man speaks truth 3 out of 4 times. He throws a die and reports it to be a 6. What is the probabili
转自: https://in.answers.yahoo.com/question/index?qid=20110717224242AAhu50E P[6 rolled & reports as 6 ] = 1/6 * 3/4 = 1/8 P[non-6 & reports as 6] = 5/6 * 1/4 = 5/24 P[reported as a 6 ] = 1/8 +
2015-02-08 19:06:05 530
原创 对栈进行排序
#include #include using namespace std; void sort_stack(stackint> &s) { stackint> aux; stackint> dest; while (!s.empty()) { int
2015-02-08 12:02:52 793
原创 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 contiguous subarray [2,3] has the largest
2015-02-08 12:01:01 344
原创 找出数组中第一个重复出现的数
n个数,范围从0到N-1,中间有重复的数,求第一个重复出现的数 int duplicate(int numbers[]) { int length = numbers.length; for(int i = 0; i < length; ++i) { if(numbers[i] length - 1) throw new Ille
2015-02-04 19:11:57 2432 2
转载 Minimum Number of Platforms Required for a Railway/Bus Station 贪心算法
转自:http://www.geeksforgeeks.org/minimum-number-platforms-required-railwaybus-station/ Given arrival and departure times of all trains that reach a railway station, find the minimum number of plat
2015-02-03 23:37:25 542
转载 Activity Selection Problem 贪心算法
转自:http://www.geeksforgeeks.org/greedy-algorithms-set-1-activity-selection-problem/ Greedy is an algorithmic paradigm that builds up a solution piece by piece, always choosing the next piece
2015-02-03 23:15:26 2220
转载 Find the first non-repeating character from a stream of characters
转自:http://www.geeksforgeeks.org/find-first-non-repeating-character-stream-characters/ Given a stream of characters, find the first non-repeating character from stream. You need to tell the fi
2015-02-02 23:34:11 583
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人