class Solution:
# @param {integer[]} prices
# @return {integer}
def maxProfit(self, prices):
if len(prices) <= 1: return 0
low = prices[0]; mostProfit = 0
for i ...
分类:
其他好文 时间:
2015-07-04 18:29:06
阅读次数:
131
class Solution:
# @param {integer[]} prices
# @return {integer}
def maxProfit(self, prices):
profit = 0;
for i in xrange(1, len(prices)):
if prices[i] > prices[...
分类:
其他好文 时间:
2015-07-04 18:28:27
阅读次数:
132
Reverse digits of an integer.Example1:x = 123, return 321Example2:x = -123, return -321问题描述: 将整数个十百位反序输出。注意特殊情况:1)溢出情况:To check for overflow/underflow...
分类:
其他好文 时间:
2015-07-04 18:24:44
阅读次数:
120
1.将查询结果导入某张表create table file1(a integer,b character(5));insert into file1(a,b) select a,b from view2.导出导出之前为防止中文乱码,设置一下数据库编码set client_encoding='GBK'...
分类:
数据库 时间:
2015-07-04 18:09:06
阅读次数:
1418
function TMiTeC_Storage.GetPhysInfo(Index: integer): TDeviceInfo;begin Finalize(Result); FillChar(Result,SizeOf(TDeviceInfo),0); if (Index>=0) and ...
分类:
其他好文 时间:
2015-07-04 18:07:34
阅读次数:
121
今天做错了一道笔试题,发现以前的对于Java引用理解有误,特撰文记录题目如下:public class Tester{public static void main(String[] args){ Integer var1=new Integer(1); Integer var2=var1;...
分类:
编程语言 时间:
2015-07-04 16:41:24
阅读次数:
107
class Solution:
# @param {integer} numerator
# @param {integer} denominator
# @return {string}
def fractionToDecimal(self, numerator, denominator):
negativeFlag = numerator * d...
分类:
其他好文 时间:
2015-07-04 15:33:35
阅读次数:
105
题目出处:https://leetcode.com/problems/palindrome-number/
题目:Determine whether an integer is a palindrome. Do this without extra space.
翻译:判断一个整型数是否是回文数
思路:将整型数转化为字符串,依次比较首尾
代码:
public class Solution...
分类:
其他好文 时间:
2015-07-04 14:08:01
阅读次数:
171
暴力搜索 无压力, 只是要注意Line 14作用 如果用deepcopy则耗时多了好多 1 class Solution: 2 def __init__(self): 3 self.ans = [] 4 # @param {integer} k 5 # @pa...
分类:
其他好文 时间:
2015-07-04 13:55:41
阅读次数:
159
我会说我直接用了 heapq这么无耻的方法吗 :) 这道题应该直观用heap 复杂度为O(nlgk)1 import heapq2 class Solution:3 # @param {integer[]} nums4 # @param {integer} k5 # @ret...
分类:
其他好文 时间:
2015-07-04 13:53:51
阅读次数:
112