码迷,mamicode.com
首页 >  
搜索关键字:two sum    ( 31846个结果
Leetcode:Container With Most Water
戳我去解题Givennnon-negative integersa1,a2, ...,an, where each represents a point at coordinate (i,ai).nvertical lines are drawn such that the two endpoint...
分类:其他好文   时间:2014-07-22 23:09:34    阅读次数:337
[leetcode]Binary Tree Maximum Path Sum
/** * Definition for binary tree * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(...
分类:其他好文   时间:2014-07-22 23:07:34    阅读次数:312
Same Tree
Given two binary trees, write a function to check if they are equal or not.Two binary trees are considered equal if they are structurally identical an...
分类:其他好文   时间:2014-05-01 16:06:46    阅读次数:427
整理,模板
组合数学、-排列组合数----sum求sum=sum*(m--)/i;int c(int n,int m)//n下标,m上标{ int sum=1; for(int i=1;in-m) m=n-m; int temp=n; for(int i=1;i1) { up[j]/=temp; d...
分类:其他好文   时间:2014-05-01 01:07:44    阅读次数:409
等值首尾和问题及其思考、解决和总结
问题 等值首尾和 假设有一个数组x[],它有n个元素,每一个都大于零;称x[0] + x[1] + … + x[i]为前置和(Prefix Sum),而x[j] + x[j+1] + … + x[n-1]为后置和(Suffix Sum)。试编写一个程序,求出x[]中有多少组相同的前置和与后置和。 最...
分类:其他好文   时间:2014-05-01 00:14:05    阅读次数:743
Leetcode:Minimum Path Sum 最小路径和
Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its path. Note: You can only move either down or right at...
分类:其他好文   时间:2014-04-28 10:46:41    阅读次数:311
C++ - Vector 计算 均值(mean) 和 方差(variance)
Vector 计算 均值(mean) 和 方差(variance) 本文地址: http://blog.csdn.net/caroline_wendy vector的数组, 计算均值和方差的最简方法. 代码: double sum = std::accumulate(std::begin(resultSet), std::end(resultSet), 0.0);...
分类:编程语言   时间:2014-04-28 10:44:42    阅读次数:587
Timus 1120. Sum of Sequential Numbers 数学题
There is no involute formulation concerning factitiously activity of SKB Kontur in this problem. Moreover, there is no formulation at all. Input There is the only number N, 1 ≤ N ≤ 109. O...
分类:其他好文   时间:2014-04-27 21:38:05    阅读次数:544
hdu1211
RSA is one of the most powerful methods to encrypt data. The RSA algorithm is described as follow: > choose two large prime integer p, q > calculate n = p × q, calculate F(n) = (p - 1) × (q - 1) ...
分类:其他好文   时间:2014-04-27 21:37:59    阅读次数:315
mysql常用查询:group by,左连接,子查询,having where
前几天去了两个比较牛的互联网公司面试,在sql这块都遇到问题了,哎,可惜呀,先把简单的梳理一下 成绩表 score 1、group by 使用 按某一个维度进行分组 例如: 求每个同学的总分 SELECT student,SUM(score) FROM score GROUP BY student 求每个同学的平均分 SELECT student,AVG(score) FR...
分类:数据库   时间:2014-04-27 21:17:59    阅读次数:614
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!