Given an array where elements are sorted in ascending order, convert it to a height balanced BST.解题思路:用一个有序数组,创建一个平衡二叉查找树。为确保平衡,需要满足两子树的高度差不大于1,可以通过设置...
分类:
其他好文 时间:
2015-05-21 06:37:05
阅读次数:
123
1 题目Given an array withnobjects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order red...
分类:
其他好文 时间:
2015-05-20 23:50:14
阅读次数:
112
#import @class Order;typedef void (^ResultBlock)(Order *resultOrder);@interface AlipayService : NSObject+(instancetype)shareService;/** * 支付动作,跳转到支付客....
分类:
其他好文 时间:
2015-05-20 23:41:01
阅读次数:
199
select5种子句:
where条件查询
groupby分组
having筛选
orderby排序
limit限制结果条数
---------------------
orderby
排序
默认是升序asc
想要按降序排desc
可以按多字段排序,如:
orderby字段1asc/desc,字段2asc/desc;
取出所有商品,按价格从低到高:(默认)
s..
分类:
其他好文 时间:
2015-05-20 18:46:14
阅读次数:
116
BOM(Byte Order Mark),字节顺序标记,出现在文本文件头部,Unicode编码标准中用于标识文件是采用哪种格式的编码,但它对于文件的读者来说是不可见字符。下表列出不同的字符编码的BOM编码BOM (十六进制)BOM (十进制)CP1252 字符UTF-8[t 1]EF BB BF239 187 191UTF-16 (BE)FE FF254 255þÿUTF-16 (LE)FF...
分类:
其他好文 时间:
2015-05-20 18:24:26
阅读次数:
171
Yii的Active Recorder包装了很多。特别是把SQL中 把where,order,limit,IN/not IN,like等常用短句都包含进CDbCriteria这个类中去,这样整个代码会比较规范,一目了然。 $criteria =newCDbCriteria;$criteria->ad...
分类:
其他好文 时间:
2015-05-20 18:14:58
阅读次数:
135
1.使用explain语句查看性能mysql> explain select product_id from orders where order_id in (123, 312, 223, 132, 224) \G2.为什么要创建组合索引呢?如果只有一个索引,2个查询条件的语句中会先去索引查询一个...
分类:
数据库 时间:
2015-05-20 18:11:57
阅读次数:
220
leetcode 2 – Add Two Numbers
题目:
You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Add t...
分类:
其他好文 时间:
2015-05-20 16:22:34
阅读次数:
110
题目:
Garth likes apples and oranges. Recently he bought N fruits, where each fruit was either an apple or an orange. Then he ate all
N fruits in some order. You are given an int K. Garth obse...
分类:
其他好文 时间:
2015-05-20 14:54:13
阅读次数:
182
题目:Given a set of distinct integers,nums, return all possible subsets.Note:Elements in a subset must be in non-descending order.The solution set must ...
分类:
其他好文 时间:
2015-05-20 13:02:57
阅读次数:
77