CODE:
#include
#include
#include
using namespace std;
bool mat[105][105];
bool root[105];
int n,m;
int R;
int cnt[105];
int ans1,ans2;
struct TNode
{
int num;
int level;
};
void BFS()
{
...
分类:
其他好文 时间:
2015-07-21 12:51:41
阅读次数:
128
题目:
Given n non-negative integers
representing the histogram's bar height where the width of each bar is 1, find the area of largest rectangle in the histogram.
Above is a histogram where wi...
分类:
编程语言 时间:
2015-07-19 13:35:37
阅读次数:
128
2.2 Implement an algorithm to find the kth to last element of a singly linked list.这道题让我们求链表中倒数第k个元素,LeetCode中相类似的题目有Kth Largest Element in an Array 数...
分类:
其他好文 时间:
2015-07-19 13:21:05
阅读次数:
104
You have a positive integermand a non-negative integers. Your task is to find the smallest and the largest of the numbers that have lengthmand sum of ...
分类:
其他好文 时间:
2015-07-16 21:59:17
阅读次数:
144
Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing all ones and return its area.public class Solution { public...
分类:
其他好文 时间:
2015-07-15 22:39:04
阅读次数:
270
Givennnon-negative integers representing the histogram's bar height where the width of each bar is 1, find the area of largest rectangle in the histog...
分类:
其他好文 时间:
2015-07-15 20:55:22
阅读次数:
105
问题描述Given a 2D binary matrix filled with 0's and 1's, find the largest square containing all 1's and return its area.For example, given the following ...
分类:
其他好文 时间:
2015-07-15 12:33:46
阅读次数:
92
You are givennk-digit integers. You have to rearrange the digits in the integers so that the difference between the largest and the smallest number wa...
分类:
其他好文 时间:
2015-07-15 01:17:15
阅读次数:
244
【题目链接】:click here~~
【题目大意】:
A histogram is a polygon composed of a sequence of rectangles aligned at a common base line. The rectangles have equal widths but may
have different heights. For exampl...
分类:
其他好文 时间:
2015-07-14 22:38:58
阅读次数:
276
前几天在做Kth Largest Element in an Array 时使用到了堆,通过那倒题目也了解到了堆的make_heap,push_heap,pop_heap操作,看了C++ reference中的讲解也明白了heap_sort是什么回事。于是想着自己实现以下这四个函数。
堆的定义:
任意节点小于它的所有后裔,最小元在堆的根上(堆序性)。
堆总是一棵完全树。
#include <ios...
分类:
其他好文 时间:
2015-07-14 18:16:02
阅读次数:
109