题目链接:Add Binary
Given two binary strings, return their sum (also a binary string).
For example,
a = "11"
b = "1"
Return "100".
这道题的要求是两个二进制字符串加法运算。
简单的大数加法,只不过是二进制的。处理进位的时候,按照二进制处理即可。
时间复杂度...
分类:
其他好文 时间:
2015-03-19 21:57:35
阅读次数:
124
consistent hashing算法早在1997年就在论文Consistent hashing and random trees中被提出,目前在cache系统中应用越来越广泛;1基本场景比如你有N个cache服务器(后面简称cache),那么如何将一个对象object映射到N个cache上呢,你...
分类:
编程语言 时间:
2015-03-19 17:56:19
阅读次数:
149
https://leetcode.com/problems/sum-root-to-leaf-numbers/Given a binary tree containing digits from0-9only, each root-to-leaf path could represent a num...
分类:
其他好文 时间:
2015-03-19 17:51:26
阅读次数:
150
题目描述:Reverse bits of a given 32 bits unsigned integer.For example, given input 43261596 (represented in binary as00000010100101000001111010011100), re...
分类:
其他好文 时间:
2015-03-19 17:48:43
阅读次数:
123
MongoDB数据模型和索引学习总结
1. MongoDB数据模型:
MongoDB数据存储结构:
MongoDB针对文档(大文件采用GridFS协议)采用BSON(binary json,采用二进制编码)数据格式来存储和交换数据。Bson吸收了JSON schema-less的特点,存储结构松散,不需要像RDB(关系数据)那样事先定义数据存储的元数据结构,另外增加了多种数据类型...
分类:
数据库 时间:
2015-03-19 16:28:42
阅读次数:
382
Given a binary tree, find the maximum path sum.The path may start and end at any node in the tree.For example:Given the below binary tree, 1 ...
分类:
其他好文 时间:
2015-03-19 12:58:48
阅读次数:
116
Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.思路分析:这题比较简单,关于树的题目通常都可以用递归解决,这题也不例外,递归解法的思...
分类:
其他好文 时间:
2015-03-19 06:23:34
阅读次数:
126
Given two binary trees, write a function to check if they are equal or not.Two binary trees are considered equal if they are structurally identical and the nodes have the same value.思路分析:判断两个树是否相同,基本也...
分类:
其他好文 时间:
2015-03-19 06:23:30
阅读次数:
95
It is kind of binary search. Since this is a sorted array, we can treat it as inorder traversal. And we can define the root node for the Tree.So find ...
分类:
其他好文 时间:
2015-03-19 06:19:48
阅读次数:
105
For this problem just need to know the structure of two traversal.1. It is hard to find the root node in the inorder traversal but it is easy in posto...
分类:
其他好文 时间:
2015-03-19 06:19:44
阅读次数:
119