码迷,mamicode.com
首页 >  
搜索关键字:算法面试    ( 461个结果
LeetCode: Same Tree [100]
【题目】 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 identical and the nodes have the same value. 【题意】 判断了两个二叉树是否相等 【思路】 递归...
分类:其他好文   时间:2014-06-02 11:03:03    阅读次数:205
LeetCode: Interleaving String [097]
【题目】 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", return true. When s3 = "aadbbbaccc", return false. 【题意】 给定字符串s1,s2,s3, 判断s3是不是s1和s2中的字交叉组合...
分类:其他好文   时间:2014-06-02 10:58:24    阅读次数:211
LeetCode: Symmetric Tree [101]
【题目】 Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). For example, this binary tree is symmetric: 1 / 2 2 / \ / 3 4 4 3 But the following is not: 1 / 2 2 \ 3 3 No...
分类:其他好文   时间:2014-06-02 10:56:14    阅读次数:237
LeetCode: Recover Binary Search Tree [099]
【题目】 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) space is pretty straight forward. Could you devise a constant space solution? confused what "{1,#,2,3}" ...
分类:其他好文   时间:2014-06-02 10:38:17    阅读次数:246
LeetCode: Validate Binary Search Tree [098]
【题目】 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 contains only nodes with keys less than the node's key. The right subtree of a node contains only nodes with ke...
分类:其他好文   时间:2014-06-02 10:29:55    阅读次数:257
LeetCode: Unique Binary Search Trees [095]
【题目】 Given n, how many structurally unique BST's (binary search trees) that store values 1...n? For example, Given n = 3, there are a total of 5 unique BST's. 1 3 3 2 1 \ / / / \ 3 2 1 ...
分类:其他好文   时间:2014-06-01 15:34:24    阅读次数:231
LeetCode: Unique Binary Search Trees II [096]
【题目】 Given n, generate all structurally unique BST's (binary search trees) that store values 1...n. For example, Given n = 3, your program should return all 5 unique BST's shown below. 1 3 3 2 1 \ / / / \ ...
分类:其他好文   时间:2014-06-01 15:33:45    阅读次数:297
LeetCode: Reverse Linked List II [092]
【题目】 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->NULL, m = 2 and n = 4, return 1->4->3->2->5->NULL. Note: Given m, n satisfy the following condition: 1 ≤ m ≤ n ≤ length of list. 【题意】 ...
分类:其他好文   时间:2014-06-01 15:08:34    阅读次数:237
LeetCode: Restore IP Addresses [093]
【题目】 Given a string containing only digits, restore it by returning all possible valid IP address combinations. For example: Given "25525511135", return ["255.255.11.135", "255.255.111.35"]. (Order does not matter) 【题意】 给定一个字符串,恢复并返回所有符合条件的IP串 【思路】...
分类:其他好文   时间:2014-06-01 13:01:56    阅读次数:295
LeetCode: Binary Tree Inorder Traversal [094]
【题目】 Given a binary tree, return the inorder traversal of its nodes' values. For example: Given binary tree {1,#,2,3}, 1 2 / 3 return [1,3,2]. Note: Recursive solution is trivial, could you do it iteratively? confused what "{1,#,2...
分类:其他好文   时间:2014-06-01 13:01:23    阅读次数:279
461条   上一页 1 ... 36 37 38 39 40 ... 47 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!