摘要: Given a binary tree, you need to compute the length of the diameter of the tree. The diameter of a binary tree is the length of the **longest** path between any two nodes in a tree. This path may or may not pass through the root. 阅读全文
posted @ 2019-04-15 19:01 yjxyy 阅读(206) 评论(0) 推荐(0) 编辑
摘要: Given a Binary Search Tree (BST), convert it to a Greater Tree such that every key of the original BST is changed to the original key plus sum of all keys greater than the original key in BST. 阅读全文
posted @ 2019-04-15 18:59 yjxyy 阅读(160) 评论(0) 推荐(0) 编辑
摘要: 输入一个整数数组,实现一个函数来调整该数组中数字的顺序,使得所有的奇数位于数组的前半部分,所有的偶数位于数组的后半部分,并保证奇数和奇数,偶数和偶数之间的相对位置不变。 阅读全文
posted @ 2019-04-14 18:01 yjxyy 阅读(115) 评论(0) 推荐(0) 编辑
摘要: 给定一个double类型的浮点数base和int类型的整数exponent。求base的exponent次方。 阅读全文
posted @ 2019-04-14 17:57 yjxyy 阅读(119) 评论(0) 推荐(0) 编辑
摘要: 输入一个整数,输出该数二进制表示中1的个数。其中负数用补码表示。 阅读全文
posted @ 2019-04-14 17:56 yjxyy 阅读(139) 评论(0) 推荐(0) 编辑
摘要: The [Hamming distance](https://en.wikipedia.org/wiki/Hamming_distance) between two integers is the number of positions at which the corresponding bits are different. 阅读全文
posted @ 2019-04-14 17:53 yjxyy 阅读(279) 评论(0) 推荐(0) 编辑
摘要: Given an array of integers where 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once. Find all the elements of [1, n] inclusive that do not appear in this array. 阅读全文
posted @ 2019-04-14 17:51 yjxyy 阅读(146) 评论(0) 推荐(0) 编辑
摘要: Given a string s and a non-empty string p, find all the start indices of p s anagrams in s. 阅读全文
posted @ 2019-04-14 17:48 yjxyy 阅读(147) 评论(0) 推荐(0) 编辑
摘要: 收集算法是内存回收的方法论,垃圾收集器是内存回收的具体实现。 阅读全文
posted @ 2019-04-14 15:16 yjxyy 阅读(212) 评论(0) 推荐(0) 编辑
摘要: 当多个线程一起工作的时候,可能线程与线程之间存在执行的先后顺序,所以需要对线程进行协调。 阅读全文
posted @ 2019-04-14 14:00 yjxyy 阅读(164) 评论(0) 推荐(0) 编辑