摘要: Givenn, how many structurally uniqueBST's(binary search trees) that store values 1...n?For example,Givenn= 3, there are a total of 5 unique BST's. 1... 阅读全文
posted @ 2015-12-09 22:59 wxquare 阅读(134) 评论(0) 推荐(0) 编辑
摘要: 一、进程是如何进行网络通信的?socket通信的过程? 同一机器上的不同进程之间的通信方式有很多种,主要使用消息传递或共享内存。而跨网络的进程是几乎都是使用socket通信,例如web服务器,QQ。 socket即是一种特殊的文件,操作系统提供了一些socket函数就是对其进行的操作(读/写IO... 阅读全文
posted @ 2015-12-08 00:11 wxquare 阅读(807) 评论(0) 推荐(0) 编辑
摘要: 一、问题 如何设计一容器能包含彼此不同而又相互关联的类的对象(处于完整的继承层次的类)?因为一般的数组容器都只能包含一种类型的对象。 假设有一个表示不同类型的交通工具的类的派生层次: class Vehicle{public: virtual double weight () cons... 阅读全文
posted @ 2015-12-04 00:06 wxquare 阅读(429) 评论(0) 推荐(0) 编辑
摘要: Given a 2D board and a word, find if the word exists in the grid. The word can be constructed from letters of sequentially adjacent cell, where "adjac... 阅读全文
posted @ 2015-12-01 22:29 wxquare 阅读(299) 评论(0) 推荐(0) 编辑
摘要: Givennpairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, givenn= 3, a solution set is:"((()))... 阅读全文
posted @ 2015-11-28 20:57 wxquare 阅读(153) 评论(0) 推荐(0) 编辑
摘要: 1.Given a set of candidate numbers (C) and a target number (T), find all unique combinations inCwhere the candidate numbers sums toT.Thesamerepeated n... 阅读全文
posted @ 2015-11-26 22:29 wxquare 阅读(175) 评论(0) 推荐(0) 编辑
摘要: Given a string containing only digits, restore it by returning all possible valid IP address combinations.For example:Given "25525511135",return ["255... 阅读全文
posted @ 2015-11-26 11:46 wxquare 阅读(223) 评论(0) 推荐(0) 编辑
摘要: 一、N-QueensII 1 class Solution { 2 public: 3 int totalNQueens(int n) { 4 int total = 0; 5 vector v(n,0); 6 dfs(0,n,total,v)... 阅读全文
posted @ 2015-11-23 22:12 wxquare 阅读(180) 评论(0) 推荐(0) 编辑
摘要: Follow up for ”Unique Paths”:Now consider if some obstacles are added to the grids. How many unique paths would there be?An obstacle and empty space i... 阅读全文
posted @ 2015-11-22 22:09 wxquare 阅读(198) 评论(0) 推荐(0) 编辑
摘要: Clone an undirected graph. Each node in the graph contains alabeland a list of itsneighbors. 1 /** 2 * Definition for undirected graph. 3 * struct U... 阅读全文
posted @ 2015-11-15 10:36 wxquare 阅读(151) 评论(0) 推荐(0) 编辑