10 2015 档案

摘要:13.6 Why does a destructor in base class need to be declared virtual?这道题问我们为啥基类中的析构函数要定义为虚函数。首先来看下面这段代码:class Foo {public: void f();};class Bar: pu... 阅读全文
posted @ 2015-10-31 06:55 Grandyang 阅读(495) 评论(0) 推荐(0) 编辑
摘要:13.5 What is the significance of the keyword "volatile" in C这道题考察我们对于关键字volatile的理解,顾名思义,volatile有易变的易挥发的意思,在C/C++里,表示告知编译器某个变量可能会由程序外部改变,比如操作系统,硬件或者其... 阅读全文
posted @ 2015-10-31 04:13 Grandyang 阅读(517) 评论(0) 推荐(0) 编辑
摘要:13.4 What is the difference between deep copy and shallow copy? Explain how you would use each.这道题问深拷贝和浅拷贝的区别。浅拷贝复制对象中所有的成员值到另一个对象中,而深拷贝不仅复制这些,还复制所有的指... 阅读全文
posted @ 2015-10-31 03:19 Grandyang 阅读(496) 评论(0) 推荐(0) 编辑
摘要:13.3 How do virtual functions work in C++?这道题问我们虚函数在C++中的工作原理。虚函数的工作机制主要依赖于虚表格vtable,即Virtual Table。当类中定义了虚函数时,一个虚表格就建立了用来保存该类的虚函数的地址。此时编译器Compiler也会在... 阅读全文
posted @ 2015-10-30 06:58 Grandyang 阅读(624) 评论(0) 推荐(0) 编辑
摘要:13.2 Compare and contrast a hash table and an STL map. How is a hash table implemented? If the number of inputs is small, which data structure options... 阅读全文
posted @ 2015-10-30 05:20 Grandyang 阅读(603) 评论(0) 推荐(0) 编辑
摘要:13.1 Write a method to print the last K lines of an input file using C++.这道题让我们用C++来打印一个输入文本的最后K行,最直接的方法是先读入所有的数据,统计文本的总行数,然后再遍历一遍打印出最后K行。这个方法需要读两遍文件,... 阅读全文
posted @ 2015-10-29 12:10 Grandyang 阅读(717) 评论(0) 推荐(0) 编辑
摘要:12.6 How would you test an ATM in a distributed banking system?这道题问我们如何来测试一个自动取款机,我们首先要询问下列问题:- 谁来使用这些ATM?回答可能是任何人,或者是盲人,或者是其他什么答案。- 这些ATM用来干什么?回答可能是取... 阅读全文
posted @ 2015-10-28 11:57 Grandyang 阅读(773) 评论(0) 推荐(0) 编辑
摘要:Serialization is the process of converting a data structure or object into a sequence of bits so that it can be stored in a file or memory buffer, or 阅读全文
posted @ 2015-10-27 13:04 Grandyang 阅读(29719) 评论(4) 推荐(3) 编辑
摘要:12.5 How would you testa pen?这道题让我们测试一支笔,我们需要问面试官许多问题来理解"who,what,where,when,how and why",比如我们可以这样:面试官:你怎样测试一支笔?候选人:谁将要使用这笔?面试官:儿童候选人:有意思,那么他们用来干什么呢,是... 阅读全文
posted @ 2015-10-27 10:07 Grandyang 阅读(790) 评论(0) 推荐(0) 编辑
摘要:12.4 How would you load test a webpage without using any test tools?这道题问我们如何不用任何测试工具来加载测试一个网页。加载测试可以用来验证一个网站应用的最大操作容量和跟性能有关的瓶颈。同样,也可以测试应用在加载对不同情况的响应。对... 阅读全文
posted @ 2015-10-26 09:19 Grandyang 阅读(546) 评论(0) 推荐(0) 编辑
摘要:别跟我说你会PPT,144项大神级ppt制作技术ppt範本背景下載好康區 阅读全文
posted @ 2015-10-26 04:51 Grandyang 阅读(323) 评论(0) 推荐(0) 编辑
摘要:12.3 We have the following method used in a chess game: boolean canMoveTo( int x, int y). This method is part of the Piece class and returns whether o 阅读全文
posted @ 2015-10-25 09:44 Grandyang 阅读(602) 评论(0) 推荐(0) 编辑
摘要:12.2 You are given the source to an application which crashes when it is run. After running it ten times in a debugger, you find it never crashes in t... 阅读全文
posted @ 2015-10-24 11:59 Grandyang 阅读(842) 评论(0) 推荐(0) 编辑
摘要:12.1 Find the mistake(s) in the following code:unsigned int i;for (i = 190; i >= 0; --i)printf("%d\n", i);这道题让我们找出给定的简短的程序的错误,这里共有两处错误:1. 无符号整型永远大于0,所... 阅读全文
posted @ 2015-10-23 07:22 Grandyang 阅读(517) 评论(0) 推荐(0) 编辑
摘要:11.8 Imagine you are reading in a stream of integers. Periodically, you wish to be able to look up the rank of a number x (the number of values less t... 阅读全文
posted @ 2015-10-22 11:01 Grandyang 阅读(887) 评论(0) 推荐(0) 编辑
摘要:Median is the middle value in an ordered integer list. If the size of the list is even, there is no middle value. So the median is the mean of the two... 阅读全文
posted @ 2015-10-21 07:25 Grandyang 阅读(20564) 评论(6) 推荐(2) 编辑
摘要:在C++中,我们有时想生成一个由随机数组成的数组,而且随机数的范围也可由我们来设定。那么我们就要用到srand()函数配合rand()来使用,参见如下代码:#include #include #include #include #include using namespace std;int m... 阅读全文
posted @ 2015-10-20 10:14 Grandyang 阅读(1897) 评论(0) 推荐(0) 编辑
摘要:http://umm.edu/programs/neurosciences/treatment-programs/image-guided-surgery 阅读全文
posted @ 2015-10-20 04:12 Grandyang 阅读(343) 评论(0) 推荐(0) 编辑
摘要:11.7 A circus is designing a tower routine consisting of people standing atop one another's shoulders. For practical and aesthetic reasons, each perso... 阅读全文
posted @ 2015-10-19 12:06 Grandyang 阅读(1071) 评论(0) 推荐(0) 编辑
摘要:Given a sequence of integers, find the longest increasing subsequence (LIS).You code should return the length of the LIS.Have you met this question in... 阅读全文
posted @ 2015-10-19 12:04 Grandyang 阅读(5756) 评论(0) 推荐(2) 编辑
摘要:11.6 Given an M x N matrix in which each row and each column is sorted in ascending order, write a method to find an element.LeetCode上的原题,请参见我之前的博客Sea... 阅读全文
posted @ 2015-10-18 10:03 Grandyang 阅读(553) 评论(0) 推荐(0) 编辑
摘要:11.5 Given a sorted array of strings which is interspersed with empty strings, write a method to find the location of a given string.EXAMPLEInput: fin... 阅读全文
posted @ 2015-10-17 11:25 Grandyang 阅读(669) 评论(0) 推荐(0) 编辑
摘要:11.4 Imagine you have a 20 GB file with one string per line. Explain how you would sort the file.这道题说给了我们一个20GB大小的文件,每行有一个字符串,让我们给文件内容排序。那么既然强调了这么大的一个... 阅读全文
posted @ 2015-10-16 10:46 Grandyang 阅读(499) 评论(0) 推荐(0) 编辑
摘要:11.3 Given a sorted array of n integers that has been rotated an unknown number of times, write code to find an element in the array. You may assume t... 阅读全文
posted @ 2015-10-16 10:37 Grandyang 阅读(690) 评论(0) 推荐(0) 编辑
摘要:Download VTK 6.3.0Download Qt 5.4 with MinGW 4.9.1Download CMake 3.2.0I assume you've already installed Qt 5.4 with MinGW 4.9.1 and CMake 3.2.0 correc... 阅读全文
posted @ 2015-10-16 07:27 Grandyang 阅读(1988) 评论(0) 推荐(0) 编辑
摘要:11.2 Write a method to sort an array of strings so that all the anagrams are next to each other.这道题让我们给一个字符串数组排序,让所有的变位词Anagrams排在一起,关于变位词,LeetCode里有两... 阅读全文
posted @ 2015-10-15 12:13 Grandyang 阅读(757) 评论(0) 推荐(0) 编辑
摘要:11.1 You are given two sorted arrays, A and B, where A has a large enough buffer at the end to hold B. Write a method to merge B into A in sorted orde... 阅读全文
posted @ 2015-10-14 23:22 Grandyang 阅读(827) 评论(0) 推荐(0) 编辑
摘要:Matlab中,我们有时候要删除矩阵中的某行某列,可以采用下列方法进行删除:a = [1 2 34 5 67 8 9];a(2,:) = []; % Delete row 2a(:,2) = []; % Delete col 2 阅读全文
posted @ 2015-10-14 04:33 Grandyang 阅读(2392) 评论(0) 推荐(0) 编辑
摘要:10.7 Imagine a web server for a simplified search engine. This system has 100 machines to respond to search queries, which may then call out using pro... 阅读全文
posted @ 2015-10-13 12:28 Grandyang 阅读(828) 评论(0) 推荐(0) 编辑
摘要:You are playing the following Nim Game with your friend: There is a heap of stones on the table, each time one of you take turns to remove 1 to 3 ston 阅读全文
posted @ 2015-10-12 23:22 Grandyang 阅读(11919) 评论(0) 推荐(0) 编辑
摘要:使用C++的unordered_map类型时,我们经常要根据关键字查找,并移除一组映射,在Java中直接用remove即可,而STL中居然没有实现remove这个函数,还要自己写循环来查找要删除项,然后用erase来清除,我也是醉了,参见下面代码:vector v1;// remove A *a1f... 阅读全文
posted @ 2015-10-12 12:40 Grandyang 阅读(6065) 评论(0) 推荐(0) 编辑
摘要:Implement a trie with insert, search, and startsWith methods.Have you met this question in a real interview?ExampleNoteYou may assume that all inputs ... 阅读全文
posted @ 2015-10-11 10:45 Grandyang 阅读(1604) 评论(0) 推荐(0) 编辑
摘要:10.6 You have 10 billion URLs. How do you detect the duplicate documents? In this case, assume that "duplicate" means that the URLs are identical.这道题让... 阅读全文
posted @ 2015-10-10 06:30 Grandyang 阅读(867) 评论(0) 推荐(0) 编辑
摘要:1. Accelerated 35. Empowered 69. Motivated 2. Accomplished 36. Enabled 70. Negotiated 3. Achieved 37. Encouraged 71. Obtained 4. Acted 38. Engineered 阅读全文
posted @ 2015-10-09 04:13 Grandyang 阅读(1548) 评论(0) 推荐(0) 编辑
摘要:10.5 If you were designing a web crawler, how would you avoid getting into infinite loops?这道题问如果让我们设计一个网络爬虫,怎么样才能避免进入无限循环。那么何谓无限循环呢,如果我们将网络看做一个图Graph,... 阅读全文
posted @ 2015-10-08 22:51 Grandyang 阅读(1348) 评论(0) 推荐(0) 编辑
摘要:10.4 You have an array with all the numbers from 1 to N, where N is at most 32,000. The array may have duplicate entries and you do not know what N is... 阅读全文
posted @ 2015-10-08 11:23 Grandyang 阅读(739) 评论(0) 推荐(0) 编辑
摘要:在C++中,我们有时候需要拆分字符串,比如字符串string str = "dog cat cat dog"想以空格区分拆成四个单词,Java中实在太方便了,直接String[] v = str.split(" ");就搞定了,而c++中没有这么方便的实现,但也有很多的方法能实现这个功能,下面列出五... 阅读全文
posted @ 2015-10-07 13:04 Grandyang 阅读(9249) 评论(0) 推荐(0) 编辑
摘要:Given a pattern and a string str, find if str follows the same pattern. Here follow means a full match, such that there is a bijection between a lette 阅读全文
posted @ 2015-10-06 13:21 Grandyang 阅读(15646) 评论(10) 推荐(0) 编辑
摘要:10.3 Given an input file with four billion non-negative integers, provide an algorithm to generate an integer which is not contained in the file. Assu... 阅读全文
posted @ 2015-10-05 13:34 Grandyang 阅读(735) 评论(0) 推荐(0) 编辑
摘要:According to the Wikipedia's article: "The Game of Life, also known simply as Life, is a cellular automaton devised by the British mathematician John 阅读全文
posted @ 2015-10-04 13:20 Grandyang 阅读(31142) 评论(8) 推荐(6) 编辑
摘要:10.2 How would you design the data structures for a very large social network like Facebook or Linkedln? Describe how you would design an algorithm to... 阅读全文
posted @ 2015-10-03 12:27 Grandyang 阅读(847) 评论(0) 推荐(0) 编辑
摘要:10.1 Imagine you are building some sort of service that will be called by up to 1000 client applications to get simple end-of-day stock price informat... 阅读全文
posted @ 2015-10-02 06:37 Grandyang 阅读(600) 评论(0) 推荐(0) 编辑
摘要:9.11 Given a boolean expression consisting of the symbols 0,1, &, |, and ^, and a desired boolean result value result, implement a function to count t... 阅读全文
posted @ 2015-10-01 14:11 Grandyang 阅读(676) 评论(0) 推荐(0) 编辑

Fork me on GitHub