码迷,mamicode.com
首页 >  
搜索关键字:算法面试    ( 461个结果
LeetCode: Remove Element [026]
【题目】 Given an array and a value, remove all instances of that value in place and return the new length. The order of elements can be changed. It doesn't matter what you leave beyond the new length. 【题意】 删除数组中指定的值。不关心在新数组的后面即数组尾部留下了什么值。 【思路】 思路同Remo...
分类:其他好文   时间:2014-05-18 14:53:56    阅读次数:208
LeetCode: Divide Two Integers [028]
【题目】 Divide two integers without using multiplication, division and mod operator. 【题意】 计算两个数的商,不能使用乘、除、取余操作 【思路】 用加法,确定多少除数相加其和恰好<=被除数 为了提高算法效率,利用贪心思想,采用滚雪球式的翻倍叠加策略,使和快速逼近被除数 集中特殊情况需要注意: 1. 结果是负数 ...
分类:其他好文   时间:2014-05-18 10:42:00    阅读次数:259
LeetCode: Next Permutation [030]
【题目】 Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers. If such arrangement is not possible, it must rearrange it as the lowest possible order (ie, sorted in ascending order). The replac...
分类:其他好文   时间:2014-05-18 09:54:53    阅读次数:242
LeetCode: Substring with Concatenation of All Words [029]
【题目】 You are given a string, S, and a list of words, L, that are all of the same length. Find all starting indices of substring(s) in S that is a concatenation of each word in L exactly once and without any intervening characters. For example, given: S:...
分类:其他好文   时间:2014-05-18 08:31:48    阅读次数:228
LeetCode: Implement strStr() [027]
【题目】 Implement strStr(). Returns a pointer to the first occurrence of needle in haystack, or null if needle is not part of haystack. 【题意】 实现库函数strStr(), 功能是在字符串haystack中找出目标串needle第一次出现的索引位 【思路】 字符串的匹配,可以用暴力解法,但不推荐。一般使用KMP算法求解。 简要介绍一下KMP的思想: ...
分类:其他好文   时间:2014-05-18 04:10:04    阅读次数:244
LeetCode 012 Integer to Roman
【题目】 Given an integer, convert it to a roman numeral. Input is guaranteed to be within the range from 1 to 3999. 【题意】 给定一个整数,将其表示成罗马数字 【思路】 罗马数字中只使用如下七个基值字母:M,D,C,L,X,V,I,分别用来表示1000、500、100、50、10、5、1。 罗马数组数规则: 基本数字Ⅰ、X 、C 中的任何一个,自身连用构成数目,或者放在大数的右边连用...
分类:其他好文   时间:2014-05-16 01:46:55    阅读次数:312
LeetCode 011 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). Find two lines, which together with x-axis forms a contain...
分类:其他好文   时间:2014-05-16 01:32:47    阅读次数:406
C/C++ 数据结构之算法(面试)
数据结构中的排序算法。排序算法的相关知识:(1)排序的概念:所谓排序就是要整理文件中的记录,使之按关键字递增(或递减)次序排列起来。(2)稳定的排序方法:在待排序的文件中,若存在多个关键字相同的记录,经过排序后这些具有相同关键字的记录之间的相对次序保持不变,该排序方法是稳定的。相反,如果发生改变,这...
分类:编程语言   时间:2014-05-14 23:06:00    阅读次数:725
LeetCode 008 String to Integer (atoi)
【题目】 Implement atoi to convert a string to an integer. Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below and ask yourself what are the possible input cases. Notes: It is intended for this problem to be s...
分类:其他好文   时间:2014-05-14 21:00:57    阅读次数:304
LeetCode 009 Palindrome Number
【题目】 Determine whether an integer is a palindrome. Do this without extra space. 【题意】 题意判断一个整数是否是回文数 注意一下几点: 1. 不能用额外的空间 2. 负数不是回文数...
分类:其他好文   时间:2014-05-14 20:31:10    阅读次数:298
461条   上一页 1 ... 43 44 45 46 47 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!