Write a function to delete a node (except the tail) in a singly linked list, given only access to that node.Supposed the linked list is 1 -> 2 -> 3 ->...
分类:
其他好文 时间:
2015-11-10 12:03:33
阅读次数:
211
Given an array of integers, every element appears three times except for one. Find that single one.Note:
Your algorithm should have a linear runtime complexity. Could you implement it without using ex...
分类:
其他好文 时间:
2015-11-08 15:21:37
阅读次数:
195
Given an array of integers, every element appears twice except for one. Find that single one.Note:
Your algorithm should have a linear runtime complexity. Could you implement it without using extra me...
分类:
其他好文 时间:
2015-11-08 15:20:47
阅读次数:
176
#coding=utf-8import urllib2import threadingimport timeTOTAL = 0 #总数 SUCC = 0 #响应成功数 FAIL = 0 #响应失败数 EXCEPT = 0 #响应异常数 MAXTIME=0 #最大响应时间 MINTIME=100 #最...
分类:
编程语言 时间:
2015-11-07 14:49:40
阅读次数:
228
虽然目前都实现了自动化如puppetsaltstack在环境中的应用,但工作中不可避免的要自己写一些简单的批量执行shell命令的脚本。pythonparamiko模块是目前使用得较为顺手的模块,执行命令时基本无需要转换,直接将shell命令扔进去执行就OK简单示例,10个线程同时执行ssh或scp动作,未..
分类:
系统相关 时间:
2015-11-06 23:42:29
阅读次数:
585
Python的错误其实也是class,所有的错误类型都继承自BaseException,所以在使用except时需要注意的是,它不但捕获该类型的错误,还把其子类也“一网打尽”。比如:try: foo()except StandardError, e: print 'StandardErr...
分类:
编程语言 时间:
2015-11-06 14:25:14
阅读次数:
180
package cn.edu.xidian.sselab;import java.util.LinkedList;/*** title: Delete Node in a Linked List* content:* Write a function to delete a node (except...
分类:
其他好文 时间:
2015-11-04 23:01:58
阅读次数:
276
主要分为:标准异常、如何捕捉异常、抛出异常 以及自定义异常。捕捉异常 try: print (1/0) except ZeroDivisionError as err: # 除数为0报错 print ('Exception: ', err) except Arithm...
分类:
编程语言 时间:
2015-11-04 11:18:58
阅读次数:
254
URLErrorURLerror产生原因:网络未连接(即不能上网)服务器不存在我们一般通过try-except语句来包围并捕获相应的异常。我们先尝试一下:1 import urllib22 request=urllib2.Request('http://www.wujiadong.com')3 tr...
分类:
编程语言 时间:
2015-11-01 16:38:00
阅读次数:
248
Given an array ofnintegers wheren> 1,nums, return an arrayoutputsuch thatoutput[i]is equal to the product of all the elements ofnumsexceptnums[i].Solv...
分类:
其他好文 时间:
2015-10-30 10:39:59
阅读次数:
188