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
1.在查询结果中显示列名:a.用as关键字:select name as '姓名' from students order by ageb.直接表示:select name '姓名' from students order by age2.精确查找:a.用in限定范围:select * from s...
分类:
数据库 时间:
2014-08-17 12:57:02
阅读次数:
273
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
一下午在学习mysql,最有价值的就是这一点点Order by 可以对在select字句中出现的字段位置进行排列eg:select name,count(*) from eg group by name order by 2;;这里2的意思跟为count(*)取一个别名是一样的意思,Join(联结)...
分类:
数据库 时间:
2014-08-16 23:46:51
阅读次数:
313
1.获取所有数据库名:SELECT Name from Master..SysDatabases ORDER BY Name2.获取所有表名:SELECT Name from DatabaseName..SysObjects Where XType='U' ORDER BY NameXType='U...
分类:
数据库 时间:
2014-08-16 13:45:30
阅读次数:
253
Given an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order red, white and blue.
Here, we will use the integers ...
分类:
其他好文 时间:
2014-08-16 12:35:30
阅读次数:
233
Convert Sorted List to Binary Search TreeGiven a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST....
分类:
其他好文 时间:
2014-08-16 12:19:20
阅读次数:
227
Given a binary tree, return thezigzag level ordertraversal of its nodes' values. (ie, from left to right, then right to left for the next level and al...
分类:
其他好文 时间:
2014-08-16 00:59:49
阅读次数:
179
Given an integer n, generate a square matrix filled with elements from 1 to n2 in
spiral order.
For example,
Given n = 3,
You should return the following matrix:
[
[ 1, 2, 3 ],
[ 8, 9, 4 ],
[...
分类:
其他好文 时间:
2014-08-15 22:37:39
阅读次数:
274
Given a collection of integers that might contain duplicates,S, return all possible subsets.Note:Elements in a subset must be in non-descending order....
分类:
其他好文 时间:
2014-08-15 21:08:29
阅读次数:
212