码迷,mamicode.com
首页 >  
搜索关键字:integer    ( 14932个结果)
052 N Queens 2
纯递归方法, 网上有一个bit manipulation 的方法 不(看)想(不)深(大)究(懂) LOLclass Solution: def __init__(self): self.ans = 0 # @param {integer} n # @return {...
分类:其他好文   时间:2015-07-07 07:05:48    阅读次数:111
051 N Queens
此题即在 052 N Queens 2 基础上稍作改进 并注意返回格式就好import copyclass Solution: def __init__(self): self.ans = [] # @param {integer} n # @return {inte...
分类:其他好文   时间:2015-07-07 07:04:44    阅读次数:110
230 Kth Smallest Element in a BST
这道题就是数点 divide and conquerclass Solution: # @param {TreeNode} root # @param {integer} k # @return {integer} def kthSmallest(self, root, k)...
分类:其他好文   时间:2015-07-07 00:55:14    阅读次数:108
woodcut
http://www.lintcode.com/en/problem/wood-cut/# 二分答案,贪心验证,具有单调性 class Solution { public: /** *@param L: Given n pieces of wood with length L[i] *@param k: An integer *return...
分类:其他好文   时间:2015-07-06 23:30:25    阅读次数:233
GO语言练习:为类型添加方法
1、代码2、运行1、代码 1 package main 2 3 import "fmt" 4 5 type Integer int 6 //给in类型添加 Less 方法,int原来的方法被Integer继承 7 func (a Integer) Less (b Integer) bool {...
分类:编程语言   时间:2015-07-06 23:14:12    阅读次数:167
POJ 1564 Sum It Up(DFS)
Sum It UpTime Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64uSubmit StatusDescriptionGiven a specified total t and a list of n integer...
分类:其他好文   时间:2015-07-06 21:39:52    阅读次数:136
[LeetCode] Power of Two
Power of TwoGiven an integer, write a function to determine if it is a power of two.Credits:Special thanks to@jianchao.li.fighterfor adding this probl...
分类:其他好文   时间:2015-07-06 21:38:27    阅读次数:159
LeetCode 231: Power of Two
Given an integer, write a function to determine if it is a power of two. 判断一个数是否是2的幂,判断方法主要依据2的N次幂的特点:仅有首位为1,其余各位都为0. 方法1: n & n-1 == 0 class Solution { public: bool isPowerOfTwo(int n) { ...
分类:其他好文   时间:2015-07-06 19:50:52    阅读次数:95
[LeetCode] Summary Ranges
Summary Ranges Given a sorted integer array without duplicates, return the summary of its ranges. For example, given [0,1,2,4,5,7], return ["0->2","4->5","7"]. Credits: Special thanks to @...
分类:其他好文   时间:2015-07-06 19:49:21    阅读次数:102
mysql数据类型总结
数据类型优化 1、尽量使用能正常存储数据的最小数据类型(更快,占用更少的磁盘、内存和cpu) 2、尽量使用简单类型。(如整型比字符操作代价低) 3、尽量避免使用NULL(可以通过加默认值设置not null) 数据类型:支持别名,如integer,bool,numeric 1、时间 DATETIME和TIMESTAMP都精确到秒。通常应该尽量使用timestamp。 date...
分类:数据库   时间:2015-07-06 17:53:26    阅读次数:156
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!