上一页 1 ··· 10 11 12 13 14 15 16 17 18 ··· 20 下一页
摘要: 1 class Solution { 2 public: 3 /** 4 * @param s A string 5 * @return Whether the string is a valid palindrome 6 */ 7 bool isPa... 阅读全文
posted @ 2015-06-28 15:48 jianchao-li 阅读(229) 评论(0) 推荐(0) 编辑
摘要: 1 class Solution { 2 public: 3 /** 4 * @param s A string 5 * @return whether the string is a valid parentheses 6 */ 7 bool isV... 阅读全文
posted @ 2015-06-28 15:39 jianchao-li 阅读(477) 评论(0) 推荐(0) 编辑
摘要: 递归实现: 1 /** 2 * Definition of TreeNode: 3 * class TreeNode { 4 * public: 5 * int val; 6 * TreeNode *left, *right; 7 * TreeNode(int v... 阅读全文
posted @ 2015-06-28 15:26 jianchao-li 阅读(495) 评论(0) 推荐(0) 编辑
摘要: 1 class MinStack { 2 public: 3 MinStack() { 4 // do initialization if necessary 5 } 6 7 void push(int number) { 8 // wri... 阅读全文
posted @ 2015-06-28 15:21 jianchao-li 阅读(453) 评论(0) 推荐(0) 编辑
摘要: 1 class Queue { 2 public: 3 stack stack1; 4 stack stack2; 5 6 Queue() { 7 // do intialization if necessary 8 } 9 10 void... 阅读全文
posted @ 2015-06-28 15:20 jianchao-li 阅读(282) 评论(0) 推荐(0) 编辑
摘要: 1 class Solution { 2 public: 3 /** 4 * @param A, B: Two strings. 5 * @return: The length of longest common subsequence of A and B. 6 ... 阅读全文
posted @ 2015-06-28 15:19 jianchao-li 阅读(162) 评论(0) 推荐(0) 编辑
摘要: 1 class Solution { 2 public: 3 /** 4 * @param A, B: Two string. 5 * @return: the length of the longest common substring. 6 */ ... 阅读全文
posted @ 2015-06-28 15:18 jianchao-li 阅读(182) 评论(0) 推荐(0) 编辑
摘要: Well, this problem is spiritually similar to toCourse Schedule. You only need to store the nodes in the order you visit into a vector during BFS or DF... 阅读全文
posted @ 2015-06-28 02:39 jianchao-li 阅读(363) 评论(0) 推荐(0) 编辑
摘要: As suggested by the hints, this problem is equivalent to detecting a cycle in the graph represented byprerequisites. Both BFS and DFS can be used to s... 阅读全文
posted @ 2015-06-28 01:01 jianchao-li 阅读(281) 评论(0) 推荐(0) 编辑
摘要: Topological sort is an important application of DFS in directed acyclic graphs (DAG). For each edge (u, v) from node u to node v in the graph, u must ... 阅读全文
posted @ 2015-06-27 17:23 jianchao-li 阅读(501) 评论(0) 推荐(0) 编辑
摘要: Graph is an important data structure and has many important applications. Moreover, grach traversal is key to many graph algorithms.There are two syst... 阅读全文
posted @ 2015-06-26 23:09 jianchao-li 阅读(854) 评论(0) 推荐(0) 编辑
摘要: Problem Description:Given two strings S and T, determine if they are both one edit distance apart.To solve this problem, you first need to know what i... 阅读全文
posted @ 2015-06-26 15:52 jianchao-li 阅读(968) 评论(0) 推荐(0) 编辑
摘要: This problem is similar to Missing Ranges and easier than that one.The idea is to use two pointers to find the beginning and end of a range and then p... 阅读全文
posted @ 2015-06-26 14:29 jianchao-li 阅读(276) 评论(0) 推荐(0) 编辑
摘要: Problem Description:Given a sorted integer array where the range of elements are [lower,upper] inclusive, return its missing ranges.For example, given... 阅读全文
posted @ 2015-06-25 23:20 jianchao-li 阅读(205) 评论(0) 推荐(0) 编辑
摘要: Well, the key to this problem is on how to identify the recurring parts. After doing some examples using pen and paper, you may find that for the deci... 阅读全文
posted @ 2015-06-25 22:20 jianchao-li 阅读(281) 评论(0) 推荐(0) 编辑
上一页 1 ··· 10 11 12 13 14 15 16 17 18 ··· 20 下一页