12 2015 档案
摘要:题目描述:(链接)Given a digit string, return all possible letter combinations that the number could represent.A mapping of digit to letters (just like on the...
阅读全文
摘要:题目描述:(链接)Given two numbers represented as strings, return multiplication of the numbers as a string.Note: The numbers can be arbitrarily large and are...
阅读全文
摘要:题目描述:(链接)Given a binary tree struct TreeLinkNode { TreeLinkNode *left; TreeLinkNode *right; TreeLinkNode *next; }Populate each ne...
阅读全文
摘要:题目描述:(链接)Given a binary tree containing digits from0-9only, each root-to-leaf path could represent a number.An example is the root-to-leaf path1->2->3...
阅读全文
摘要:题目描述:(链接)Implementatoito convert a string to an integer.Hint:Carefully consider all possible input cases. If you want a challenge, please do not see b...
阅读全文
摘要:题目解析:(链接)Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum.For example:Given the below binary tree...
阅读全文
摘要:题目描述:(链接)Given a binary tree, find its minimum depth.The minimum depth is the number of nodes along the shortest path from the root node down to the n...
阅读全文
摘要:题目描述:(链接)Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.解题思路: 1 /** 2 * Definition for ...
阅读全文
摘要:题目描述:(链接)Given an array where elements are sorted in ascending order, convert it to a height balanced BST.解题思路: 1 /** 2 * Definition for a binary tre...
阅读全文
摘要:题目描述:(链接)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 B...
阅读全文
摘要:1 -(BOOL)isValidateEmail:(NSString *)email {2 NSString *emailRegex = @"[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,4}"; 3 NSPredicate *email...
阅读全文
摘要:[str stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]
阅读全文
摘要:题目描述:(链接)Given inorder and postorder traversal of a tree, construct the binary tree.解题思路: 1 /** 2 * Definition for a binary tree node. 3 * struct Tr...
阅读全文
摘要:题目描述:(链接)Given preorder and inorder traversal of a tree, construct the binary tree.解题思路: 1 /** 2 * Definition for a binary tree node. 3 * struct Tre...
阅读全文
摘要:From :http://www.cnblogs.com/heaad/archive/2010/12/20/1911614.html优化算法入门系列文章目录(更新中): 1.模拟退火算法 2.遗传算法一. 爬山算法 ( Hill Climbing ) 介绍模拟退火前,先介绍爬山算法。爬山算法是一...
阅读全文
摘要:摘要本文介绍一种用于高维空间中的快速最近邻和近似最近邻查找技术——Kd-Tree(Kd树)。Kd-Tree,即K-dimensional tree,是一种高维索引树形数据结构,常用于在大规模的高维数据空间进行最近邻查找(Nearest Neighbor)和近似最近邻查找(Approximate Ne...
阅读全文
摘要:题目解析:(链接)Given a binary tree, determine if it is a valid binary search tree (BST).Assume a BST is defined as follows:The left subtree of a node contai...
阅读全文
摘要:题目描述:(链接)Given a binary tree, flatten it to a linked list in-place.For example,Given 1 / \ 2 5 / \ \ 3 4 6The fl...
阅读全文
摘要:题目描述:(链接)Given a binary tree, determine if it is height-balanced.For this problem, a height-balanced binary tree is defined as a binary tree in which ...
阅读全文
摘要:题目描述:(链接)Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).For example, this binary tree is symmetric: ...
阅读全文
摘要:题目解析:(链接)Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the giv...
阅读全文
摘要:题目描述:(链接)Given two binary trees, write a function to check if they are equal or not.Two binary trees are considered equal if they are structurally ide...
阅读全文
摘要:题目描述:(链接)Two elements of a binary search tree (BST) are swapped by mistake.Recover the tree without changing its structure.Note:A solution using O(n) ...
阅读全文