题目:
Given an array of integers, return indices of the two numbers such that they add up to a specific target.You may assume that each input would have exactly one solution.Example:
Given nums = [2, 7...
分类:
其他好文 时间:
2016-03-15 14:57:51
阅读次数:
172
题目:
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,9,20,#,#,15,7},
return its level order tr...
分类:
其他好文 时间:
2016-03-08 14:59:54
阅读次数:
108
题目:
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: “The lowest common ancestor is defined betwee...
分类:
其他好文 时间:
2016-03-07 15:06:42
阅读次数:
148
题目:
Given an array of integers and an integer k, find out whether there are two distinct indices i and j in the array such that nums[i] = nums[j] and the difference between i and j is at most k.翻译:
给...
分类:
其他好文 时间:
2016-03-07 15:06:41
阅读次数:
148
题目:
Find the total area covered by two rectilinear rectangles in a 2D plane.Each rectangle is defined by its bottom left corner and top right corner as shown in the figure.
Assume that the total ar...
分类:
其他好文 时间:
2016-03-07 14:00:20
阅读次数:
292
题目:
Rotate an array of n elements to the right by k steps.For example, with n = 7 and k = 3, the array [1,2,3,4,5,6,7] is rotated to [5,6,7,1,2,3,4].Note:
Try to come up as many solutions as you can,...
分类:
其他好文 时间:
2016-03-05 23:51:31
阅读次数:
310
题目:
Given a string s consists of upper/lower-case alphabets and empty space characters ’ ‘, return the length of last word in the string.If the last word does not exist, return 0.Note: A word is defin...
分类:
其他好文 时间:
2016-03-04 17:51:09
阅读次数:
108
题目:
Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.翻译:
合并2个已经排序的链表,并且返回一个新的链表。这个新的链表应该由前面提到的2个链表的节点所组成。分析...
分类:
其他好文 时间:
2016-03-04 17:50:50
阅读次数:
131
题目:
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 head of the list.翻译:
给定一个非负数,它是有数字的数组组成,...
分类:
其他好文 时间:
2016-03-04 17:48:32
阅读次数:
126