- 博客(127)
- 收藏
- 关注
原创 LeetCode - 3Sum Closest
Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three integers. You may assume that each input would have exact
2014-09-20 16:57:48
355
原创 LeetCode - 4Sum
Given an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = target? Find all unique quadruplets in the array which gives the sum of target.Note:Element
2014-09-19 12:19:29
389
原创 LeetCode - Gas Station
There are N gas stations along a circular route, where the amount of gas at station i is gas[i].You have a car with an unlimited gas tank and it costs cost[i] of gas to travel from station i to
2014-09-17 19:13:27
423
原创 LeetCode - Clone Graph
Clone an undirected graph. Each node in the graph contains a label and a list of its neighbors.OJ's undirected graph serialization:Nodes are labeled uniquely.We use # as a separator for ea
2014-09-17 17:04:39
393
原创 LeetCode - Single Number
Given an array of integers, every element appears twice except for one. Find that single one.Note:Your algorithm should have a linear runtime complexity. Could you implement it without using ext
2014-09-17 15:36:40
322
原创 LeetCode - Copy List with Random Pointer
A linked list is given such that each node contains an additional random pointer which could point to any node in the list or null.Return a deep copy of the list./** * Definition for singly-linke
2014-09-17 15:31:57
317
原创 LeetCode - Linked List Cycle II
Given a linked list, return the node where the cycle begins. If there is no cycle, return null.Follow up:Can you solve it without using extra space?/** * Definition for singly-linked list. * s
2014-09-17 15:10:23
350
原创 LeetCode - 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?
2014-09-17 14:55:23
348
原创 LeetCode - Reorder List
Given a singly linked list L: L0→L1→…→Ln-1→Ln,reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→…You must do this in-place without altering the nodes' values.For example,Given {1,2,3,4}, reorder it to
2014-09-17 14:38:56
262
原创 LeetCode - Binary Tree Preorder Traversal
Given a binary tree, return the preorder traversal of its nodes' values.For example:Given binary tree {1,#,2,3}, 1 \ 2 / 3return [1,2,3].Note: Recursive soluti
2014-09-17 11:08:49
315
原创 LeetCode - Binary Tree Postorder Traversal
Given a binary tree, return the postorder traversal of its nodes' values.For example:Given binary tree {1,#,2,3}, 1 \ 2 / 3return [3,2,1].Note: Recursive solut
2014-09-17 10:49:55
302
原创 LeetCode - Evaluate Reverse Polish Notation
Evaluate the value of an arithmetic expression in Reverse Polish Notation.Valid operators are +, -, *, /. Each operand may be an integer or another expression.Some examples: ["2", "1",
2014-09-16 17:47:33
320
原创 LeetCode - Reverse Words in a String
Given an input string, reverse the string word by word.For example,Given s = "the sky is blue",return "blue is sky the".click to show clarification.Clarification:What constitutes
2014-09-16 16:08:12
320
转载 我的求职经历:走进过腾讯、网易、百度、迅雷
作者是一名工科男,从九月份开始找工作,辗转广州、上海、北京等城市,走进腾讯、网易、华为、大众点评、思科、360、百度、迅雷、多玩、海豚、广州移动、搜狐、中兴等企业,历经N次笔试面试,终于成功收获一份offer。全文有25273字,真实的经历,精彩的看法,建议正在找工作或即将毕业的同学不妨抽点时间学习一下。)前两天不再像之前那么多事情了,终于有时间把我这段时间的求职经历与大家分享一下。在开始
2013-09-06 11:07:49
6551
1
转载 IT农民工:那些年,我面试过的互联网巨头公司
IT是一个人才日益紧缺的行业,2012年的人才需求比2011年上涨了将近2.3倍。随着人才的紧缺,IT业的薪水也是水涨船高。互联网巨头们对人才的争夺,更是日益激烈化。对于从事IT的职场人士,绝大部门都想进入那些巨头公司。除了薪水高、办公环境好,发展更有前景外,更让人有职业自豪感。虽然人才日益缺乏,但并非谁都可以进入互联网巨头公司的,它们的门槛都设置的较高。如果你有幸接到了这些巨头公司的面试
2013-09-06 11:04:57
1005
转载 从微软到谷歌:9个offer/12家公司/35场面试
1,简介毕业答辩搞定,总算可以闲一段时间,把这段求职经历写出来,也作为之前三个半月的求职的回顾。首先说说我拿到的offer情况:微软,3面->终面,搞定百度,3面->终面,口头offer搜狗,2面,悲剧腾讯,1面,悲剧布丁移动,3面,搞定涂鸦游戏,3面,搞定友盟,3面->CEO面,搞定雅虎,4面->终面,搞定微
2013-09-06 11:03:42
1983
转载 经典的智力题-1
【1】假设有一个池塘,里面有无穷多的水。现有2个空水壶,容积分别为5升和6升。问题是如何只用这2个水壶从池塘里取得3升的水。由满6向空5倒,剩1升,把这1升倒5里,然后6剩满,倒5里面,由于5里面有1升水,因此6只能向5倒4升水,然后将6剩余的2升,倒入空的5里面,再灌满6向5里倒3升,剩余3升。【2】周雯的妈妈是豫林水泥厂的化验员。一天,周雯来到化验室做作业。做完后想出去玩。"等等,
2013-09-05 22:07:04
2601
原创 LeetCode - Minimum Window Substring
Given a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity O(n).For example,S = "ADOBECODEBANC"T = "ABC"Minimum window is "BAN
2013-08-29 22:50:53
507
原创 LeetCode - Scramble String
Given a string s1, we may represent it as a binary tree by partitioning it to two non-empty substrings recursively.Below is one possible representation of s1 = "great": great / \ gr
2013-08-29 20:32:38
420
原创 LeetCode - Decode Ways
A message containing letters from A-Z is being encoded to numbers using the following mapping:'A' -> 1'B' -> 2...'Z' -> 26Given an encoded message containing digits, determine the total nu
2013-08-29 15:00:20
344
原创 LeetCode - Distinct Subsequences
Given a string S and a string T, count the number of distinct subsequences of T in S.A subsequence of a string is a new string which is formed from the original string by deleting some (can be n
2013-08-29 10:52:19
411
原创 LeetCode - Longest Consecutive Sequence
Given an unsorted array of integers, find the length of the longest consecutive elements sequence.For example,Given [100, 4, 200, 1, 3, 2],The longest consecutive elements sequence is [1,
2013-08-29 09:46:01
363
原创 LeetCode - Multiply Strings
Given two numbers represented as strings, return multiplication of the numbers as a string.Note: The numbers can be arbitrarily large and are non-negative.class Solution {public: void ad
2013-08-28 22:53:36
327
原创 LeetCode - Container With Most Water
Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of line i is at (i, ai) and (i, 0). F
2013-08-28 21:59:00
433
原创 LeetCode - Word Ladder II
Given two words (start and end), and a dictionary, find all shortest transformation sequence(s) from start to end, such that:Only one letter can be changed at a timeEach intermediate word
2013-08-28 21:39:25
555
原创 LeetCode- Word Ladder
Given two words (start and end), and a dictionary, find the length of shortest transformation sequence from start to end, such that:Only one letter can be changed at a timeEach intermediat
2013-08-28 18:14:23
376
原创 LeetCode - Merge Intervals
Given a collection of intervals, merge all overlapping intervals.For example,Given [1,3],[2,6],[8,10],[15,18],return [1,6],[8,10],[15,18]./** * Definition for an interval. * struct I
2013-08-28 16:57:11
367
原创 LeetCode - Insert Interval
Given a set of non-overlapping intervals, insert a new interval into the intervals (merge if necessary).You may assume that the intervals were initially sorted according to their start times.E
2013-08-28 16:24:11
333
原创 LeetCode - Restore IP Addresses
Given a string containing only digits, restore it by returning all possible valid IP address combinations.For example:Given "25525511135",return ["255.255.11.135", "255.255.111.35"]. (Orde
2013-08-28 15:28:12
282
原创 LeetCode - Rotate Image
You are given an n x n 2D matrix representing an image.Rotate the image by 90 degrees (clockwise).Follow up:Could you do this in-place?class Solution {public: void rotate(vector > &
2013-08-28 14:26:04
321
原创 LeetCode - Gray Code
The gray code is a binary numeral system where two successive values differ in only one bit.Given a non-negative integer n representing the total number of bits in the code, print the sequence of
2013-08-28 14:24:46
366
原创 LeetCode - Word Search
Given a 2D board and a word, find if the word exists in the grid.The word can be constructed from letters of sequentially adjacent cell, where "adjacent" cells are those horizontally or vertically
2013-08-28 14:19:11
373
原创 LeetCode - Set Matrix Zeroes
Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in place.Follow up:Did you use extra space?A straight forward solution using O(mn) space is probably a b
2013-08-28 10:29:18
372
原创 LeetCode - Sort Colors
Given an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order red, white and blue.Here, we will use the integer
2013-08-28 10:00:19
312
原创 LeetCode - Permutation Sequence
The set [1,2,3,…,n] contains a total of n! unique permutations.By listing and labeling all of the permutations in order,We get the following sequence (ie, for n = 3):"123""132""213"
2013-08-27 23:35:40
296
原创 LeetCode - Count and Say
The count-and-say sequence is the sequence of integers beginning as follows:1, 11, 21, 1211, 111221, ...1 is read off as "one 1" or 11.11 is read off as "two 1s" or 21.21 is read
2013-08-27 23:35:29
374
原创 LeetCode - Edit Distance
Given two words word1 and word2, find the minimum number of steps required to convert word1 to word2. (each operation is counted as 1 step.)You have the following 3 operations permitted on a w
2013-08-27 23:35:17
343
原创 LeetCode - Generate Parentheses
Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, given n = 3, a solution set is:"((()))", "(()())", "(())()", "()(())", "()
2013-08-27 23:15:14
307
原创 LeetCode - Valid Parentheses
Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.The brackets must close in the correct order, "()" and "()[]{}" are all va
2013-08-27 22:54:50
300
原创 LeetCode - Combination Sum II
Given a collection of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T.Each number in C may only be used once in the c
2013-08-27 22:40:06
322
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人