- 博客(35)
- 资源 (69)
- 问答 (17)
- 收藏
- 关注
原创 [LeetCode]*105.Construct Binary Tree from Preorder and Inorder Traversal
Given preorder and inorder traversal of a tree, construct the binary tree.Note: You may assume that duplicates do not exist in the tree.
2015-04-28 21:58:20 1866
[LeetCode]*105.Construct Binary Tree from Preorder and Inorder Traversal
题目Given preorder and inorder traversal of a tree, construct the binary tree.Note: You may assume that duplicates do not exist in the tree.思路主要是根据前序遍历和中序遍历的特点解决这个题目。1、确定树的根节点。树根是当前树中所有元素在前序...
2015-04-28 21:58:00 201
原创 [经典面试题]位运算操作
[LeetCode]136.Single Numbe[LeetCode]201.Bitwise AND of Numbers Range[剑指Offer]40.数组中只出现一次的数字一道位运算的算法题
2015-04-26 19:42:36 2283
[经典面试题]位运算操作
[LeetCode]136.Single Numbe[LeetCode]201.Bitwise AND of Numbers Range[剑指Offer]40.数组中只出现一次的数字一道位运算的算法题 <script type="text/javascript"> $(function () { ...
2015-04-26 19:42:00 181
原创 [剑指Offer]40.数组中只出现一次的数字
一个整型数组里除了两个数字之外,其他的数字都出现了两次。请写程序找出这两个只出现一次的数字。思路我们直到异或的性质:任何一个数字异或他自己都等于0.所以说我们如果从头到尾依次异或每一个数字,那么最终的结果刚好只出现一次的数字,因为成对出现的两次的数字全部在异或中抵消了。这道题中有两个数字只出现一次。这样的话我们得到的结果就是这两个数字的异或结果。因此我们想办法把原数组分成两个子数组,使得每个子
2015-04-26 19:34:17 2151
[剑指Offer]40.数组中只出现一次的数字
题目一个整型数组里除了两个数字之外,其他的数字都出现了两次。请写程序找出这两个只出现一次的数字。思路我们直到异或的性质:任何一个数字异或他自己都等于0.所以说我们如果从头到尾依次异或每一个数字,那么最终的结果刚好只出现一次的数字,因为成对出现的两次的数字全部在异或中抵消了。这道题中有两个数字只出现一次。这样的话我们得到的结果就是这两个数字的异或结果。因此我们想办法把原数...
2015-04-26 19:34:00 199
原创 [LeetCode]201.Bitwise AND of Numbers Range
Given a range [m, n] where 0 <= m <= n <= 2147483647, return the bitwise AND of all numbers in this range, inclusive.For example, given the range [5, 7], you should return 4.
2015-04-26 15:34:55 2011
[LeetCode]201.Bitwise AND of Numbers Range
题目Given a range [m, n] where 0 <= m <= n <= 2147483647, return the bitwise AND of all numbers in this range, inclusive.For example, given the range [5, 7], you should return 4.思路[5, ...
2015-04-26 15:34:00 133
原创 [LeetCode]32.Longest Valid Parentheses
题目Given a string containing just the characters ‘(’ and ‘)’, find the length of the longest valid (well-formed) parentheses substring.For “(()”, the longest valid parentheses substring is “()”, which h
2015-04-23 20:18:45 1779
[LeetCode]32.Longest Valid Parentheses
题目Given a string containing just the characters ‘(’ and ‘)’, find the length of the longest valid (well-formed) parentheses substring.For “(()”, the longest valid parentheses substring is “()”, w...
2015-04-23 20:18:00 132
转载 [算法系列之三十]Dijkstra单源最短路径算法
单源最短路径问题给定一个带权有向图 G=(V,E) ,其中每条边的权是一个非负实数。另外,还给定 V 中的一个顶点,称为源。现在我们要计算从源到所有其他各顶点的最短路径长度。这里的长度是指路上各边权之和。这个问题通常称为单源最短路径问题。前面Bellman-Ford最短路径算法讲了单源最短路径的Bellman-Ford算法(动态规划算法)。这里介绍另外一个更常见的算法Dijkstra算法。Dijks
2015-04-23 17:30:47 2999
[算法系列之三十]Dijkstra单源最短路径算法
单源最短路径问题给定一个带权有向图 G=(V,E) ,其中每条边的权是一个非负实数。另外,还给定 V 中的一个顶点,称为源。现在我们要计算从源到所有其他各顶点的最短路径长度。这里的长度是指路上各边权之和。这个问题通常称为单源最短路径问题。前面Bellman-Ford最短路径算法讲了单源最短路径的Bellman-Ford算法(动态规划算法)。这里介绍另外一个更常见的算法Dijkstra算法...
2015-04-23 17:30:00 522
转载 [算法系列之二十九]Bellman-Ford最短路径算法
单源最短路径给定一个图,和一个源顶点src,找到从src到其它所有所有顶点的最短路径,图中可能含有负权值的边。Dijksra的算法是一个贪婪算法,时间复杂度是O(VLogV)(使用最小堆)。但是迪杰斯特拉算法在有负权值边的图中不适用,Bellman-Ford适合这样的图。在网络路由中,该算法会被用作距离向量路由算法。Bellman-Ford也比迪杰斯特拉算法更简单和同时也适用于分布式系统。但Bell
2015-04-23 15:15:27 6843
[算法系列之二十九]Bellman-Ford最短路径算法
单源最短路径给定一个图,和一个源顶点src,找到从src到其它所有所有顶点的最短路径,图中可能含有负权值的边。Dijksra的算法是一个贪婪算法,时间复杂度是O(VLogV)(使用最小堆)。但是迪杰斯特拉算法在有负权值边的图中不适用,Bellman-Ford适合这样的图。在网络路由中,该算法会被用作距离向量路由算法。Bellman-Ford也比迪杰斯特拉算法更简单和同时也适用于分布式...
2015-04-23 15:15:00 1248 1
原创 [LeetCode]202.Happy Number
Write an algorithm to determine if a number is “happy”.A happy number is a number defined by the following process: Starting with any positive integer, replace the number by the sum of the squares of
2015-04-22 21:26:55 2535
[LeetCode]202.Happy Number
题目Write an algorithm to determine if a number is “happy”.A happy number is a number defined by the following process: Starting with any positive integer, replace the number by the sum of the squa...
2015-04-22 21:26:00 202
原创 [LeetCode]57.Insert Interval
Given a set of non-overlapping intervals, insert a new interval into the intervals (merge if necessary).You may assume that the intervals were initially sorted according to their start times.Example
2015-04-22 15:20:42 1559
[LeetCode]57.Insert Interval
题目Given a set of non-overlapping intervals, insert a new interval into the intervals (merge if necessary).You may assume that the intervals were initially sorted according to their start times....
2015-04-22 15:20:00 121
原创 [LeetCode]191.Number of 1 Bits
题目Write a function that takes an unsigned integer and returns the number of ’1’ bits it has (also known as the Hamming weight).For example, the 32-bit integer ’11’ has binary representation 00000000000
2015-04-12 19:55:50 1463
[LeetCode]191.Number of 1 Bits
题目Write a function that takes an unsigned integer and returns the number of ’1’ bits it has (also known as the Hamming weight).For example, the 32-bit integer ’11’ has binary representation 00000...
2015-04-12 19:55:00 171
原创 [经典面试题][去哪网]合并日期
声明一个大小为1001的数组array[1001],全部初始化为0 然后从前向后遍历数组,先处理[0,100,300]再处理[40,50,350]。后面的价格覆盖前面的价格。
2015-04-12 19:44:29 1700
[经典面试题][去哪网]合并日期
题目 思路 声明一个大小为1001的数组array[1001],全部初始化为0 然后从前向后遍历数组,先处理[0,100,300]再处理[40,50,350]。后面的价格覆盖前面的价格。代码 /*------------------------------------- * 日期:2015-04-10 * 作者:SJF0115 * 题...
2015-04-12 19:44:00 177
原创 [LeetCode]200.Number of Islands
题目Given a 2d grid map of ‘1’s (land) and ‘0’s (water), count the number of islands. An island is surrounded by water and is formed by connecting adjacent lands horizontally or vertically. You may assum
2015-04-10 21:27:46 2170
[LeetCode]200.Number of Islands
题目Given a 2d grid map of ‘1’s (land) and ‘0’s (water), count the number of islands. An island is surrounded by water and is formed by connecting adjacent lands horizontally or vertically. You may a...
2015-04-10 21:27:00 169
原创 [LeetCode]198.House Robber
题目You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is that adjacent hous
2015-04-08 12:16:51 2289 1
[LeetCode]198.House Robber
题目You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is that adjacent ...
2015-04-08 12:16:00 203
转载 [面试经]字节对齐
一、快速理解什么是字节对齐? 在C语言中,结构是一种复合数据类型,其构成元素既可以是基本数据类型(如int、long、float等)的变量,也可以是一些复合数据类型(如数组、结构、联合等)的数据单元。在结构中,编译器为结构的每个成员按其自然边界(alignment)分配空间。各个成员按照它们被声明的顺序在内存中顺序存储,第一个成员的地址和整个结构的地址相同。 为了使CPU能够对变量进行快速的访
2015-04-06 17:04:39 1401
[面试经]字节对齐
一、快速理解什么是字节对齐? 在C语言中,结构是一种复合数据类型,其构成元素既可以是基本数据类型(如int、long、float等)的变量,也可以是一些复合数据类型(如数组、结构、联合等)的数据单元。在结构中,编译器为结构的每个成员按其自然边界(alignment)分配空间。各个成员按照它们被声明的顺序在内存中顺序存储,第一个成员的地址和整个结构的地址相同。 为了使CPU能够对变量进行...
2015-04-06 17:04:00 214
原创 [LeetCode]199.Binary Tree Right Side View
题目Given a binary tree, imagine yourself standing on the right side of it, return the values of the nodes you can see ordered from top to bottom.For example: Given the following binary tree, 1
2015-04-05 21:00:34 2488
[LeetCode]199.Binary Tree Right Side View
题目Given a binary tree, imagine yourself standing on the right side of it, return the values of the nodes you can see ordered from top to bottom.For example: Given the following binary tree, ...
2015-04-05 21:00:00 155
原创 [程序员面试题精选100题]58.八皇后问题
题目在8×8的国际象棋上摆放八个皇后,使其不能相互攻击,即任意两个皇后不得处在同一行、同一列或者同一对角斜线上。下图中的每个黑色格子表示一个皇后,这就是一种符合条件的摆放方法。请求出总共有多少种摆法。思路这就是有名的八皇后问题。解决这个问题通常需要用递归,而递归对编程能力的要求比较高。因此有不少面试官青睐这个题目,用来考察应聘者的分析复杂问题的能力以及编程的能力。由于八个皇后的任意两个不能处在同一行
2015-04-04 22:14:54 1774
[程序员面试题精选100题]58.八皇后问题
题目在8×8的国际象棋上摆放八个皇后,使其不能相互攻击,即任意两个皇后不得处在同一行、同一列或者同一对角斜线上。下图中的每个黑色格子表示一个皇后,这就是一种符合条件的摆放方法。请求出总共有多少种摆法。思路这就是有名的八皇后问题。解决这个问题通常需要用递归,而递归对编程能力的要求比较高。因此有不少面试官青睐这个题目,用来考察应聘者的分析复杂问题的能力以及编程的能力。由于八个皇后...
2015-04-04 22:14:00 229
原创 [LeetCode]4.Median of Two Sorted Arrays
Median of Two Sorted Arrays Total Accepted: 4990 Total Submissions: 30805My Submissions There are two sorted arrays A and B of size m and n respectively. Find the median of the two sorted arrays. Th
2015-04-03 11:20:27 1525
[LeetCode]4.Median of Two Sorted Arrays
题目Median of Two Sorted Arrays Total Accepted: 4990 Total Submissions: 30805My Submissions There are two sorted arrays A and B of size m and n respectively. Find the median of the two sorted arrays...
2015-04-03 11:20:00 82
[LeetCode]4.Median of Two Sorted Arrays
题目Median of Two Sorted Arrays Total Accepted: 4990 Total Submissions: 30805My Submissions There are two sorted arrays A and B of size m and n respectively. Find the median of the two sorted arrays...
2015-04-03 11:20:00 73
大型网站技术核心原理与案例分析
2015-12-25
Android应用开发揭秘
2015-12-17
Android开发秘籍
2015-12-17
Android开发精要
2015-12-17
Android技术内幕.系统卷
2015-12-17
Android高级编程
2015-12-17
JavaEE企业应用实战-Struts2+Spring3+Hibernate整合开发
2015-12-17
Mahout算法解析与案例实战
2015-12-16
LINUX内核设计与实现
2015-12-14
重构-改善即有代码的设计
2015-12-14
算法艺术和信息学竞赛
2015-12-14
apache-mahout-distribution-0.11.1-src
2015-11-30
Better bitmap performance with Roaring bitmaps
2023-03-06
美团外卖离线数仓建设实践
2023-02-19
Redis 入门指南
2017-06-02
Apache Sqoop Cookbook
2016-11-14
Apache Spark源码剖析
2016-11-12
Elasticsearch.The.Definitive.Guide
2016-10-21
Shell脚本学习指南
2016-05-28
精通Spring
2016-02-07
Java Persistence with MyBatis 3
2016-02-06
Spring-Jar-4.2.4
2016-01-28
log4j所需jar包
2016-01-20
Hadoop实战中文版
2015-12-25
大规模分布式系统架构与设计实战
2015-12-25
Hive Range Between 结果错误问题
2023-02-28
Storm Trident 抛异常不重发
2018-11-23
hive SERDEPROPERTIES 实现正则过滤
2018-06-05
Flink 关于窗口Window的问题
2018-01-17
Hive 运行SQL 重定向文件 输出WARN日志
2017-06-13
Hadoop Distcp报错 队列问题
2017-01-17
Hive Join 失败
2016-11-28
Hive 查询问题
2016-09-07
Hive LOAD DATA 错误
2016-07-23
[ElasticSearch] 中文字符串精确搜索 term 搜不到结果
2016-07-05
mysql group by 统计问题
2016-06-17
大型分布式网站架构的演进
2016-05-16
ubuntu IntelliJ Idea设置快捷方式问题
2016-03-08
罗技键盘 k380 连接上 没有任何的反应?
2016-03-06
Maven archetype:generate报错
2016-01-25
Log4j问题
2016-01-16
Java Stringbuilder调用append()方法报错
2015-12-20
nosql开放性问题
2015-12-18
TA创建的收藏夹 TA关注的收藏夹
TA关注的人