题目
Assume you have a method isSubstring which checks if one word is a substring of another. Given two strings, s1 and s2, write code to check if s2 is a rotation of s1 using only one call to isSubstr...
分类:
编程语言 时间:
2016-08-06 00:39:10
阅读次数:
279
题目
Write an algorithm such that if an element in an MxN matrix is 0, its entire row and column is set to 0.
写一个函数处理一个MxN的矩阵,如果矩阵中某个元素为0,那么把它所在的行和列都置为0.
解答
简单题。遍历一次矩阵,当遇到元素等于0时,记录下这个元素对应的行和列。
可...
分类:
编程语言 时间:
2016-08-01 00:29:43
阅读次数:
225
题目
Given an image represented by an NxN matrix, where each pixel in the image is 4 bytes, write a method to rotate the image by 90 degrees. Can you do this in place?
一张图像表示成NxN的矩阵,图像中每个像素是4个字节,写一个函数...
分类:
编程语言 时间:
2016-07-31 06:58:37
阅读次数:
283
题目Design an algorithm and write code to remove the duplicate characters in a string without using any additional buffer. NOTE: One or two additional variables are fine. An extra copy of the array is no...
分类:
编程语言 时间:
2016-07-22 19:14:20
阅读次数:
210
题目:
Implement an algorithm to determine if a string has all unique characters. What if you can not use additional data structures?
实现一个算法来判断一个字符串中的字符是否唯一(即没有重复).不能使用额外的数据结构。 (即只使用基本的数据结构)
解答:
首先,你...
分类:
编程语言 时间:
2016-07-19 15:37:10
阅读次数:
200
这是我的第三个面试题汇总。想看之前的内容,请移步:http://zhweizhi.blog.51cto.com/10800691/1763237(若干数据结构&&算法面试题【一】(更新完毕))http://zhweizhi.blog.51cto.com/10800691/1775780(若干数据结构&&算法面试题【二】(更新完毕))http:..
分类:
编程语言 时间:
2016-07-09 07:08:51
阅读次数:
139
在上一篇博客中有原有提到分享一下面试题,最近也是才能新公司入职没多久,忙着熟悉环境,加上前不久出去玩了一趟(顺便写了篇游记,感兴趣的可以看一看)。所以一直没时间整理博客,这段时间周末终于闲下来,就趁着周末就记录了几个面试过程中碰到的算法题。本篇博客不打算介绍那些高逼格的算法(如winnow,bagg... ...
分类:
编程语言 时间:
2016-07-06 20:01:48
阅读次数:
311
这是我的第三个面试题汇总。想看之前的内容,请移步:http://zhweizhi.blog.51cto.com/10800691/1763237(若干数据结构&&算法面试题【一】(更新完毕))http://zhweizhi.blog.51cto.com/10800691/1775780(若干数据结构&&算法面试题【二】(更新完毕))另外..
分类:
编程语言 时间:
2016-06-09 00:54:46
阅读次数:
139
一.算法的基本概念计算机解题的过程实际上是在实施某种算法,这种算法称为计算机算法。1.算法的基本特征:可行性,确定性,有穷性,拥有足够的情报。2.算法的基本要素:算法中对数据的运算和操作、算法的控制结构。3.算法设计的基本方法:列举法、归纳法、递推、递归、减半递推技术、回溯法。4.算法设计的要求:正 ...
分类:
编程语言 时间:
2016-05-25 11:13:37
阅读次数:
186