摘要:
Design a stack that supports push, pop, top, and retrieving the minimum element in constant time.push(x) -- Push element x onto stack.pop() -- Removes... 阅读全文
摘要:
Given a list, rotate the list to the right bykplaces, wherekis non-negative.For example:Given1->2->3->4->5->NULLandk=2,return4->5->1->2->3->NULL.将链表从右... 阅读全文
摘要:
There areNgas stations along a circular route, where the amount of gas at stationiisgas[i].You have a car with an unlimited gas tank and it costscost[... 阅读全文
摘要:
Given a linked list, reverse the nodes of a linked listkat a time and return its modified list.If the number of nodes is not a multiple ofkthen left-o... 阅读全文
摘要:
单例模式十分的常见也很常用,Boost库中就有单例的泛型实现,Qt中,可以利用原子指针来实现一个单例模式: 1 class SingleTon{ 2 public: 3 static SingleTon &getInstance(void) 4 { 5 //双重检测加... 阅读全文
摘要:
Mergeksorted linked lists and return it as one sorted list. Analyze and describe its complexity.类似于归并2个链表,暴力一点的方法就是,每取出一个list就与以前的list归并返回merge后list,知... 阅读全文
摘要:
Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations:getandset.get(key)- Get the valu... 阅读全文
摘要:
Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing all ones and return its area.求出0,1矩阵中的最大矩形区域:DP问题,可以使用数组记下当前行位... 阅读全文
摘要:
Given a 2d grid map of'1's (land) and'0's (water), count the number of islands. An island is surrounded by water and is formed by connecting adjacent ... 阅读全文
摘要:
Determine if a Sudoku is valid, according to:Sudoku Puzzles - The Rules.The Sudoku board could be partially filled, where empty cells are filled with ... 阅读全文