码迷,mamicode.com
首页 >  
搜索关键字:经典面试题    ( 298个结果
[LeetCode]142.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?分析:首先使用快慢指针技巧,如果fast指针和slow指针相遇,则说明链表存在环路。当f...
分类:其他好文   时间:2015-02-05 20:29:16    阅读次数:180
[LeetCode]54.Spiral Matrix
【题目】 Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order. For example, Given the following matrix: [ [ 1, 2, 3 ], [ 4, 5, 6 ], [ 7, 8, ...
分类:其他好文   时间:2015-02-05 11:18:02    阅读次数:172
[LeetCode]59.Spiral Matrix II
【题目】 Given an integer n, generate a square matrix filled with elements from 1 to n2 in spiral order. For example, Given n = 3, You should return the following matrix: [ [ 1, 2, 3 ], [ 8,...
分类:其他好文   时间:2015-02-04 23:29:21    阅读次数:236
[算法系列之十]大数据量处理利器:布隆过滤器
【引言】 在日常生活中,包括在设计计算机软件时,我们经常要判断一个元素是否在一个集合中。比如在字处理软件中,需要检查一个英语单词是否拼写正确(也就是要判断 它是否在已知的字典中);在 FBI,一个嫌疑人的名字是否已经在嫌疑名单上;在网络爬虫里,一个网址是否被访问过等等。最直接的方法就是将集合中全部的元素存在计算机中,遇到一个新 元素时,将它和集合中的元素直接比较即可。一般来讲,计算机中的集合是用...
分类:编程语言   时间:2015-02-04 12:56:17    阅读次数:214
[LeetCode]62.Unique Paths
【题目】 A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below). The robot can only move either down or right at any point in time. The robot is trying to...
分类:其他好文   时间:2015-02-03 23:00:26    阅读次数:249
[LeetCode]120.Triangle
【题目】 Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below. For example, given the following triangle [ [2], [...
分类:其他好文   时间:2015-02-03 11:07:52    阅读次数:148
[LeetCode]75.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...
分类:其他好文   时间:2015-02-03 09:29:30    阅读次数:118
[经典面试题][网易]数组分割
【题目】 任意2N个正整数,从其中选出N个整数,使得选出的N个整数和同剩下的N个整数之和的差最小。 【来源】 网易 【分析】 假设数组A[1..2N]所有元素的和是SUM。模仿动态规划解0-1背包问题的策略。 从2N个数中找N个元素,有三种可能:大于Sum/2,小于Sum/2以及等于Sum/2。而大于Sum/2与小于等于Sum/2没区别,故可以只考虑小于等于Sum/2的情况。 令S(...
分类:编程语言   时间:2015-02-01 13:34:17    阅读次数:304
[百度]在由N个正整数的集合S中,找出最大元素C,满足C=A + B
【题目】 在由N个正整数的集合S中,找出最大元素C,满足C=A + B 其中A,B都是集合S中元素,请给出算法描述,代码与时间复杂度分析。 【分析】 1,对集合S进行排序(快排),从小到大排序 2,让C指向集合最后一个元素(最大元素) 3,让i指向S中第一个元素,让j指向C的前一个元素 4,如果,A[i]+A[j]==C则return C; 5,如果if(A[i]+A[j] 6...
分类:其他好文   时间:2015-01-30 15:54:30    阅读次数:162
[经典面试题]排序数组中绝对值最小元素
【题目】 题目为: 有一个已经排序的数组(升序),数组中可能有正数、负数或0,求数组中元素的绝对值最小的数,要求,不能用顺序比较的方法(复杂度需要小于O(n)),可以使用任何语言实现 例如,数组{-20,-13,-4, 6, 77,200} ,绝对值最小的是-4。 【分析】 给定数组是已经排好序的,且是升序,没有重复元素。 一...
分类:编程语言   时间:2015-01-29 21:12:05    阅读次数:214
298条   上一页 1 ... 25 26 27 28 29 30 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!