- 博客(68)
- 资源 (2)
- 收藏
- 关注
原创 快速排序(python)
class Solution: def maxArea(self, height): """ :type height: List[int] :rtype: int """ self.QSort(height,0,len(height)-1) return height[len(h
2017-11-23 20:13:52
243
原创 Add to List 203. Remove Linked List Elements
Remove all elements from a linked list of integers that have value val.Example Given: 1 –> 2 –> 6 –> 3 –> 4 –> 5 –> 6, val = 6 Return: 1 –> 2 –> 3 –> 4 –> 5# Definition for singly-linked list.# clas
2017-11-19 21:49:24
287
原创 Find Minimum in Rotated Sorted Array
Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand.(i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2).Find the minimum element.You may assume no duplicate exist
2017-11-19 21:04:09
225
原创 Best Time to Buy and Sell Stock with Transaction Fee
Your are given an array of integers prices, for which the i-th element is the price of a given stock on day i; and a non-negative integer fee representing a transaction fee. You may complete as many t
2017-11-13 22:59:14
239
原创 495. Teemo Attacking
In LOL world, there is a hero called Teemo and his attacking can make his enemy Ashe be in poisoned condition. Now, given the Teemo’s attacking ascending time series towards Ashe and the poisoning time
2017-11-13 21:22:26
210
原创 Add Two Numbers
You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it
2017-11-09 22:16:26
177
原创 718. Maximum Length of Repeated Subarray
Given two integer arrays A and B, return the maximum length of an subarray that appears in both arrays. Example 1: Input: A: [1,2,3,2,1] B: [3,2,1,4,7] Output: 3 Explanation: The repeated subar
2017-11-02 21:18:45
187
原创 717. 1-bit and 2-bit Characters
We have two special characters. The first character can be represented by one bit 0. The second character can be represented by two bits (10 or 11). Now given a string represented by several bits. Re
2017-10-30 20:28:53
248
原创 575. Distribute Candies
Given an integer array with even length, where different numbers in this array represent different kinds of candies. Each number means one candy of the corresponding kind. You need to distribute these
2017-05-31 21:09:41
287
原创 557. Reverse Words in a String III
Given a string, you need to reverse the order of characters in each word within a sentence while still preserving whitespace and initial word order.Example 1: Input: “Let’s take LeetCode contest” Out
2017-05-30 15:16:47
522
原创 599. Minimum Index Sum of Two Lists
Suppose Andy and Doris want to choose a restaurant for dinner, and they both have a list of favorite restaurants represented by strings.You need to help them find out their common interest with the
2017-05-29 10:54:02
303
原创 SIP协议
RFC文档搜索网址https://www.rfc-editor.org/search/rfc_search_detail.php?rfc=RFC3261&pubstatus%5B%5D=Any&pub_date_type=anySIP(Session Initiation Protocol,会话初始协议)是由IETF(Internet Engineering Task Force,因特网工程任
2017-05-28 15:35:46
314
原创 c++对象编程
1、如果基类中由static成员,无论从基类派生出多少个派生类,每个static成员只有1个实例。2、派生类对象也是基类对象。存在从派生类对象的引用转化为基类子对象的引用,对指针也类似。不存在基类引用或指针到派生类引用或指针的自动转换。基类类型对象既可以作为派生类对象的一部分而存在,也可以是独立的对象存在。每个基类对象可能是也可能不是派生类对象的部分。
2017-05-21 15:12:12
203
原创 566. Reshape the Matrix
In MATLAB, there is a very useful function called ‘reshape’, which can reshape a matrix into a new one with different size but keep its original data. You’re given a matrix represented by a two-dimen
2017-05-07 23:26:13
331
原创 561. Array Partition I
Given an array of 2n integers, your task is to group these integers into n pairs of integer, say (a1, b1), (a2, b2), …, (an, bn) which makes sum of min(ai, bi) for all i from 1 to n as large as possibl
2017-05-07 22:06:26
307
原创 521 Longest Uncommon Subsequence I
Given a group of two strings, you need to find the longest uncommon subsequence of this group of two strings. The longest uncommon subsequence is defined as the longest subsequence of one of these stri
2017-04-16 22:03:48
279
转载 免密登录的shell脚本
这里#!/bin/bash# 功能 : 使用except无需输入密码自动登录ssh# Author : Jiangxianli# Date : 2016/01/14#服务器配置项CONFIGS=( "服务器名称 22 220.181.57.217 root baidu.com" "新浪服务器 22 66.102.251.33 root sina.com"
2017-04-10 22:45:27
661
原创 I/O的5个基本模型
阻塞I/O非阻塞I/OI/O复用(select和poll)信号驱动I/O(SIGIO)异步I/O(Posix.1的aio_系列函数) 前四种都是同步,最后是异步。
2017-04-09 22:07:37
225
转载 进程和线程的区别
1)调度 传统的操作系统中,进程是拥有资源的基本单位和独立调度、分配的基本单位。在引入线程的操作系统中,线程是调度的基本单位,进程是资源的拥有的基本单位。 2)并发性 引入线程的操作系统中,不仅进程之间可以并发执行,一个进程中的多个线程也可以并发执行,使操作系统具有更好的并发性,更加有效利用提高系统资源的利用率。 3)拥有资源 传统的操作系统,还是引入线程的操作系统中,进程都可以
2017-04-09 21:36:58
337
转载 linux sed命令学习
sed是一个很好的文件处理工具,本身是一个管道命令,主要是以行为单位进行处理,可以将数据行进行替换、删除、新增、选取等特定工作,下面先了解一下sed的用法 sed命令行格式为: sed [-nefri] ‘command’ 输入文本 常用选项: -n∶使用安静(silent)模式。在一般 sed 的用法中,所有来自 STDIN的资料一般都会被列出
2017-04-09 17:21:11
254
原创 linux awk学习
awk是一种编程语言,用于在linux/unix下对文本和数据进行处理。数据可以来自标准输入(stdin)、一个或多个文件,或其它命令的输出。它支持用户自定义函数和动态正则表达式等先进功能,是linux/unix下的一个强大编程工具。它在命令行中使用,但更多是作为脚本来使用。awk有很多内建的功能,比如数组、函数等,这是它和C语言的相同之处,灵活性是awk最大的优势。awk 'BEGIN{ comm
2017-04-09 17:04:31
219
原创 《大话存储-网络存储系统原理经解与最佳实践》读书笔记
PoPPotocol over Potocol,协议融合。调用、隧道封装和映射是协议之间相互之间作用的三种思想。FC协议FC是Fibre Channel的简称,是网状通道的意思。FC协议,类比TCP/IP协议,都遵循OSI模型,可以用OSI模型进行断层分析。物理层要支持光纤。FC协议大部分逻辑直接做到一块独立的硬件卡片当中,不是运行在操作系统中,少数运行于操作系统FC卡驱动程序。TCP/IP协议运行
2017-04-08 20:52:44
613
原创 《大规模分布式存储系统:原理解析与架构实战》读书笔记
《大规模分布式存储系统:原理解析与架构实战》读书笔记1、事务满足ACID特性2、单机存储引擎:哈希存储引擎和B树存储引擎和LSM存储引擎。存储系统的数据模型:文件模型、关系模型和键值模型。3、分布式系统:数据分布、复制、一致性、容错。数据分布的方式:哈希分布和顺序分布。将数据 分散到多台机器之后,需要保证多台机器之间的负载均衡。衡量负载涉及的因素有很多,如cpu,内存。负载均衡需要执行数据迁移操作。
2017-04-08 18:00:50
894
原创 《kvm虚拟化技术 实战与原理解析》读书笔记
《kvm虚拟化技术 实战与原理解析》1、kvm原理简介2、kvm核心基础功能3、kvm管理功能4、kvm性能测试以及参考数据
2017-04-08 12:42:30
1684
原创 《存储入门》读书笔记
《存储入门》读书笔记1、文件系统文件系统定义了把文件存储于磁盘时所必须的数据结构及磁盘数据的管理方式。我们知道,磁盘是由很多个扇区(Sector)组成的,如果扇区之间不建立任何的关系,写入其中的文件就无法访问,因为无法知道文件从哪个扇区开始,文件占多少个扇区,文件有什么属性。为了访问磁盘中的数据,就必需在扇区之间建立联系,也就是需要一种逻辑上的数据存储结构。建立这种逻辑结构就是文件系统要做的事情,在
2017-04-08 12:33:43
1224
原创 《数据恢复技术深度揭秘》读书笔记
《数据恢复技术深度揭秘》读书笔记1、raid级别 raid 级 raid-0 raid-1 raid-3 raid-5 raid-10 raid-30 raid-50 别名 条带 镜像 专用奇偶位条带 分布式奇偶位条带 镜像阵列条带 专用奇偶阵列条带 分布式奇偶位条带 容错性 没有 有 有 有 有 有 有
2017-04-08 12:27:32
1041
原创 237. Delete Node in a Linked List python
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 -> 4 and you are given the third node with value
2017-04-04 22:53:15
239
原创 Reverse a singly linked list python
Reverse a singly linked list.class Solution(object): def reverseList(self, head): """ :type head: ListNode :rtype: ListNode """ prev = None while
2017-04-03 16:06:17
264
原创 13. Roman to Integer python
Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.def romanToInt(self, s): roman = {'M': 1000,'D': 500 ,'C': 100,'L': 50,'X': 10,'V'
2017-04-02 20:55:25
435
原创 217. Contains Duplicate python
Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice in the array, and it should return false if every element
2017-03-26 22:53:28
231
原创 leetcode 401. Binary Watch python
A binary watch has 4 LEDs on the top which represent the hours (0-11), and the 6 LEDs on the bottom represent the minutes (0-59).Each LED represents a zero or one, with the least significant bit o
2017-03-26 22:37:11
259
原创 leetcode 409. Longest Palindrome python
Given a string which consists of lowercase or uppercase letters, find the length of the longest palindromes that can be built with those letters.This is case sensitive, for example "Aa" is not consi
2017-03-21 22:20:26
245
原创 leetcode 242. Valid Anagram python
Given two strings s and t, write a function to determine if t is an anagram of s.For example,s = "anagram", t = "nagaram", return true.s = "rat", t = "car", return false.Note:You may ass
2017-03-19 21:52:22
192
原创 leetcode 169. Majority Element python
Given an array of size n, find the majority element. The majority element is the element that appearsmore than ⌊ n/2 ⌋ times.You may assume that the array is non-empty and the majority element alw
2017-03-19 21:20:07
242
原创 leetcode 122. Best Time to Buy and Sell Stock II python
Say you have an array for which the ith element is the price of a given stock on dayi.Design an algorithm to find the maximum profit. You may complete as many transactions as you like (ie, buy one
2017-03-12 21:31:27
220
原创 leetcode 387. First Unique Character in a String python
Given a string, find the first non-repeating character in it and return it's index. If it doesn't exist, return -1.Examples: s = "leetcode"return 0.s = "loveleetcode",return 2.Note: You m
2017-03-12 21:10:01
176
原创 leetcode 349. Intersection of Two Arrays python
Given two arrays, write a function to compute their intersection.Example:Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return[2]. class Solution(object): def intersection(self, nums1
2017-03-12 21:07:26
181
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人