从前序与中序遍历序列构造二叉树。题意是给一个二叉树的前序遍历和中序遍历,请根据这两个遍历,把树构造出来。例子, For example, given preorder = [3,9,20,15,7] inorder = [9,3,15,20,7] Return the following binar ...
分类:
其他好文 时间:
2020-04-21 13:31:31
阅读次数:
65
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 ...
分类:
其他好文 时间:
2020-04-21 09:51:36
阅读次数:
66
Problem : A matrix is Toeplitz if every diagonal from top left to bottom right has the same element. Now given an M x N matrix, return True if and onl ...
分类:
其他好文 时间:
2020-04-20 12:00:41
阅读次数:
54
Cutting an integer means to cut a K digits lone integer Z into two integers of (K/2) digits long integers A and B. For example, after cutting Z = 1673 ...
分类:
其他好文 时间:
2020-04-20 11:55:53
阅读次数:
62
Problem : Given two integers L and R, find the count of numbers in the range [L, R] (inclusive) having a prime number of set bits in their binary repr ...
分类:
其他好文 时间:
2020-04-20 11:50:44
阅读次数:
65
Given n integers, your task is to pick k out of them so that the picked number are minimum when do bitwise “AND” among all of them. For example, there ...
分类:
其他好文 时间:
2020-04-20 11:39:23
阅读次数:
56
A vertex cover of a graph is a set of vertices such that each edge of the graph is incident to at least one vertex of the set. Now given a graph with ...
分类:
其他好文 时间:
2020-04-20 01:33:53
阅读次数:
85
Problem : Given a sorted array, two integers k and x, find the k closest elements to x in the array. The result should also be sorted in ascending ord ...
分类:
其他好文 时间:
2020-04-19 00:38:45
阅读次数:
62
Problem : Given a positive integer, check whether it has alternating bits: namely, if two adjacent bits will always have different values. Example 1: ...
分类:
其他好文 时间:
2020-04-18 22:43:40
阅读次数:
74
Problem : Given a non empty array of non negative integers nums, the degree of this array is defined as the maximum frequency of any one of its elemen ...
分类:
其他好文 时间:
2020-04-18 18:27:07
阅读次数:
49