码迷,mamicode.com
首页 >  
搜索关键字:经典面试题    ( 298个结果
[LeetCode]151.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”.Update (2015-02-12): For C programmers: Try to solve it in-place in O(1) s...
分类:其他好文   时间:2015-05-06 00:01:27    阅读次数:188
[LeetCode]203.Remove Linked List Elements
Remove all elements from a linked list of integers that have value val.Example Given: 1 –> 2 –> 6 –> 3 –> 4 –> 5 –> 6, val = 6 Return: 1 –> 2 –> 3 –> 4 –> 5...
分类:其他好文   时间:2015-05-02 09:37:29    阅读次数:119
[LeetCode]*106.Construct Binary Tree from Inorder and Postorder Traversal
Given inorder and postorder traversal of a tree, construct the binary tree.Note: You may assume that duplicates do not exist in the tree....
分类:其他好文   时间:2015-05-01 20:00:19    阅读次数:188
[LeetCode]*105.Construct Binary Tree from Preorder and Inorder Traversal
Given preorder and inorder traversal of a tree, construct the binary tree.Note: You may assume that duplicates do not exist in the tree....
分类:其他好文   时间:2015-04-28 22:52:42    阅读次数:199
[剑指Offer]40.数组中只出现一次的数字
一个整型数组里除了两个数字之外,其他的数字都出现了两次。请写程序找出这两个只出现一次的数字。思路我们直到异或的性质:任何一个数字异或他自己都等于0. 所以说我们如果从头到尾依次异或每一个数字,那么最终的结果刚好只出现一次的数字,因为成对出现的两次的数字全部在异或中抵消了。这道题中有两个数字只出现一次。这样的话我们得到的结果就是这两个数字的异或结果。因此我们想办法把原数组分成两个子数组,使得每个子...
分类:编程语言   时间:2015-04-26 19:47:36    阅读次数:120
[LeetCode]201.Bitwise AND of Numbers Range
Given a range [m, n] where 0 <= m <= n <= 2147483647, return the bitwise AND of all numbers in this range, inclusive.For example, given the range [5, 7], you should return 4....
分类:其他好文   时间:2015-04-26 16:49:12    阅读次数:120
[LeetCode]32.Longest Valid Parentheses
题目Given a string containing just the characters ‘(’ and ‘)’, find the length of the longest valid (well-formed) parentheses substring.For “(()”, the longest valid parentheses substring is “()”, which h...
分类:其他好文   时间:2015-04-23 21:49:15    阅读次数:156
[LeetCode]202.Happy Number
Write an algorithm to determine if a number is “happy”.A happy number is a number defined by the following process: Starting with any positive integer, replace the number by the sum of the squares of...
分类:移动开发   时间:2015-04-22 22:15:41    阅读次数:1099
[LeetCode]57.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.Example...
分类:其他好文   时间:2015-04-22 18:34:17    阅读次数:125
[LeetCode]191.Number of 1 Bits
题目Write a function that takes an unsigned integer and returns the number of ’1’ bits it has (also known as the Hamming weight).For example, the 32-bit integer ’11’ has binary representation 00000000000...
分类:其他好文   时间:2015-04-12 21:12:01    阅读次数:130
298条   上一页 1 ... 21 22 23 24 25 ... 30 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!