当年在麦肯锡工作时,为了招才纳贤,我几乎走遍了世界各地的一流商学院。当时的麦肯锡公司每年都能收到约800多份来自哈佛或斯坦福商学院的应聘简历。最终被录取的是约200名,其录取方式也很独特。首先,针对每一名应聘人员,由五名人事专员分不同时间和不同场所进行一对一面试。麦肯锡公司招聘员工时主要看以下三点。...
分类:
其他好文 时间:
2014-05-27 00:47:59
阅读次数:
221
【题目】
给定两个字符串s1和s2,要求判断s2是否能够被通过s1做循环移位(rotate)得到的字符串包含。例如,S1=AABCD和s2=CDAA,返回true;给定s1=ABCD和s2=ACBD,返回false。
【分析】
【思路一】
从题目中可以看出,我们可以使用最直接的方法对S1进行循环移动,再进行字符串包含的判断,从而遍历其所有的可能性。
字符串循环移动,时间复杂度为O(n...
分类:
其他好文 时间:
2014-05-16 02:56:14
阅读次数:
305
【题目】
原文:
1.8 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...
分类:
其他好文 时间:
2014-05-16 01:50:08
阅读次数:
311
【题目】
原文:
1.7 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.
【分析】
【思路一】
遍历一次矩阵...
分类:
其他好文 时间:
2014-05-15 12:27:37
阅读次数:
293
【题目】
A sequence of N positive integers (10 N , each of them less than or equal 10000, and a positive integer S (S <
100 000 000) are given. Write a program to find the minimal length of the subse...
分类:
其他好文 时间:
2014-05-15 07:58:17
阅读次数:
329
【题目】
原文:
1.6 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?
译文:
一张图像表示...
分类:
其他好文 时间:
2014-05-15 05:43:35
阅读次数:
240
原文:
1.5 Write a method to replace all spaces in a string with ‘%20’.
译文:
写一个函数,把字符串中所有的空格替换为%20 。...
分类:
其他好文 时间:
2014-05-14 14:09:29
阅读次数:
310
【题目】
The famous Korean internet company nhn has provided an internet-based photo service which allows The famous Korean internet company users to directly take a photo of an astronomical phenomenon...
分类:
其他好文 时间:
2014-05-13 13:34:50
阅读次数:
453
【题目】
Chapter 1 | Arrays and Strings
原文:
1.1 Implement an algorithm to determine if a string has all unique characters. What if you can not use additional data structures?
译文:
实现一个算法来判断一个字符串中的字符...
分类:
其他好文 时间:
2014-05-07 04:27:41
阅读次数:
312
【题目】
原文:
1.4 Write a method to decide if two strings are anagrams or not.
译文:
写一个函数判断两个字符串是否是变位词。
【分析】
变位词(anagrams)指的是组成两个单词的字符相同,但位置不同的单词。比如说, abbcd和abcdb就是一对变位词。该题目有两种思路:
【思路一】
由于变位词只是字...
分类:
其他好文 时间:
2014-05-06 23:17:56
阅读次数:
383