摘要: Implement wildcard pattern matching with support for '?' and '*'.'?' Matches any single character.'*' Matches any sequence of characters (including th... 阅读全文
posted @ 2014-07-09 14:40 Awy 阅读(190) 评论(0) 推荐(0) 编辑
摘要: Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations:getandset.get(key)- Get the valu... 阅读全文
posted @ 2014-07-09 13:36 Awy 阅读(233) 评论(0) 推荐(0) 编辑
摘要: 单例模式(Singleton),保证一个类仅有一个实例,并提供一个访问它的全局访问点。通常我们可以让一个全局变量使得一个对象被访问,但它不能访问你实例化多个对象。一个最好的办法,让类自身负责保存它的唯一的实例。这个类可以保证没有其他实例可以被创建,并且它可以提供一个访问该实例的方法。#include... 阅读全文
posted @ 2014-07-09 11:54 Awy 阅读(129) 评论(0) 推荐(0) 编辑
摘要: 迭代器模式(Iterator),提供一种方法顺序访问一个聚合对象中各个元素,而又不暴露该对象的内部表示。当你需要访问一个聚集对象,而且不管这些对象是什么都需要遍历的时候,或者你需要对聚集有多种方式遍历时,你就应该考虑用迭代器模式,为遍历不同的聚集结构提供如开始、下一个、是否结束、当前哪一项等统一接口... 阅读全文
posted @ 2014-07-09 10:15 Awy 阅读(193) 评论(0) 推荐(0) 编辑