随笔分类 -  algorithm

上一页 1 ··· 6 7 8 9 10 11 12 13 下一页
摘要: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 given sum. F 阅读全文
posted @ 2017-11-18 05:18 逸朵 阅读(138) 评论(0) 推荐(0)
摘要: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 nearest l 阅读全文
posted @ 2017-11-18 05:04 逸朵 阅读(155) 评论(0) 推荐(0)
摘要: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 the dept 阅读全文
posted @ 2017-11-18 03:34 逸朵 阅读(145) 评论(0) 推荐(0)
摘要:Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST. 阅读全文
posted @ 2017-11-18 01:23 逸朵 阅读(126) 评论(0) 推荐(0)
摘要:Given an array where elements are sorted in ascending order, convert it to a height balanced BST. 阅读全文
posted @ 2017-11-15 11:41 逸朵 阅读(139) 评论(0) 推荐(0)
摘要:Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from left to right, level by level from leaf to root). For 阅读全文
posted @ 2017-11-15 11:35 逸朵 阅读(138) 评论(0) 推荐(0)
摘要:Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along the longest path from the root node down to the farthest l 阅读全文
posted @ 2017-11-15 11:31 逸朵 阅读(109) 评论(0) 推荐(0)
摘要:Given a binary tree, return the zigzag level order traversal of its nodes' values. (ie, from left to right, then right to left for the next level and 阅读全文
posted @ 2017-11-15 11:26 逸朵 阅读(132) 评论(0) 推荐(0)
摘要:Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level). For example:Given binary tree [3 阅读全文
posted @ 2017-11-15 08:51 逸朵 阅读(112) 评论(0) 推荐(0)
摘要:Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). For example, this binary tree [1,2,2,3,4,4,3] is symmet 阅读全文
posted @ 2017-11-15 08:33 逸朵 阅读(121) 评论(0) 推荐(0)
摘要: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", ret 阅读全文
posted @ 2017-11-15 08:21 逸朵 阅读(122) 评论(0) 推荐(0)
摘要: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 i 阅读全文
posted @ 2017-11-15 05:57 逸朵 阅读(110) 评论(0) 推荐(0)
摘要:Given two binary trees, write a function to check if they are the same or not. Two binary trees are considered the same if they are structurally ident 阅读全文
posted @ 2017-11-15 04:38 逸朵 阅读(109) 评论(0) 推荐(0)
摘要:Given an integer n, generate all structurally unique BST's (binary search trees) that store values 1...n. For example,Given n = 3, your program should 阅读全文
posted @ 2017-11-15 04:02 逸朵 阅读(130) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2017-11-15 03:06 逸朵 阅读(184) 评论(0) 推荐(0)
摘要: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' 阅读全文
posted @ 2017-11-15 01:46 逸朵 阅读(135) 评论(0) 推荐(0)
摘要:Given a binary tree, return the inorder traversal of its nodes' values. For example:Given binary tree [1,null,2,3], return [1,3,2]. 阅读全文
posted @ 2017-11-15 01:29 逸朵 阅读(138) 评论(0) 推荐(0)
摘要:A message containing letters from A-Z is being encoded to numbers using the following mapping way: 'A' -> 1 'B' -> 2 ... 'Z' -> 26 Beyond that, now th 阅读全文
posted @ 2017-11-13 12:46 逸朵 阅读(430) 评论(0) 推荐(0)
摘要:A message containing letters from A-Z is being encoded to numbers using the following mapping: Given an encoded message containing digits, determine t 阅读全文
posted @ 2017-11-13 11:55 逸朵 阅读(196) 评论(0) 推荐(0)
摘要:Given a collection of integers that might contain duplicates, nums, return all possible subsets (the power set). Note: The solution set must not conta 阅读全文
posted @ 2017-11-13 11:42 逸朵 阅读(128) 评论(0) 推荐(0)

上一页 1 ··· 6 7 8 9 10 11 12 13 下一页