题目
Given an array where elements are sorted in ascending order, convert it to a height balanced BST.
方法
数组是有序的,要求创建的二叉树尽量平衡,很容易想到对数组进行二分操作,左边的数组元素是左子树,右边的数组元素是右子树。进行递归操作就可以了。
TreeNode...
分类:
其他好文 时间:
2014-06-20 11:06:46
阅读次数:
257
【题目】
Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum.
For example:
Given the below binary tree and sum = 22,
5
/ 4 8
/ / 11 13 4
...
分类:
其他好文 时间:
2014-06-20 10:53:08
阅读次数:
181
题目
Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.
方法
和有序数组的思想基本一样,将链表进行二分。
TreeNode getBST(ListNode head, int len) {
i...
分类:
其他好文 时间:
2014-06-20 09:46:33
阅读次数:
267
hibernate中插入数据后会返回插入的数据的ID,mybatis要使用此功能需要在配置文件中显示声明两个属性即可:...
分类:
其他好文 时间:
2014-06-20 09:25:48
阅读次数:
169
mybatis 提供了高级的关联查询功能,一对多,多对多,多对一...
分类:
其他好文 时间:
2014-06-07 14:41:35
阅读次数:
301
今天安装了一下Xcode6-Beta版,想来体验一下Swift的魅力:安装Swift系统最低版本为:10.9.3
只看看一点The Swift Programming Language,下面给大家分享一下:(待续。。。)// Playground - noun: a place where people can play
import Cocoa
///1.声明一个可变的变量
var str...
分类:
其他好文 时间:
2014-06-07 13:54:43
阅读次数:
259
题目
Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum.
For example:
Given the below binary tree and sum
= 22,
5
...
分类:
其他好文 时间:
2014-06-07 13:47:22
阅读次数:
191
Let d(n) be defined as the sum of proper divisors of n (numbers less than
n which divide evenly into n).
If d(a) = b and d(b) = a, where a
b, then a and b are an amicable pair and each of a and
b...
分类:
其他好文 时间:
2014-06-07 13:40:53
阅读次数:
226
public bool BackupAA() { int temp = 0; int tempdel
= 0; string sql = "INSERT INTO [WMSBAK].[dbo].[AACopy] SELECT * FROM
[TestDB].[dbo].[AA] WHERE Add....
分类:
其他好文 时间:
2014-06-07 09:46:26
阅读次数:
150
玩了一下mybatis,网上源码说的不太清楚。自己写了一下。希望对大家有用(spring3+mybatis3+mysql)实体类:package
org.my.entity;public class User { private Integer id; private String na...
分类:
数据库 时间:
2014-06-07 07:14:07
阅读次数:
318