- 博客(30)
- 资源 (1)
- 收藏
- 关注
原创 win10开始菜单搜索内容失效
作者:带头大哥的小小弟原文:https://blog.youkuaiyun.com/qq_40875146/article/details/81742533win10系统的开始菜单搜索功能今天突然不好用了,搜什么都是空白,按以下方法解决1、首先,打开管理员命令窗口,win+x,可以看到弹出一个窗口,打开windows Powershell(管理员)2 、不知道这部有什么用,大家可以看看直接使用下一步,...
2019-04-02 17:07:56
5428
12
原创 561.数组拆分1(通过)Python
class Solution: def arrayPairSum(self, nums): """ :type nums: List[int] :rtype: int """ listNum = list(nums) listNum.sort() sum = 0 ...
2019-01-28 09:27:26
280
原创 461.汉明距离(通过)Python
class Solution: def hammingDistance(self, x, y): """ :type x: int :type y: int :rtype: int """ count = 0 while True: if x == 0 a...
2019-01-28 09:26:04
1015
原创 344.反转字符串(通过)Python
最开始想用s.reverse()后来还是写了个替换class Solution: def reverseString(self, s): """ :type s: str :rtype: str """ l = len(s) - 1 for i in range(l): ..
2019-01-28 09:24:45
247
原创 171.Excel表序列号(通过)Python
class Solution: def titleToNumber(self, s): """ :type s: str :rtype: int """ num = 0 for i in range(len(s)-1,-1,-1): num += (ord(s[i]) -...
2019-01-28 08:48:49
340
原创 with as
Python with as :Context Management Protocol(上下文管理协议):包含方法__enter()和__exit(),支持该协议的对象要实现这两个方法。上下文管理器(Context Manager):支持上下文管理协议的对象,这种对象实现了__enter()__ 和__exit()__ 方法。用下述代码做理解# -*- coding: UTF-8 -*-i...
2019-01-25 13:58:28
234
原创 12306模拟登陆Python3.x+cookiejar+request
代码等有时间传到GitHub上去,这里就不展示了,只讲一讲思路。1、cookie的处理其实urllib在open函数内部创建了一个默认的opener对象。然后调用opener.open()函数。但是默认的opener并不支持cookie。那么我们先新建一个支持cookie的opener。urllib中供我们使用的是HTTPCookieProcessor。创建HTTPCookieProcess...
2019-01-17 21:29:51
524
原创 Vim编辑器命令
Vim编辑器命令 :vi或vim (vim有颜色支持)Vim有三种工作模式 命令模式、输入模式、末行模式Vim加文件名进入编辑器 此时进入的是命令模式,按aio 进入输入模式,esc退回命令模式,按:进入末行模式,esc退回命令模式,末行模式下输入q退出编辑器wq保存退出,q! 强行退出,wq!强行保存退出,尚未进行任何操作可以输入x 退出编辑器。命令模式下:G 移动到文件末尾的行头...
2019-01-16 15:41:32
395
原创 104.二叉树的最大深度(通过)Python
二叉树的最大深度# Definition for a binary tree node.# class TreeNode:# def __init__(self, x):# self.val = x# self.left = None# self.right = Noneclass Solution: def maxD...
2019-01-02 17:40:15
477
原创 101.对称二叉树(通过)Python
用的递归在第100题的基础上改一改就可以了# Definition for a binary tree node.# class TreeNode:# def __init__(self, x):# self.val = x# self.left = None# self.right = Noneclass Solution...
2019-01-02 17:06:18
196
原创 Python None 与 ''(空字符串)
None是一个特殊的常量,有自己的类型:Nonetypeis not None与 !=’ ’起初以为都是表示非空,但是在实际应用时发现不对啊。a = Noneif a != '': print('ok1')if a is not None: print('ok2')这里会输出OK1a = ''if a != '': print('ok1')if a i...
2019-01-02 16:29:40
10953
1
原创 100.相同的树(通过)Python
上学那会写的最多的就是前中后层遍历,各种转换。。。# Definition for a binary tree node.# class TreeNode:# def __init__(self, x):# self.val = x# self.left = None# self.right = Noneclass Solut...
2019-01-02 16:04:02
206
原创 iptables参数
filter表:负责过滤功能,防火墙;内核模块:iptables_filternat表:network address translation,网络地址转换功能;内核模块:iptable_natmangle表:拆解报文,做出修改,并重新封装 的功能;iptable_mangleraw表:关闭nat表上启用的连接追踪机制;iptable_raw-t : 指定表,默认为filter表-v :...
2018-12-28 11:43:20
522
原创 83.删除排序链表中的重复元素(通过)Python
和c有点不一样,Python不需要释放被删除的节点# Definition for singly-linked list.# class ListNode:# def __init__(self, x):# self.val = x# self.next = Noneclass Solution: def deleteDuplicate...
2018-12-26 10:17:25
189
原创 70.爬楼梯(通过)Python
前9阶的解法分别是:1,2,3,5,8,13,21,34,55由上可知,与Fibonacci sequence及其相似class Solution: def climbStairs(self, n): """ :type n: int :rtype: int """ tmp = 1 res ...
2018-12-25 20:10:28
324
原创 69.X的平方根(借鉴)Python
首先我想到的是直接return x**0.5但是人家明显不让这么做。。。然后借鉴。。。牛顿迭代法实现。class Solution: def mySqrt(self, x): """ :type x: int :rtype: int """ if x <= 1: retur...
2018-12-25 19:41:24
363
原创 67.二进制求和(通过)Python
二进制求和最蠢写法(没有用bin()和int())后边附上使用int和bin版本class Solution: def addBinary(self, a, b): """ :type a: str :type b: str :rtype: str """ a = list(map(int,l...
2018-12-25 17:17:37
299
原创 66.加一(通过)Python2/3
map()函数Python 2.x 返回列表Python 3.x 返回迭代器。python2class Solution(object): def plusOne(self, digits): """ :type digits: List[int] :rtype: List[int] """ digit...
2018-12-25 15:31:16
195
原创 58.最后一个单词的长度(通过)Python
给定一个仅包含大小写字母和空格’ ’ 的字符串,返回其最后一个单词的长度。如果不存在最后一个单词,请返回 0说明:一个单词是指由字母组成,但不包含任何空格的字符串。class Solution: def lengthOfLastWord(self, s): """ :type s: str :rtype: int ""...
2018-12-25 14:22:43
326
原创 53.最大子序和(通过)Python
class Solution: def maxSubArray(self, nums): """ :type nums: List[int] :rtype: int """ sum = 0 Maxsum = nums[0] for i in range(len(nums)):...
2018-12-25 10:58:49
291
原创 35.搜索插入位置(通过)Python
给定一个排序数组和一个目标值,在数组中找到目标值,并返回其索引。如果目标值不存在于数组中,返回它将会被按顺序插入的位置。你可以假设数组中无重复元素。class Solution: def searchInsert(self, nums, target): """ :type nums: List[int] :type target: in...
2018-12-25 08:43:36
228
原创 28.实现strStr()Python
偷懒写法,emmm看了看题名,想了一下,这应该是让我实现Python的index()吧 def removeElement(self, nums, val): """ :type nums: List[int] :type val: int :rtype: int """ try: hay..
2018-12-24 20:55:32
245
原创 27.移除元素(通过)Python
class Solution: def removeElement(self, nums, val): &quot;&quot;&quot; :type nums: List[int] :type val: int :rtype: int &quot;&quot;&quot; count = nums.coun
2018-12-24 20:38:33
223
2
原创 26.删除排序数组中的重复项(勉强通过)Python
emmm…这个答案有问题,太慢了,不让用set(),难受class Solution: def removeDuplicates(self, nums): """ :type nums: List[int] :rtype: int """ count = 0 for i in range(le..
2018-12-24 20:27:16
154
原创 20.有效的括号(通过)Python
给定一个只包括 {} 的字符串,判断字符串是否有效。class Solution: def isValid(self, s): """ :type s: str :rtype: bool """ vl = {'{':1,'}':-1,'[':2,']':-2,'(':3,')':-3} y ..
2018-12-24 18:50:52
246
原创 13.罗马数字转整数(通过)Python
class Solution: def romanToInt(self, s): &quot;&quot;&quot; :type s: str :rtype: int &quot;&quot;&quot; y = list(s) vl = {'I':1,'V':5,'X':10,'L':50,'C':100,
2018-12-24 12:01:01
178
原创 9.回文数(通过)Python
判断一个整数是否是回文数。回文数是指正序(从左向右)和倒序(从右向左)读都是一样的整数。class Solution: def isPalindrome(self, x): &quot;&quot;&quot; :type x: int :rtype: bool &quot;&quot;&quot; y = list(str
2018-12-24 10:58:52
159
原创 7.整数反转(通过)Python
7.整数反转(通过)给出一个 32 位的有符号整数,你需要将这个整数中每位上的数字进行反转class Solution: def reverse(self, x): """ :type x: int :rtype: int """ y = abs(x) l = list(str(y)) ..
2018-12-24 10:18:52
665
转载 CloudStack创建VM过程梳理
原文地址(http://www.wangdk.com/?p=58) 转载自@davidstack 地址:https://blog.youkuaiyun.com/wangdk789/article/details/36682435先把整理的流程图附上 下面按照每个步骤进行说明:1、com.cloud.api.ApiServlet.processRequest(HttpServletReques...
2018-08-24 10:12:25
1612
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人