287. Find the Duplicate Number

Given an array nums containing n + 1 integers where each integer is between 1 and n (inclusive), prove that at least one duplicate number must exist....

2016-08-31 08:24:52

阅读数 224

评论数 0

112. Path Sum

Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum.F...

2016-08-30 22:41:17

阅读数 235

评论数 0

328. Odd Even Linked List

Given a singly linked list, group all odd nodes together followed by the even nodes. Please note here we are talking about the node number and not th...

2016-08-30 08:01:13

阅读数 282

评论数 0

318. Maximum Product of Word Lengths

Given a string array words, find the maximum value of length(word[i]) * length(word[j]) where the two words do not share common letters. You may assu...

2016-08-29 22:33:15

阅读数 268

评论数 0

389. Find the Difference

Given two strings s and t which consist of only lowercase letters.String t is generated by random shuffling string s and then add one more letter at ...

2016-08-29 08:09:47

阅读数 454

评论数 0

12. Integer to Roman

Given an integer, convert it to a roman numeral.Input is guaranteed to be within the range from 1 to 3999.Subscribe to see which companies asked this...

2016-08-27 14:11:09

阅读数 334

评论数 0

238. Product of Array Except Self

Given an array of n integers where n > 1, nums, return an array output such that output[i] is equal to the product of all the elements of nums exc...

2016-08-26 20:47:03

阅读数 352

评论数 0

384. Shuffle an Array

Shuffle a set of numbers without duplicates.Example:// Init an array with set 1, 2, and 3. int[] nums = {1,2,3}; Solution solution = new Solution(n...

2016-08-26 08:44:03

阅读数 334

评论数 0

343. Integer Break

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 pr...

2016-08-25 22:33:01

阅读数 216

评论数 0

319. Bulb Switcher

题目大意是,有n只初始处于关闭状态的灯泡。你首先打开所有的灯泡(第一轮)。然后,熄灭所有序号为2的倍数的灯泡。第三轮,切换所有序号为3的倍数的灯泡(开着的就关掉,关着的就打开)。第n轮,你只切换最后一只灯泡。计算n轮之后还有几盏灯泡亮着。 先看看以下规律: 第1个灯泡:1的倍数,会改变1次状态...

2016-08-25 22:12:53

阅读数 206

评论数 0

357. Count Numbers with Unique Digits

Count Numbers with Unique Digits QuestionEditorial Solution My Submissions Total Accepted: 13025 Total Submissions: 29945 Difficulty: Medium Gi...

2016-08-25 18:07:38

阅读数 226

评论数 0

347. Top K Frequent Elements

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 as...

2016-08-25 16:56:05

阅读数 212

评论数 0

python Scapy 随心所欲撩tcp协议栈

1. 前言如果只需要研究Linux的tcp协议栈行为,只需要使用packetdrill就能够满足我的所有需求。packetdrill才是让我随心所欲地撩tcp协议栈。packetdrill的简单使用手册。然而悲剧的是,除了要研究Linux的TCP协议栈行为,还需要研究Windows的tcp协议栈的...

2016-08-25 00:25:14

阅读数 11612

评论数 0

Linux TCP 协议栈数据流走读

1. 综述Linux的TCP协议非常复杂,看了几天Linux内核的tcp实现犹如雾里看花。在这里主要是根据书籍《The Linux Networking Architecture》 24章,以及结合网上的资料,走读一遍tcp协议的数据流的发送和接收。而内核源码是Centos 7.2的标准内核3.1...

2016-08-24 22:34:39

阅读数 3022

评论数 0

268. Missing Number

Given an array containing n distinct numbers taken from 0, 1, 2, …, n, find the one that is missing from the array.For example, Given nums = [0, 1, ...

2016-08-24 21:40:17

阅读数 234

评论数 0

338. Counting Bits

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 ...

2016-08-24 08:28:27

阅读数 217

评论数 0

260. Single Number III

Given an array of numbers nums, in which exactly two elements appear only once and all the other elements appear exactly twice. Find the two elements...

2016-08-23 21:15:24

阅读数 232

评论数 0

167. Two Sum II - Input array is sorted

Given an array of integers that is already sorted in ascending order, find two numbers such that they add up to a specific target number.The function...

2016-08-23 20:34:11

阅读数 182

评论数 0

9. Palindrome Number

Determine whether an integer is a palindrome. Do this without extra space.click to show spoilers.Subscribe to see which companies asked this question...

2016-08-23 07:57:22

阅读数 259

评论数 0

172. Factorial Trailing Zeroes

Given an index k, return the kth row of the Pascal’s triangle.For example, given k = 3, Return [1,3,3,1].Note: Could you optimize your algorithm to...

2016-08-23 07:37:40

阅读数 161

评论数 0

取消 删除