ProfileIntroduction to blog you can see this blog reading is my pleasure, this blog will continue to update, thank your support, welcome your attention and comments. Blog has multiple columns, respectively is a Windows app development, the uwp (general windows platform development, SiCp problem solution and the scheme language learning, algorithm analysis and LeetCode Tixie, Android application development, and has recently added the...
12:28 2015-09-17
read(7092)
Translation given two sorted array of integers nums2 and nums1, the nums2 merge into an array of nums1. Comment:
You can assume that there is enough space in the nums1 (space is greater than or equal to m+n) to store additional elements from the nums2.
The initial space of nums1 and m are nums2 and n. Two Given sorted integer arrays nums1 and nums2 merge nums2 into nums1 as one...
12:06 2016-01-24
read(313)
Given a two fork tree, find its shortest depth. The shortest depth is the shortest distance from the node to the nearest leaf node. The original a binary tree find Given minimum its minimum depth.The depth is the number of nodes along the shortest path from the root node down to the nearest leaf node.
10:34 2016-01-24
read(289)
Translation to write a program to find the beginning of the intersection of two single linked list. For example, there are two linked list:
A1 a2 - A:
General
C1 - C2 - C3
↗
B1 B2 - B: - B3
Start at the node C1. Comment:
If the two list does not intersect, return NULL.
In function...
09:26 2016-01-24
read(308)
Given a two fork tree root and one and sum, determine whether there is a path from the root to the leaves of the tree that makes all the nodes along the path is equal to the given sum. For example:
Given the following two fork tree and sum=22,
Five
/ \
Forty-eight
/ /
Eleven thousand one hundred and thirty-four
\ \ \ \ \ \
7...
11:10 2016-01-23
read(456)
Translation given an integer n, return n! Number of zeros at the back. Note: your solution should be in the log time complexity. The original given an integer n, return the number in n of trailing zeroes!.Note: your solution should be in logarithmic time complexity. analysis at first I see topic when not to pay too much attention to, thought is to compute the n the number behind the zero...
10:24 2016-01-23
read(392)
Translation given an index K, return to the Pascal triangle of the first K line. For example, given K=3,
Return [1,3,3,1]. Notes
Can you improve your algorithm with only O (k) extra space? Given an index K return, the kth row of the Pascal's triangle.For example given, k = 3,
[1,3,3,1].Note: Return
You optimiz Could...
10:11 2016-01-23
read(361)
Given a row number, generate its Pascal triangle. For example, given numRows = 5,
Return
[
[1],
[1,1],
[1,2,1],
[1,3,3,1],
[1,4,6,4,1]
NumRows Given generate, the first numRows of Pascal's triangle.For example given, numRows = 5,...
09:28 2016-01-23
read(358)
Translation is given a series of digital representation of the non negative, the addition to the conversion into a digital. The highest level of digital storage is in the front of the column. Given a non-negative number represented as an array of digits plus one to the number.The digits are stored such that the most significant digit is at the...
21:47 2016-01-22
read(452)
You are a professional robber, and plan to steal every household along the street. Each house has a certain amount of cash to prevent you from stealing the only obstacle that is adjacent to the two houses there is a security system. Once the two houses are stolen, the system will automatically contact the police. Given a series of non negative integers representing the money of each house, the maximum value can be stolen without disturbing the police. Are You a professional robber planning to rob houses along a street. Ea...
11:09 2016-01-22
read(528)
Given a two fork tree, returns the value of each node that is traversed by the hierarchy. From left to right, layer by layer traversal. For example:
Given a two tree {3,9,20, #, #, 15,7},
Three
/ \
Nine hundred and twenty
/ \
One hundred and fifty-seven
Returns the result of its hierarchy:
[
[3],
[9,20],
[15,7]
Translation a binary tree return, the level order tra Given...
10:30 2016-01-22
read(538)
Given a two fork tree, returns the value of each node from the bottom up traversal. From left to right, from the leaves to the node. For example:
Given the two fork tree is {3,9,20, #, #, 15,7},
Three
/ \
Nine hundred and twenty
/ \
One hundred and fifty-seven
Returns the traversal result from the bottom up:
[
[15,7],
[9,20],
[3]
A binary Given tree return, the bottom-up lev...
10:03 2016-01-22
read(410)
Given a two fork tree, check whether it is its own mirror image (that is, the center of symmetry). For example, the two fork tree is symmetrical:
One
/ \
Twenty-two
\ \ \ \ \ \ \ \
3443 but this is not the following:
One
/ \
Twenty-two
\ \
33 comment:
If you can use recursion and iteration to solve the problem at the same time, it will be a plus. A binary tree Given, whet check...
14:04 2016-01-21
read(87)
Given a two fork tree, determine whether it is highly balanced. (a noun is not an adjective...... For this problem, a height balanced binary tree is defined as: two subtrees of each node of the tree depth difference should not exceed 1. A Given binary tree determine, if it is height-balanced.For this problem a, height-balanced binary tree is defined as a...
11:46 2016-01-21
read(186)
Queue to achieve the operation of the stack as follows. Push (x) - add the element x into the stack
Pop () - remove elements from the top of the stack
Top () -- the top element of the stack
Empty () - the return stack is empty note: you must use a standard operation of the queue. In other words, only push/pop/size/empty and other operations are effective. The queue may not be native support, depending on the language you use. As long as you are using queue standard operation, you can use list or deque (double...
21:28 2016-01-20
read(487)
Translation stack to achieve the following operation of the queue. Push (x) -- the element X is written to the tail of the queue
Pop () - removes the element from the queue header
Peek () - returns the queue header element
Empty () - to return to the queue is empty note: you must use a standard operation of the stack. In other words, only push/pop/size/empty and other operations are effective. Stack may not be native support, depending on the language you use. As long as you are using stack standard operation, you can use list or dequ...
21:18 2016-01-20
read(429)
Given an integer, write a function to determine whether it is a power of 2. The original given an integer, write a function to determine if it is a power of two. Analysis for details, please see the article: 326 LeetCode power of three (3 mi) (recursive and log function) see question number, 326 is ontology enhanced version, 326 is request could not be with loops or recursive... You can go to see the above article. This...
11:03 2016-01-19
read(350)
Write an algorithm to determine whether a number is "happy". Happy is by the following steps defined number: from all positive integers, with each of its digital square and to replace the number, repeat this process until the final result is 1 (at the same time, it would stop), or it in a does not contain cycles of 1 infinite loop. These are the number of happy endings at the end of 1. For example: 19 is the number of happy. 12+92=821^2 + 9^2 = 82
82+22=688^2 + 2^2 = 68
62+82=1006^2 +...
10:51 2016-01-19
read(449)
Given an integer, write a function to determine whether it is a power of 3 (translation may not be appropriate...... Follow-up
Can you do it without any loops or recursion. An integer Given write to function a determine if it is a power of three.Follow up:
Could you do it without using any loop / recursion? I analyze the...
09:50 2016-01-19
read(490)
A program to write a program to check whether the number is ugly (number Ugly). The number is a positive factor, it includes only 2, 3, 5. For example, 8, 6 is the number of ugly, and because it contains 7 of this factor, so the number of 14 is not ugly. Note that 1 is generally regarded as an ugly number. A Write program to check whether a given number is an ugly number.Ugly numbers are positive numbe...
13:24 2016-01-18
read(316)
Given a single linked list, all the odd nodes are classified as a group, and even nodes are closely followed by. Please note that we are talking about the value of the node instead of the node. You should try to finish it on the spot. Procedures should be completed in the O (1) space complexity and O (nodes) time complexity. For example:
Given 1->2->3->4->5->NULL,
Return 1->3->5->2->4->NULL. Notes
Finally, the relative positions of the odd and even nodes are consistent with the input. The first node is an odd node, second node node pairs, and so on...
12:49 2016-01-18
read(504)