随笔分类 -  CareerCup

上一页 1 2 3 4 5 6 ··· 8 下一页
摘要:17.7 Given any integer, print an English phrase that describes the integer (e.g., "One Thousand, Two Hundred Thirty Four"). LeetCode上的原题,请参见我之前的博客Inte 阅读全文
posted @ 2016-04-25 09:35 Grandyang 阅读(687) 评论(0) 推荐(0) 编辑
摘要:17.6 Given an array of integers, write a method to find indices m and n such that if you sorted elements m through n, the entire array would be sorted 阅读全文
posted @ 2016-04-23 15:52 Grandyang 阅读(697) 评论(0) 推荐(0) 编辑
摘要:17.5 The Came of Master Mind is played as follows: The computer has four slots, and each slot will contain a ball that is red (R), yellow (Y), green ( 阅读全文
posted @ 2016-04-22 10:28 Grandyang 阅读(943) 评论(0) 推荐(0) 编辑
摘要:17.4 Write a method which finds the maximum of two numbers. You should not use if-else or any other comparison operator. 这道题让我们找出两个数中的较大值,不能用if..else. 阅读全文
posted @ 2016-04-21 10:33 Grandyang 阅读(487) 评论(0) 推荐(0) 编辑
摘要:LeetCode上的原题,讲解请参见我之前的博客Factorial Trailing Zeroes。 解法一: 解法二: CareerCup All in One 题目汇总 阅读全文
posted @ 2016-04-20 10:22 Grandyang 阅读(613) 评论(0) 推荐(0) 编辑
摘要:17.2 Design an algorithm to figure out if someone has won a game oftic-tac-toe. 这道题让我们判断玩家是否能赢井字棋游戏,有下面几点需要考虑: 1. 判断是否能赢hasWon函数是调用一次还是多次,如果是多次,我们可能为了 阅读全文
posted @ 2016-04-19 11:07 Grandyang 阅读(2650) 评论(0) 推荐(0) 编辑
摘要:17.1 Write a function to swap a number in place (that is, without temporary variables). 这道题让我们交换两个数,但是不能用额外空间,那么我们可以先做差值,存入a中,然后再加上b,存入b中,那么此时的b即为原来的a 阅读全文
posted @ 2016-04-18 00:39 Grandyang 阅读(810) 评论(0) 推荐(0) 编辑
摘要:16.6 You are given a class with synchronized method A and a normal method B. If you have two threads in one instance of a program, can they both execu 阅读全文
posted @ 2016-04-17 12:17 Grandyang 阅读(499) 评论(0) 推荐(0) 编辑
摘要:16.5 Suppose we have the following code:public class Foo { public Foo() { . . . } public void first() { ... } public void second() { ... } public void 阅读全文
posted @ 2016-04-17 11:41 Grandyang 阅读(615) 评论(0) 推荐(0) 编辑
摘要:16.4 Design a class which provides a lock only if there are no possible deadlocks. 有很多方法可以避免死锁的发生,一个常用的方法是列出所需要的锁,然后判断锁上这些锁后会不会发生死锁,比如有如下的锁的顺序: A = {1 阅读全文
posted @ 2016-04-16 23:45 Grandyang 阅读(871) 评论(0) 推荐(0) 编辑
摘要:16.3 In the famous dining philosophers problem, a bunch of philosophers are sitting around a circular table with one chopstick between each of them. A 阅读全文
posted @ 2016-04-15 11:08 Grandyang 阅读(3895) 评论(0) 推荐(0) 编辑
摘要:16.2 How would you measure the time spent in a context switch? 上下文转换发生在两个进程之间,比如让一个等待进程进入执行和让一个运行进程进入等待,这些在多任务中发生。操作系统需要把等待进程的信息放入内存和把当前运行的进程信息保存下来。为了 阅读全文
posted @ 2016-04-14 09:41 Grandyang 阅读(727) 评论(0) 推荐(0) 编辑
摘要:16.1 What's the difference between a thread and a process? 进程Process是程序执行时的一个实例。一个进程是被分配系统资源的独立单元,每个进程在独立的地址空间上执行,如果需要使用其他进程的资源,需要使用进程间通讯,包括管道Pipes,文件 阅读全文
posted @ 2016-04-13 05:27 Grandyang 阅读(655) 评论(0) 推荐(0) 编辑
摘要:15.7 Imagine a simple database storing information for students' grades. Design what this database might look like and provide a SQL query to return a 阅读全文
posted @ 2016-04-12 03:15 Grandyang 阅读(878) 评论(0) 推荐(0) 编辑
摘要:15.6 Draw an entity-relationship diagram for a database with companies, people, and professionals (people who work for companies). 在公司Companies工作的人是专家 阅读全文
posted @ 2016-04-07 07:16 Grandyang 阅读(852) 评论(0) 推荐(0) 编辑
摘要:15.5 What is denormalization? Explain the pros and cons. 逆规范化Denormalization是一种通过添加冗余数据的数据库优化技术,可以帮助我们减少关系数据库中耗时的交Join。在一般的规范化的数据库中,我们将数据存在不同的表中是为了减少冗 阅读全文
posted @ 2016-04-07 06:57 Grandyang 阅读(1172) 评论(0) 推荐(0) 编辑
摘要:15.4 What are the different types of joins? Please explain how they differ and why certain types are better in certain situations. Join是用来联合两个表的,每个表至少 阅读全文
posted @ 2016-04-05 12:13 Grandyang 阅读(717) 评论(0) 推荐(0) 编辑
摘要:Building #11 is undergoing a major renovation. Implement a query to close all requests from apartments in this building. -- TABLE Apartments -- TABLE 阅读全文
posted @ 2016-04-04 09:18 Grandyang 阅读(505) 评论(0) 推荐(0) 编辑
摘要:Write a SQL query to get a list of all buildings and the number of open requests (Requests in which status equals 'Open'). -- TABLE Apartments -- TABL 阅读全文
posted @ 2016-04-04 08:44 Grandyang 阅读(392) 评论(0) 推荐(0) 编辑
摘要:Write a SQL query to get a list of tenants who are renting more than one apartment. -- TABLE Apartments -- TABLE Buildings -- TABLE Tenants -- TABLE C 阅读全文
posted @ 2016-04-03 08:32 Grandyang 阅读(590) 评论(0) 推荐(0) 编辑

上一页 1 2 3 4 5 6 ··· 8 下一页
Fork me on GitHub