我是按难度往下刷的,第二道是帕斯卡三角形二。简单易懂,题目如下:Given an index k, return the kth row of the Pascal's triangle.For example, given k = 3, Return [1,3,3,1].Note: Could y...
分类:
其他好文 时间:
2014-11-11 01:58:05
阅读次数:
242
Given inorder and postorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree.后序遍历的最后一个元素就是根...
分类:
其他好文 时间:
2014-11-11 00:40:07
阅读次数:
189
可以阅读官方文档:http://developer.android.com/reference/android/app/Dialog.html其中有一段:Note: Activities provide a facility to manage the creation, saving and re...
1、设置可选字段
为了设置某一个字段是可选的,不如说email,只需要修改其相关的模型,也就是在model.py中修改模型,将email=models.EmailField(blank=True),也就是添加blank=True。
这句代码告诉Django,允许email字段的输入为空,Django中字段的默认blank=false,即是不允许输入为空。
note:django在生成...
分类:
其他好文 时间:
2014-11-10 21:56:24
阅读次数:
331
Given an indexk, return thekthrow of the Pascal's triangle.For example, givenk= 3,Return[1,3,3,1].Note:Could you optimize your algorithm to use onlyO(...
分类:
其他好文 时间:
2014-11-09 23:25:25
阅读次数:
219
该节主要记录从代码中获取与屏幕适配相关的各个参数:
Java代码如下public class ScreenUtil {
/**
* Note:
* 只有activity可以使用getWindowManager,否则应该使用
* Context.getResources().getDisplayMetrics()来获取
*/
/**
* 获取DisplayMetric相...
分类:
移动开发 时间:
2014-11-09 22:19:40
阅读次数:
239
leetcode的第一题,回文数判断。原题如下:For example, "A man, a plan, a canal: Panama" is a palindrome. "race a car" is not a palindrome.Note: Have you consider that t...
分类:
其他好文 时间:
2014-11-09 19:33:04
阅读次数:
300
Given two sorted integer arrays A and B, merge B into A as one sorted array.Note:You may assume that A has enough space (size that is greater or equal...
分类:
其他好文 时间:
2014-11-09 19:30:15
阅读次数:
143
Two elements of a binary search tree (BST) are swapped by mistake.Recover the tree without changing its structure.Note:A solution using O(n) space is ...
分类:
其他好文 时间:
2014-11-09 07:30:45
阅读次数:
155
题意:
Given a binary tree, return the inorder traversal of its nodes' values.
For example:
Given binary tree {1,#,2,3},
1
2
/
3
return [1,3,2].
Note: Recursive solution is trivial, could you do it iteratively?...
分类:
其他好文 时间:
2014-11-08 19:43:46
阅读次数:
188