- 博客(34)
- 收藏
- 关注
原创 whypaxos
为什么是paxos最近又看了次 paxos made simple,每次看完总觉得理解了它,但不久之后又将它忘得一干二净,因此决定这次好好梳理下。本文还参考了微信对于paxos 的实现的相关文章(见 phxpaxos)。本文主要从paxos是如何执行的,已经如果不这么执行,会有什么样的问题来描述paxos,这个思路是我觉得比较好接受的方式。至于paxos的理论证明,在 The Part-Time P
2018-01-07 15:48:54 254
原创 ReverseInteger
leetcode 7. Reverse Integer题目描述:Reverse digits of an integer.Example1: x = 123, return 321 Example2: x = -123, return -321Note: The input is assumed to be a 32-bit signed integer. Your function shoul
2017-10-21 17:57:36 287
原创 Ubuntu非常规命令tips
设置开机启动脚本(以禁止透明大页为例——常用于提高数据库性能):先将开机启动脚本文件放到 /etc/init.d/ 目录下(如:脚本disable-transparent-hugepages),脚本格式参见该目录的 README 文档然后用 chmod 修改该脚本文件权限为755(如:sudo chmod 755 /etc/init.d/disable-transparent-hugepa
2017-01-07 10:27:51 630
原创 hiho #1094 : Lost in the City
题目描述:时间限制:10000ms单点时限:1000ms内存限制:256MB描述Little Hi gets lost in the city. He does not know where he is. He does not know which direction is north.Fortunately, Little Hi has
2016-12-29 12:11:53 567
原创 51nod 1384 全排列
题目描述:给出一个字符串S(可能又重复的字符),按照字典序从小到大,输出S包括的字符组成的所有排列。例如:S = "1312",输出为:112311321213123113121321211321312311311231213211Input输入一个字符串S(S的长度 Output输
2016-12-28 10:57:02 639
原创 Sicily 1001. Alphacode
题目描述 ConstraintsTime Limit: 1 secs, Memory Limit: 32 MBDescriptionAlice and Bob need to send secret messages to each other and are discussing ways to encode their messages: Alice: “Let’s just use a ve
2016-12-27 12:55:56 406
原创 leetcode 278. First Bad Version
题目描述:You are a product manager and currently leading a team to develop a new product. Unfortunately, the latest version of your product fails the quality check. Since each version is developed b
2016-07-24 16:15:49 343
原创 leetcode 182. Duplicate Emails
题目描述:Write a SQL query to find all duplicate emails in a table named Person.+----+---------+| Id | Email |+----+---------+| 1 | a@b.com || 2 | c@d.com || 3 | a@b.com |+----+--------
2016-07-24 15:25:50 414
原创 hiho #1082 : 然而沼跃鱼早就看穿了一切
题目描述:时间限制:1000ms单点时限:1000ms内存限制:256MBfjxmlhx每天都在被沼跃鱼刷屏,因此他急切的找到了你希望你写一个程序屏蔽所有句子中的沼跃鱼(“marshtomp”,不区分大小写)。为了使句子不缺少成分,统一换成 “fjxmlhx” 。输入输入包括多行。每行是一个字符串,长度不超过200。一行的末尾与下
2016-07-10 23:51:34 843
原创 hiho #1051 : 补提交卡
题目描述:时间限制:2000ms单点时限:1000ms内存限制:256MB描述小Ho给自己定了一个宏伟的目标:连续100天每天坚持在hihoCoder上提交一个程序。100天过去了,小Ho查看自己的提交记录发现有N天因为贪玩忘记提交了。于是小Ho软磨硬泡、强忍着小Hi鄙视的眼神从小Hi那里要来M张"补提交卡"。每张"补提交卡"都可以补回一天的提交
2016-07-10 22:44:05 431
原创 leetcode 232. Implement Queue using Stacks
题目描述:Implement the following operations of a queue using stacks.push(x) -- Push element x to the back of queue.pop() -- Removes the element from in front of queue.peek() -- Get the front ele
2016-07-05 22:12:18 393
原创 leetcode 101. Symmetric Tree
题目描述:Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).For example, this binary tree [1,2,2,3,4,4,3] is symmetric: 1 / \ 2 2 / \ / \
2016-06-19 23:53:26 342
原创 leetcode 27. Remove Element
题目描述:Given an array and a value, remove all instances of that value in place and return the new length.Do not allocate extra space for another array, you must do this in place with constant
2016-06-19 18:32:35 352
原创 leetcode 198. House Robber
题目描述:You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is that adj
2016-06-19 17:31:36 316
原创 leetcode 142. Linked List Cycle II
题目描述:Given a linked list, return the node where the cycle begins. If there is no cycle, return null.Note: Do not modify the linked list.Follow up:Can you solve it without using extra s
2016-06-19 11:23:00 355
原创 leetcode 141. Linked List Cycle
题目描述:Given a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using extra space?解题思路:这道题比较简单,用两个指针就可以了。/** * Definition for singly-linked list. * s
2016-06-19 10:15:29 328
原创 hiho #1033 : 交错和
题目描述:时间限制:10000ms单点时限:1000ms内存限制:256MB描述给定一个数 x,设它十进制展从高位到低位上的数位依次是 a0, a1, ..., an - 1,定义交错和函数:f(x) = a0 - a1 + a2 - ... + ( - 1)n - 1an - 1例如:f(3214567) = 3 - 2 + 1
2016-06-18 18:13:44 1250
原创 hdu HDU 3555 Bomb
题目描述:题目链接Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/65536 K (Java/Others)Total Submission(s): 13265 Accepted Submission(s): 4765Problem DescriptionThe counter-
2016-06-14 22:01:02 476
原创 MySQL多列索引
多列索引(Multiple-Column Indexes)也称为复合索引(composite index),也即同时对多个列建立索引。那么问题来了,建立多列索引后,例如建立索引(a, b, c),那么单独对a或者b或者c进行查询,会走索引这条路线吗?答案是:根据最左前缀原则,也就是对a或者(a,b)或者(a, b, c)查询会用到索引,但以b或者c来查询而不加上a则不会走索引,
2016-06-13 17:16:14 1641
原创 51nod 1001 数组中和等于K的数对
题目描述:基准时间限制:1 秒 空间限制:131072 KB 分值: 5 难度:1级算法题给出一个整数K和一个无序数组A,A的元素为N个互不相同的整数,找出数组A中所有和等于K的数对。例如K = 8,数组A:{-1,6,5,3,4,2,9,0,8},所有和等于8的数对包括(-1,9),(0,8),(2,6),(3,5)。I
2016-06-11 21:41:05 898
原创 Code jam Problem A. Minimum Scalar Product
题目描述:ProblemYou are given two vectors v1=(x1,x2,...,xn) and v2=(y1,y2,...,yn). The scalar product of these vectors is a single number, calculated as x1y1+x2y2+...+xnyn.Suppose you are allowe
2016-06-11 18:15:56 705
原创 51nod 1459 迷宫游戏
题目描述:基准时间限制:1 秒 空间限制:131072 KB 分值: 0 难度:基础题 收藏 关注你来到一个迷宫前。该迷宫由若干个房间组成,每个房间都有一个得分,第一次进入这个房间,你就可以得到这个分数。还有若干双向道路连结这些房间,你沿着这些道路从一个房间走到另外一个房间需要一些时间。游戏规定了你的起点和终点房间,你首要目标
2016-06-11 11:06:34 736
原创 leetcode 83. Remove Duplicates from Sorted List
leetcode 83. Remove Duplicates from Sorted List
2016-06-08 22:23:20 295
原创 jdk之Interger.toString(int i, int radix)
jdk之Interger.toString(int i, int radix)
2016-06-07 00:50:29 3160 1
原创 手动编译hadoop2.6.2
ubuntu手动编译hadoop2.6.2由于hadoop2.6.2官网上http://hadoop.apache.org/releases.html上2.6.2版本仅仅提供了64bit的文件,因此在32bit ubuntu机子上只好自己手动编译了。
2015-11-07 19:32:33 459
原创 Git学习
Git的学习git是一种分布式版本控制系统,从这个称呼就不难看出它的两个特点:版本控制, 分布式管理:版本控制$ git init #初始化当前目录为git目录在这个目录下会自动创建一个.git文件夹,在此有几个重要的概念: .git目录为版本库,版本库中会维护着一个暂存区(stage)和各个工作分支(branch),在init目录下不包括.git目录为工作区(working direct
2015-07-19 00:47:59 386
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人