自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

Ran's Hacking Zone

Welcome my friend.

  • 博客(19)
  • 收藏
  • 关注

原创 Graph的那些事儿

0. 导言为了让代码更加清晰,有以下一些约定:Graph的表示使用邻接表,更详细的说明参见 图的表示本文代码中使用的图为 有向图,图中的顶点用 int 型来表示图的顶点数经初始化后不可变,图的初始化有以下两种形式Graph(int verCount);Graph(String filename);其中文件内容为:100 // 顶点数1000 //边数52 59 // 以下每一行代表一

2016-05-30 17:09:32 694

原创 LeetCode No334. Increasing Triplet Subsequence

1. 问题描述Given an unsorted array return whether an increasing subsequence of length 3 exists or not in the array.Formally the function should: Return true if there exists i, j, k such that arr[i] <

2016-05-27 22:18:08 320

原创 Web缓存工作原理

现代的商业化代理缓存相当的复杂。这些缓存构建的非常高效,可以支持HTTP和其他一些技术的各种高级特性。但除了一些微妙的细节之外,Web缓存的基本工作原理大多很简单。对一条HTTP GET报文的基本缓存处理过程包括7个步骤:接收——缓存从网络中读取抵达的请求报文解析——缓存对报文进行解析,提取URL和各种首部查询——缓存查看是否有本地副本可用,如果没有,就获取一份副本(将其保存在本地)新鲜度检

2016-05-24 23:46:46 5594

原创 LeetCode No336. Palindrome Pairs

1. 题目描述Given a list of unique words. Find all pairs of distinct indices (i, j) in the given list, so that the concatenation of the two words, i.e. words[i] + words[j] is a palindrome.Example 1: Given

2016-05-22 22:45:47 429

原创 LeetCode No.337. House Robber III

1. 题目描述The thief has found himself a new place for his thievery again. There is only one entrance to this area, called the “root.” Besides the root, each house has one and only one parent house. Aft

2016-05-22 22:23:33 296

原创 HTTP代理的那些事儿

1. Web的中间实体Web代理(proxy)服务器是网络的中间实体。代理位于客户端和服务器之间,扮演”中间人”的角色,在各端点之间来回传送HTTP报文。代理服务器可以是某个客户端专用的,也可以是很多客户端共享的。单个客户端使用的代理被称为私有代理。众多客户端共享的代理被称为公共代理。代理与网关的对比:严格的说,代理连接的是两个或多个使用相同协议的应用程序,而网关连接的则是两个或多个使用不同协

2016-05-20 22:43:29 7306

原创 LeetCode No338. Counting Bits

1. 题目描述Given a non negative integer number num. For every numbers i in the range 0 ≤ i ≤ num calculate the number of 1’s in their binary representation and return them as an array.Example: For nu

2016-05-19 10:49:39 344

原创 CAP和BASE理论

1. CAP定理CAP理论告诉我们,一个分布式系统不可能同时满足一致性(C:Consistency),可用性(A:Availability)和分区容错性(P:Partition tolerance)这三个需求,最多只能同时满足其中的两项。 1.1 一致性在分布式环境中,一致性是指数据在多个副本之间是否能够保持一致的特性。在一致性的需求下,当一个系统在数据一致的状况下执行更新操作后,应该保持系统的

2016-05-16 12:49:51 684

原创 PF_RING ZC流量转发详解

1. 准备工作首先新建四个虚拟接口(dummy interface)进行后续的报文转发和计数modprobe dummy numdummies=4ifconfig dummy0 upifconfig dummy1 upifconfig dummy2 upifconfig dummy3 up注:若想卸载这四个虚拟接口,请运行rmmod dummy2. zbalance_ipc程序进行流量转发测

2016-05-15 12:20:39 5814

原创 LeetCode No341. Flatten Nested List Iterator

1. 题目描述Given a nested list of integers, implement an iterator to flatten it.Each element is either an integer, or a list – whose elements may also be integers or other lists.Example 1: Given the list

2016-05-14 13:14:23 403

原创 LeetCode No342. Power of Four

1. 题目描述Given an integer (signed 32 bits), write a function to check whether it is a power of 4.Example: Given num = 16, return true. Given num = 5, return false.Follow up: Could you solve it without l

2016-05-13 12:09:00 307

原创 LeetCode No343. Integer Break

1. 题目描述Given a positive integer n, break it into the sum of at least two positive integers and maximize the product of those integers. Return the maximum product you can get.For example, given n = 2, r

2016-05-13 11:41:08 296

原创 HTTP连接管理的那些事儿

1. HTTP连接HTTP连接实际上就是TCP连接和一些使用连接的规则。TCP为HTTP提供了一条可靠的比特传输管道。从TCP连接一端填入的字节会从另一端以原有的顺序、正确地传送出来。E.g. http://blog.csdn.net/okingniko/article/details/50986039 1. 浏览器解析出主机名blog.csdn.net 2. 浏览器查询这个主机的IP地址(D

2016-05-12 16:09:19 490

原创 LeetCode No344. Reverse String

1. 题目描述Write a function that takes a string as input and returns the string reversed.Example: Given s = “hello”, return “olleh”.2. 初步思路直接使用标准库reverse函数3. 初步算法class Solution {public: string revers

2016-05-12 11:05:11 250

原创 LeetCode No345. Reverse Vowels of a String

1. 题目描述Write a function that takes a string as input and reverse only the vowels of a string.Example 1: Given s = “hello”, return “holle”.Example 2: Given s = “leetcode”, return “leotcede”.2. 初步算法cla

2016-05-12 10:59:46 308

原创 LeetCode No347. Top K Frequent Elements

1. 题目描述Given a non-empty array of integers, return the k most frequent elements.For example, Given [1,1,1,2,2,3] and k = 2, return [1,2].Note: You may assume k is always valid, 1 ≤ k ≤ number of uni

2016-05-12 10:38:39 300

原创 HTTP报文的那些事儿

1. 报文流HTTP报文是在HTTP应用程序之间发送的数据块。这些数据块已一些文本形式的元信息(meta-information)开头,这些信息描述了报文的内容及含义。HTTP报文是由一行一行的简单字符串组成的。HTTP报文都是纯文本,不是二进制代码,所以人们可以很方便的对其进行读写。HTTP使用术语流入(inbound)和流出(outbound)来描述事务处理的方向。HTTP报文会像河水一样

2016-05-11 11:22:15 519

原创 URL的那些事儿

1. URL语法<scheme>://<user>:<password>@<host>:<port>/<path>;<params>?<query>#<frag>相关说明: 组件 描述 默认值 方案 访问服务器以获取资源时要使用哪种协议 无 用户 某些方案访问资源时需要的用户名 匿名 密码 用户名后面可能要包含的密码,中间由冒号(:)分隔 <E-mail

2016-05-10 14:08:28 1024

原创 敏捷开发修炼之道

1. 敏捷——高效软件开发之道敏捷开发宣言个体和交互胜过于过程和工具可工作的软件胜过面面俱到的文档客户协作胜过合同谈判响应变化胜过遵循计划敏捷的精神开发要持续不断,切勿时断时续持续注入能量敏捷的修炼之道敏捷开发就是在一个高度协作的环境中,不断地使用反馈进行自我调整和完善。在功能不变的情况下,重新设计部分代码,改善代码质量,这就是所谓的重构。敏捷工具箱Wiki版本控制单元测试自

2016-05-09 21:22:07 790

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除