02 2015 档案
摘要:LeetCode上的题很不错,都短小精悍。先说说我自己。本科一直都是偏硬件,做些单片机、FPGA的东西。本科毕业设计写了个Android APP,控制外围电路(一个小车)。可以通过Android手机的重力感应和按钮来控制小车的运动。目前在读研,前段时间去XX公司实习了一段时间,自己画了块电路板,调F...
阅读全文
摘要:题目要求:Pow(x, n)Implement pow(x,n).代码如下:class Solution {public: //采用二分法 //时间复杂度 O(logn),空间复杂度 O(1) double pow(double x, int n) { ...
阅读全文
摘要:题目要求:AnagramsGiven an array of strings, return all groups of strings that are anagrams.Note: All inputs will be in lower-case.分析:参考网址:http://www.cnblo...
阅读全文
摘要:题目要求:Rotate ImageYou are given annxn2D matrix representing an image.Rotate the image by 90 degrees (clockwise).Follow up:Could you do this in-place?代码...
阅读全文
摘要:题目要求:Permutations IIGiven a collection of numbers that might contain duplicates, return all possible unique permutations.For example,[1,1,2]have the f...
阅读全文
摘要:题目要求:Permutations(全排列)Given a collection of numbers, return all possible permutations.For example,[1,2,3]have the following permutations:[1,2,3],[1,3,...
阅读全文
摘要:题目要求:Jump Game IIGiven an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array repre...
阅读全文
摘要:题目要求:Wildcard MatchingImplement wildcard pattern matching with support for'?'and'*'.'?' Matches any single character.'*' Matches any sequence of chara...
阅读全文
摘要:题目要求:Multiply StringsGiven two numbers represented as strings, return multiplication of the numbers as a string.Note: The numbers can be arbitrarily l...
阅读全文
摘要:题目要求:Trapping Rain WaterGivennnon-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able ...
阅读全文
摘要:题目要求:First Missing PositiveGiven an unsorted integer array, find the first missing positive integer.For example,Given[1,2,0]return3,and[3,4,-1,1]retur...
阅读全文
摘要:题目要求:Combination Sum IIGiven a collection of candidate numbers (C) and a target number (T), find all unique combinations inCwhere the candidate number...
阅读全文
摘要:题目要求:Combination SumGiven a set of candidate numbers (C) and a target number (T), find all unique combinations inCwhere the candidate numbers sums toT...
阅读全文
摘要:题目要求:Count and SayThe count-and-say sequence is the sequence of integers beginning as follows:1, 11, 21, 1211, 111221, ...1is read off as"one 1"or11.1...
阅读全文
摘要:题目要求:Sudoku SolverWrite a program to solve a Sudoku puzzle by filling the empty cells.Empty cells are indicated by the character'.'.You may assume tha...
阅读全文
摘要:题目要求:Valid SudokuDetermine if a Sudoku is valid, according to:Sudoku Puzzles - The Rules.The Sudoku board could be partially filled, where empty cells...
阅读全文
摘要:题目要求:Search Insert PositionGiven a sorted array and a target value, return the index if the target is found. If not, return the index where it would b...
阅读全文
摘要:题目要求:Search for a RangeGiven a sorted array of integers, find the starting and ending position of a given target value.Your algorithm's runtime comple...
阅读全文
摘要:题目要求:Search in Rotated Sorted ArraySuppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e.,0 1 2 4 5 6 7might become4 5 6 7 0 ...
阅读全文
摘要:题目描述:Longest Valid ParenthesesGiven a string containing just the characters'('and')', find the length of the longest valid (well-formed) parentheses s...
阅读全文
摘要:题目要求:Substring with Concatenation of All WordsYou are given a string,S, and a list of words,L, that are all of the same length. Find all starting indi...
阅读全文
摘要:题目要求:Divide Two IntegersDivide two integers without using multiplication, division and mod operator.If it is overflow, return MAX_INT.分析:不能用乘、除和取余,则只能...
阅读全文
摘要:题目要求:Implement strStr()Implement strStr().Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.Jav...
阅读全文
摘要:题目要求:Remove ElementGiven an array and a value, remove all instances of that value in place and return the new length.The order of elements can be chan...
阅读全文
摘要:题目描述:Remove Duplicates from Sorted ArrayGiven a sorted array, remove the duplicates in place such that each element appear onlyonceand return the new ...
阅读全文
摘要:题目描述:Reverse Nodes in k-GroupGiven a linked list, reverse the nodes of a linked listkat a time and return its modified list.If the number of nodes is ...
阅读全文
摘要:题目描述:Swap Nodes in PairsGiven a linked list, swap every two adjacent nodes and return its head.For example,Given1->2->3->4, you should return the list...
阅读全文
摘要:题目要求:Merge k Sorted ListsMergeksorted linked lists and return it as one sorted list. Analyze and describe its complexity.AnalysisThe simplest solution...
阅读全文
摘要:题目描述:Generate ParenthesesGivennpairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, givenn= 3, ...
阅读全文
摘要:题目描述:Valid ParenthesesGiven a string containing just the characters'(',')','{','}','['and']', determine if the input string is valid.The brackets must...
阅读全文
摘要:题目描述:Remove Nth Node From End of ListGiven a linked list, remove thenthnode from the end of list and return its head.For example, Given linked list:...
阅读全文
摘要:题目描述:4SumGiven an arraySofnintegers, are there elementsa,b,c, anddinSsuch thata+b+c+d= target? Find all unique quadruplets in the array which gives th...
阅读全文
摘要:题目描述:Letter Combinations of a Phone NumberGiven a digit string, return all possible letter combinations that the number could represent.A mapping of d...
阅读全文
摘要:题目描述:3Sum ClosestGiven an arraySofnintegers, find three integers inSsuch that the sum is closest to a given number, target. Return the sum of the thre...
阅读全文
摘要:题目描述:3SumGiven an arraySofnintegers, are there elementsa,b,cinSsuch thata+b+c= 0? Find all unique triplets in the array which gives the sum of zero.No...
阅读全文
摘要:题目描述:Longest Common PrefixWrite a function to find the longest common prefix string amongst an array of strings.代码如下:class Solution {public: string...
阅读全文
摘要:题目描述:Roman to IntegerGiven a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.分析:① 输入为VII,则数字为V + I +...
阅读全文
摘要:题目描述:Integer to RomanGiven an integer, convert it to a roman numeral.Input is guaranteed to be within the range from 1 to 3999.罗马数字的计数方法:基本字符IVXLCDM相应...
阅读全文
摘要:题目描述:Container With Most WaterGivennnon-negative integersa1,a2, ...,an, where each represents a point at coordinate (i,ai).nvertical lines are drawn s...
阅读全文
摘要:题目描述:Regular Expression MatchingImplement regular expression matching with support for'.'and'*''.' Matches any single character.'*' Matches zero or mo...
阅读全文
摘要:题目描述:Palindrome NumberDetermine whether an integer is a palindrome. Do this without extra space.Some hints:Could negative integers be palindromes? (ie...
阅读全文
摘要:题目描述:String to Integer (atoi)Implementatoito convert a string to an integer.Hint:Carefully consider all possible input cases. If you want a challenge,...
阅读全文
摘要:题目描述:Reverse IntegerReverse digits of an integer.Example1:x = 123, return 321Example2:x = -123, return -321Have you thought about this?Here are some g...
阅读全文
摘要:题目描述:ZigZag ConversionThe string"PAYPALISHIRING"is written in a zigzag pattern on a given number of rows like this: (you may want to display this patt...
阅读全文
摘要:题目描述:Longest Palindromic SubstringGiven a stringS, find the longest palindromic substring inS. You may assume that the maximum length ofSis 1000, and ...
阅读全文
摘要:题目描述:Median of Two Sorted ArraysThere are two sorted arrays A and B of size m and n respectively. Find the median of the two sorted arrays. The overal...
阅读全文