problem:
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
/ 2 3
...
分类:
其他好文 时间:
2015-04-27 13:20:29
阅读次数:
130
Problem JCan JM Bear Be happy?
撰写:Hacker_vision
题目大意:给你一个长度为n的字符串没判断字符串是否合法(即必须包含所有26个英文字母)
题解:标记数组vis[26]标记出现过的字母,注意预处理:字符串大小写转换string s;
小写转换为大写:transform( s.begin(), s.end(), s.begin(), ::tou...
分类:
其他好文 时间:
2015-04-27 10:04:09
阅读次数:
201
local scheduler = require(cc.PACKAGE_NAME .. ".scheduler")local MainScene = class("MainScene", function() return display.newScene("MainScene")end)l...
分类:
其他好文 时间:
2015-04-27 07:08:40
阅读次数:
180
一、什么是kickstartanaconda支持通过读取配置文件的内容来完成安装过程的配置:kickstartkickstart文件的组成:命令段程序包段:%packages,%end@grouppackage-package脚本段:%pre安装前脚本:安装过程开始之前要执行的脚本;注意:此时的Linux系统环境为微缩版环境,因此脚本..
分类:
其他好文 时间:
2015-04-27 00:48:43
阅读次数:
2934
https://leetcode.com/problems/binary-tree-maximum-path-sum/Given a binary tree, find the maximum path sum.The path may start and end at any node in th...
分类:
其他好文 时间:
2015-04-26 22:23:56
阅读次数:
174
package Quicksort;/** * 快速排序 * @author Administrator * */public class TestMain { /** * * @param start 开始位置 * @param end 结束位置 */ public stati...
分类:
编程语言 时间:
2015-04-26 19:38:38
阅读次数:
137
题目描述Given a linked list, reverse the nodes of a linked list k at a time and return its modified list.If the number of nodes is not a multiple of k then left-out nodes in the end should remain as it is....
分类:
其他好文 时间:
2015-04-26 12:26:17
阅读次数:
135
问题:翻转字符串中的单词顺序,如“hello world”变成“world hello”。要求使用常量空间。
c++代码如下:
void reverse(string &s, int start, int end){
int len=end+start;
int center=len/2;
for(int i=start;i<center;i++){
...
分类:
其他好文 时间:
2015-04-25 21:13:09
阅读次数:
127
题意:有n个城市m条边,告诉起点和终点,问从起点到终点不走重复边的最短路有多少条。
思路:求最短路的条数可以用最大流,建图时要去掉不是最短路上的边,判断某条边是不是最短路上的边:如果满足dist1[u] + dist2[v] + E1[i].len = dist1[End]则可以说明该边是最短路上的边,其中 dist1[] 为各点到起点的最短距离,dist2[] 为各点到终点的最短距离。...
分类:
其他好文 时间:
2015-04-25 12:19:41
阅读次数:
178
刚需要用到接受到的jpg二进制文件,直接在内存做解析,mark一下,下面给出测试代码。FILE*file;
file=fopen("D:/221606322483223.jpg","rb");
fseek(file,0,SEEK_END);
fpos_tpos;
fgetpos(file,&pos);
char*data=newchar[pos];
fseek(file,0,0);
intsjinum=fread(data,siz..
分类:
其他好文 时间:
2015-04-24 19:24:42
阅读次数:
110