随笔分类 -  CareerCup

摘要:9.8 Given an infinite number of quarters (25 cents), dimes (10 cents), nickels (5 cents) and pennies (1 cent), write code to calculate the number of w... 阅读全文
posted @ 2015-09-26 14:08 Grandyang 阅读(4817) 评论(0) 推荐(0) 编辑
摘要:9.7 Implement the "paint fill" function that one might see on many image editing programs. That is, given a screen (represented by a two-dimensional a... 阅读全文
posted @ 2015-09-23 11:34 Grandyang 阅读(1251) 评论(0) 推荐(0) 编辑
摘要:9.6 Implement an algorithm to print all valid (e.g., properly opened and closed) combinations of n-pairs of parentheses.EXAMPLEInput: 3Output: ((())),... 阅读全文
posted @ 2015-09-22 12:47 Grandyang 阅读(773) 评论(0) 推荐(0) 编辑
摘要:9.5 Write a method to compute all permutations of a string.LeetCode上的原题,请参加我之前的博客Permutations 全排列和Permutations II 全排列之二。解法一:class Solution {public: ... 阅读全文
posted @ 2015-09-20 09:12 Grandyang 阅读(631) 评论(0) 推荐(0) 编辑
摘要:9.4 Write a method to return all subsets of a set.LeetCode上的原题,请参见我之前的博客Subsets 子集合和Subsets II 子集合之二。解法一:class Solution {public: vector > getSubset... 阅读全文
posted @ 2015-09-19 04:05 Grandyang 阅读(619) 评论(0) 推荐(0) 编辑
摘要:9.3 A magic index in an array A[0.. .n-1] is defined to be an index such that A[i] = i. Given a sorted array of distinct integers, write a method to f... 阅读全文
posted @ 2015-09-18 10:58 Grandyang 阅读(1042) 评论(0) 推荐(0) 编辑
摘要:9.2 Imagine a robot sitting on the upper left corner of an X by Y grid. The robot can only move in two directions: right and down. How many possible p... 阅读全文
posted @ 2015-09-17 23:22 Grandyang 阅读(979) 评论(0) 推荐(0) 编辑
摘要:9.1 A child is running up a staircase with n steps, and can hop either 1 step, 2 steps, or 3 steps at a time. Implement a method to count how many pos... 阅读全文
posted @ 2015-09-17 03:08 Grandyang 阅读(1057) 评论(0) 推荐(0) 编辑
摘要:8.10 Design and implement a hash table which uses chaining (linked lists) to handle collisions.这道题让我们实现一个简单的哈希表,我们采用了最简单的那种取余映射的方式来实现,我们使用Cell来保存一对对的k... 阅读全文
posted @ 2015-09-16 03:12 Grandyang 阅读(1161) 评论(0) 推荐(0) 编辑
摘要:8.9 Explain the data structures and algorithms that you would use to design an in-memory file system. Illustrate with an example in code where possibl... 阅读全文
posted @ 2015-09-14 12:09 Grandyang 阅读(1086) 评论(0) 推荐(0) 编辑
摘要:8.8 Othello is played as follows: Each Othello piece is white on one side and black on the other. When a piece is surrounded by its opponents on both ... 阅读全文
posted @ 2015-09-13 13:18 Grandyang 阅读(1255) 评论(0) 推荐(0) 编辑
摘要:8.7 Explain how you would design a chat server. In particular, provide details about the various backend components, classes, and methods. What would ... 阅读全文
posted @ 2015-09-12 05:31 Grandyang 阅读(929) 评论(0) 推荐(0) 编辑
摘要:8.6 Implement a jigsaw puzzle. Design the data structures and explain an algorithm to solve the puzzle. You can assume that you have a f itsWith metho... 阅读全文
posted @ 2015-09-09 12:02 Grandyang 阅读(2221) 评论(1) 推荐(0) 编辑
摘要:8.5 Design the data structures for an online book reader system.这道题OOB的题让我们设计一个在线读书系统,还是没有任何提示,所以发挥空间很大。根据书上的解答,我们设计一个具有基本功能的系统:1. 用户会员的建立和延长2. 搜索书库中的... 阅读全文
posted @ 2015-09-08 10:24 Grandyang 阅读(928) 评论(0) 推荐(0) 编辑
摘要:8.4 Design a parking lot using object-oriented principles. LintCode上的原题,请参见我的另一篇博客Parking Lot 停车场问题。 这道题让我们实现一个停车位的数据结构,由于题目没给任何多余的信息,所以自由度很大,比如能停放什么种 阅读全文
posted @ 2015-09-07 11:28 Grandyang 阅读(5553) 评论(0) 推荐(0) 编辑
摘要:8.3 Design a musical jukebox using object-oriented principles.CareerCup这书实在是太不负责任了,就写了个半调子的程序,说是完整版也可以下载到,但是我怎么找不到,谁知道在哪里下载请告诉博主,多谢啦~class Song;class ... 阅读全文
posted @ 2015-09-07 07:06 Grandyang 阅读(972) 评论(0) 推荐(0) 编辑
摘要:8.2 Imagine you have a call center with three levels of employees: respondent, manager, and director. An incoming telephone call must be first allocat... 阅读全文
posted @ 2015-09-06 13:15 Grandyang 阅读(829) 评论(0) 推荐(0) 编辑
摘要:8.1 Design the data structures for a generic deck of cards. Explain how you would subclass the data structures to implement blackjack.这道题让我们设计一个21点纸牌游... 阅读全文
posted @ 2015-09-04 09:07 Grandyang 阅读(2453) 评论(0) 推荐(0) 编辑
摘要:7.7 Design an algorithm to find the kth number such that the only prime factors are 3,5, and 7.这道题跟之前LeetCode的那道Ugly Number II 丑陋数之二基本没有啥区别,具体讲解可参见那篇,... 阅读全文
posted @ 2015-09-03 22:18 Grandyang 阅读(729) 评论(0) 推荐(0) 编辑
摘要:7.6 Given a two-dimensional graph with points on it, find a line which passes the most number of points.这道题给了我们许多点,让我们求经过最多点的一条直线。给之前那道7.5 A Line Cut ... 阅读全文
posted @ 2015-09-02 23:54 Grandyang 阅读(954) 评论(0) 推荐(0) 编辑

Fork me on GitHub