//1 a b 将a位置的数改为b
//0 a b 输出[a,b] 区间内的 maximum sum of beautiful subsequence
//A beautiful subsequence is a subsequence that all the adjacent pairs
//of elves in the sequence have a different parity of...
分类:
其他好文 时间:
2015-08-02 15:13:38
阅读次数:
141
整数数据类型 C语言中不同字长的机器和编译器会分配不同字节大小.long类型是唯一与机器相关的. 32位机器上C语言的整数数据类型的典型取值范围负数的取值范围比正数大1 C data type Minimum Maximum char ?128 127 unsigned char 0 255 sho...
分类:
其他好文 时间:
2015-08-02 13:09:52
阅读次数:
129
Given an unsorted array, find the maximum difference between the successive elements in its sorted form.Try to solve it in linear time/space.Return 0 ...
分类:
其他好文 时间:
2015-08-02 13:09:31
阅读次数:
106
https://leetcode.com/problems/maximum-subarray/Find the contiguous subarray within an array (containing at least one number) which has the largest sum...
分类:
其他好文 时间:
2015-08-02 11:43:32
阅读次数:
95
这题是典型的堆排序算法,只是比一般的堆算法多了删除的操作,有两件事需要做:1 用一个hash表存储从输入数组索引到堆数组(用于实现堆的那个数组)所以的映射,以便在需要删除一个元素的时候能迅速定位到堆数组中的位置2用一个set保存已经被删除的元素索引(这里指的是输入数组索引),这一点可选;还有一种做法...
很有趣的一道题,题解戳这。 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 7 const int maxn = 200000 + 10; 8 const int maxm = 1000000 + 1...
分类:
其他好文 时间:
2015-08-02 10:03:44
阅读次数:
123
Given a binary tree, find its maximum depth.
The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.
思路:很基础的一个题,DFS即可。代码如下:
/**
* Defin...
分类:
其他好文 时间:
2015-08-01 22:08:25
阅读次数:
140
Givennpoints on a 2D plane, find the maximum number of points that lie on the same straight line./** * Definition for a point. * class Point { * i...
分类:
其他好文 时间:
2015-08-01 20:26:30
阅读次数:
118
<!DOCTYPE?html>
<html?lang="en">
<head>
????<meta?charset="UTF-8">
????<title>转盘</title>
????<meta?name="viewport"?content="width=device-width,?maximum-scale=1.0,?user-scalab...
分类:
Web程序 时间:
2015-08-01 17:30:41
阅读次数:
170
一、枚举所有宽度为举着宽度的子矩阵,从中找出是否具有相应长度的正方形,复杂度为O(n^3);二、[1]中使用动态规划,decrease the complexity to O(n^2)dp[i][j] mean the maximum square which has right-down corn...
分类:
其他好文 时间:
2015-08-01 15:40:02
阅读次数:
108