随笔分类 - CareerCup
摘要: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...
阅读全文
摘要: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,所...
阅读全文
摘要: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...
阅读全文
摘要: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...
阅读全文
摘要: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...
阅读全文
摘要: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...
阅读全文
摘要:11.4 Imagine you have a 20 GB file with one string per line. Explain how you would sort the file.这道题说给了我们一个20GB大小的文件,每行有一个字符串,让我们给文件内容排序。那么既然强调了这么大的一个...
阅读全文
摘要: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...
阅读全文
摘要:11.2 Write a method to sort an array of strings so that all the anagrams are next to each other.这道题让我们给一个字符串数组排序,让所有的变位词Anagrams排在一起,关于变位词,LeetCode里有两...
阅读全文
摘要: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...
阅读全文
摘要: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...
阅读全文
摘要: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.这道题让...
阅读全文
摘要:10.5 If you were designing a web crawler, how would you avoid getting into infinite loops?这道题问如果让我们设计一个网络爬虫,怎么样才能避免进入无限循环。那么何谓无限循环呢,如果我们将网络看做一个图Graph,...
阅读全文
摘要: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...
阅读全文
摘要: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...
阅读全文
摘要: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...
阅读全文
摘要: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...
阅读全文
摘要: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...
阅读全文
摘要:9.10 You have a stack of n boxes, with widths w., heights hir and depths drThe boxes cannot be rotated and can only be stacked on top of one another i...
阅读全文
摘要:9.9 Write an algorithm to print all ways of arranging eight queens on an 8x8 chess board so that none of them share the same row, column or diagonal. ...
阅读全文