algorithm
文章平均质量分 66
YouCompleteMe
这个作者很懒,什么都没留下…
展开
-
String to Integer(atoi)
字符串转换为整数要考虑很多种可能的输入并妥善处理,跳过前导空格。空串,只有正负号返回0。若字符串中有不是数字的,则返回之前已经转换好的数字部分对应的整数。还要判断转换的整数是否会溢出,若溢出则返回最大或最小的整数。int atoi(string str) { if (str.empty()) { return 0; } int si原创 2015-04-04 16:03:59 · 517 阅读 · 0 评论 -
LRUCache
Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations: get and set.get(key) - Get the value (will always be positive) of the key if原创 2015-04-07 09:42:58 · 510 阅读 · 0 评论