摘要:
问题描述: Given s1, s2, s3, find whether s3 is formed by the interleaving of s1 and s2. For example,Given:s1 = "aabcc",s2 = "dbbca", When s3 = "aadbbcbcac 阅读全文
摘要:
Unique Binary Search Trees:求生成二叉排序树的个数。 Given n, how many structurally unique BST's (binary search trees) that store values 1...n? For example,Given n 阅读全文
摘要:
问题描述: Given a string containing only digits, restore it by returning all possible valid IP address combinations. For example:Given "25525511135", retu 阅读全文
摘要:
ReverseLinkedList: ReverseLinkedList2: Reverse a linked list from position m to n. Do it in-place and in one-pass. For example:Given 1->2->3->4->5->NU 阅读全文
摘要:
问题描述: A message containing letters from A-Z is being encoded to numbers using the following mapping: Given an encoded message containing digits, deter 阅读全文
摘要:
问题描述: The gray code is a binary numeral system where two successive values differ in only one bit. Given a non-negative integer n representing the tot 阅读全文
摘要:
问题描述: Given a string s1, we may represent it as a binary tree by partitioning it to two non-empty substrings recursively. Below is one possible repres 阅读全文
摘要:
/* w代表物品重量,v代表物品价值,c代表背包最大能容纳重量 res[i][j]代表背包可以选择前i个物品,最大容量为j时候的最大价值 res[i-1][j] if(w[i-1] > j) res[i][j] = max((res[i-1][j-w[i-1]]+v[i-1]), res[i-1][j]) else **/ public c... 阅读全文
摘要:
问题描述: Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x. You should preserv 阅读全文
摘要:
问题描述: Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing only 1's and return its area. For example, given the fol 阅读全文