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 matr...
分类:
其他好文 时间:
2015-06-22 20:40:25
阅读次数:
128
题目链接:https://leetcode.com/problems/3sum-closest/
Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three i...
分类:
其他好文 时间:
2015-06-22 17:56:00
阅读次数:
110
class ca{
var count = 1;
static var instance:ca =
ca();
class func GetInstance()->ca{
return instance;
}
}
var a = ca.GetInstance();
var b = ca.GetInstan...
分类:
编程语言 时间:
2015-06-22 17:54:52
阅读次数:
129
1. 问题描述 计算完全二叉树的节点数。对于完全二叉树的定义可参考wikipedia上面的内容。2. 方法与思路 最简单也最容易想到的方法就是使用递归,分别递归计算左右子树的节点数的和。但此方法最容易超时,一般不可取。
int countNodes(TreeNode* root) {
if(root == NULL) return 0;
else if(ro...
分类:
其他好文 时间:
2015-06-22 16:31:48
阅读次数:
417
Reverse bits of a given 32 bits unsigned integer.For example, given input 43261596 (represented in binary as 00000010100101000001111010011100), return 964176192 (represented in binary as00111001011110...
分类:
其他好文 时间:
2015-06-22 16:29:49
阅读次数:
167
#include
#include
#include
int Myatoi(const char* str)
{
if(str==NULL)//判断指针是否为空
{
printf("Pointer is NULL\0");
return 0;
}
while(*str==' ')//忽略前导空字符
str++;
int sign=1;//判断符号
if(*str=='...
分类:
其他好文 时间:
2015-06-22 16:28:38
阅读次数:
138
一 函数定义
func funcName(arg1:type, arg2:type, ...)->type{
// function body
return xxx
}
说明:
func 函数生命关键字,函数类型
->type 生命返回值类型
示例:
func sayHello(personName: String) -> String {
let gre...
分类:
编程语言 时间:
2015-06-22 16:26:46
阅读次数:
208
生成器是可以当作iterator使用的特殊函数。它有以下优点:1. 惰性求值;2. 在处理大的列表时不需要一次性加载全部数据,可以减小内存使用;除非特殊的原因,应该在代码中使用生成器。生成器(generator) vs 函数(function)生成器和函数的主要区别在于函数return a valu...
分类:
编程语言 时间:
2015-06-22 16:15:44
阅读次数:
111
1.jquery中使用submit提交按钮时,当return false后,依然会提交表单的
解决的办法是:使用button按钮,而不是submit按钮 看下面的例子
我要判断是否确定退选才发送请求到back.action中处理。
Jquery如下:
jQuery('#...
分类:
其他好文 时间:
2015-06-22 15:05:12
阅读次数:
129
Given two integers representing the numerator and denominator of a fraction, return the fraction in string format.
If the fractional part is repeating, enclose the repeating part in parentheses.
...
分类:
其他好文 时间:
2015-06-22 15:03:43
阅读次数:
181