Counting number of enabled bits in uint32_t.. Here is a O(lg32) solution. Very smart, like bottom-up parallel tree post-order traversal.Solution from ...
分类:
其他好文 时间:
2015-03-12 06:22:18
阅读次数:
118
定义 Activity A,Activity B。Activity.overridePendingTransition 是在 A 启动 B 时定义这个过程中用什么动画的。常见三种动画形式: 1) A slide up B still, 2) A disapper B slide up, 3) A a...
分类:
其他好文 时间:
2015-03-12 06:17:11
阅读次数:
209
Linked List Cycle ii Given a linked list, return the node where the cycle begins. If there is no cycle, return null. Follow up: Can you solve it ...
分类:
其他好文 时间:
2015-03-12 00:39:43
阅读次数:
157
Linked List CycleGiven a linked list, determine if it has a cycle in it. Follow up:Can you solve it without using extra space?SOLUTION 1: 依次将链表节点添加入已....
分类:
其他好文 时间:
2015-03-11 23:04:31
阅读次数:
223
编辑git安装目录下的etc目录中的profile文件。例如: E:\Git\etc\profile 找到如下行:
# Set up USER's home directory
if [ -z "$HOME" -o ! -d "$HOME" ]; then
HOME="$HOMEDRIVE$HOMEPATH"
if [ -z "$HOME" -o ! -d "$HOME" ]; th...
分类:
其他好文 时间:
2015-03-11 17:26:28
阅读次数:
181
不得不承认智商真的被压制了。。
其实开始的时候试过用二项式定理避开组合数的计算,不过没想到单位矩阵这个神奇的东西233。
设有矩阵A,B,E
E为单位矩阵。
设新得到的矩阵为C,那么矩阵C的第一行第一列即为答案。
#include
#include
#include
#include
#include
#include
#include
#include
#inc...
分类:
其他好文 时间:
2015-03-11 17:24:03
阅读次数:
105
Follow up for N-Queens problem.
Now, instead outputting board configurations, return the total number of distinct solutions.
题意:还是n皇后问题。
思路:时间复杂度要求高了,还是每行每行的放,再开一个三维的标记数组,y-x代表了主对角线,y+x代表了负对角...
分类:
其他好文 时间:
2015-03-11 12:55:52
阅读次数:
119
Given amxnmatrix, if an element is 0, set its entire row and column to 0. Do it in place.click to show follow up.Follow up:Did you use extra space?A s...
分类:
其他好文 时间:
2015-03-11 12:25:49
阅读次数:
134
Follow up for "Remove Duplicates":What if duplicates are allowed at mosttwice?For example,Given sorted array A =[1,1,1,2,2,3],Your function should ret...
分类:
编程语言 时间:
2015-03-11 12:21:34
阅读次数:
193
Path Sum问题:Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the g...
分类:
其他好文 时间:
2015-03-11 09:17:40
阅读次数:
123