II
U C ONLINE
C ON TEST
2 008
Problem D: GCD LCM
Input: standard input
Output: standard output
The GCD of two positive integers is the largest integer ...
分类:
其他好文 时间:
2014-08-17 21:24:53
阅读次数:
189
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...
分类:
其他好文 时间:
2014-08-17 19:49:42
阅读次数:
190
Treblecross is a two player gamewhere the goal is to get three X in a row on a one-dimensional board. At the startof the game all cells in the board is empty. In each turn a player puts a X in an empt...
分类:
其他好文 时间:
2014-08-17 17:03:33
阅读次数:
358
To find the most common words, we can apply the DSU pattern; most_common takes a histogram and returns a list of word-frequency tuples, sorted in reve...
分类:
其他好文 时间:
2014-08-17 17:00:32
阅读次数:
180
We have seen built-in functions that take a variable number of arguments. For example range can take one, two or three arguments.It is possible to wri...
分类:
其他好文 时间:
2014-08-17 16:52:32
阅读次数:
272
A JavaScript object is composed of properties which may fall into two categories—data properties and accessor properties. A property is identified by a name and described by four attributes. The attri...
分类:
编程语言 时间:
2014-08-17 15:37:42
阅读次数:
344
Problem Description
Given three strings, you are to determine whether the third string can be formed by combining the characters in the first two strings. The first two strings can be mixed arbitra...
分类:
其他好文 时间:
2014-08-17 13:04:42
阅读次数:
205
Given an array where elements are sorted in ascending order, convert it to a height balanced BST.思路:取数组的中点为树的根,前半部分为左子树,后半部分为右子树。 1 class Solution { 2...
分类:
其他好文 时间:
2014-08-17 13:02:12
阅读次数:
210
Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.思路:使用两个指针分别以1、2的速度遍历链表,以定位出链表的中点,进而将链表分割成...
分类:
其他好文 时间:
2014-08-17 02:21:36
阅读次数:
246
Description
There are two rows of positive integer numbers. We can draw one line segment between any two equal numbers, with values r, if one of them is located in the first row and the other one i...
分类:
其他好文 时间:
2014-08-16 23:52:01
阅读次数:
560