上一页 1 ··· 7 8 9 10 11 12 13 14 15 ··· 23 下一页
摘要: Given a non-negative integer num, repeatedly add all its digits until the result has only one digit.For example:Given num = 38, the process is like: 3... 阅读全文
posted @ 2015-08-17 11:29 尾巴草 阅读(107) 评论(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 le... 阅读全文
posted @ 2015-08-17 10:49 尾巴草 阅读(119) 评论(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 le... 阅读全文
posted @ 2015-08-17 10:43 尾巴草 阅读(138) 评论(0) 推荐(0)
摘要: 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 an... 阅读全文
posted @ 2015-08-17 09:43 尾巴草 阅读(116) 评论(0) 推荐(0)
摘要: Given an integer array of size n, find all elements that appear more than ⌊ n/3 ⌋ times. The algorithm should run in linear time and in O(1) space.解法一... 阅读全文
posted @ 2015-08-15 11:07 尾巴草 阅读(125) 评论(0) 推荐(0)
摘要: Given a binary search tree, write a function kthSmallest to find the kth smallest element in it.Note: You may assume k is always valid, 1 ≤ k ≤ BST's ... 阅读全文
posted @ 2015-08-14 16:24 尾巴草 阅读(150) 评论(0) 推荐(0)
摘要: Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST.According to the definition of LCA on Wikipedia:... 阅读全文
posted @ 2015-08-14 15:26 尾巴草 阅读(332) 评论(0) 推荐(0)
摘要: Invert a binary tree. 4 / \ 2 7 / \ / \1 3 6 9to 4 / \ 7 2 / \ / \9 6 3 1Trivia:This problem was inspired by thi... 阅读全文
posted @ 2015-08-14 14:49 尾巴草 阅读(152) 评论(0) 推荐(0)
摘要: 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... 阅读全文
posted @ 2015-08-14 11:29 尾巴草 阅读(128) 评论(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 @ 2015-08-14 10:46 尾巴草 阅读(174) 评论(0) 推荐(0)
上一页 1 ··· 7 8 9 10 11 12 13 14 15 ··· 23 下一页