这道题是一道典型的位操作Bit Manipulation的题目,我开始以为异或值最大的两个数一定包括数组的最大值,但是OJ给了另一个例子{10,23,20,18,28},这个数组的异或最大值是10和20异或,得到30。那么只能另辟蹊径,正确的做法是按位遍历,题目中给定了数字的返回不会超过231,那么 ...
分类:
其他好文 时间:
2017-07-15 23:58:08
阅读次数:
482
Building designing Time limit: 3.000 seconds An architect wants to design a very high building. The building will consist of some ?oors, and each ?oor ...
分类:
其他好文 时间:
2017-07-15 16:49:55
阅读次数:
167
转载自http://www.renfei.org/blog/bipartite-matching.html 二分图的最大匹配、完美匹配和匈牙利算法 这篇文章讲无权二分图(unweighted bipartite graph)的最大匹配(maximum matching)和完美匹配(perfect m ...
分类:
编程语言 时间:
2017-07-14 22:14:40
阅读次数:
233
方法一:Heap时间 O(NlogK) 空间 O(K) maintain a maximum heap, notice PriorityQueue.remove(object o) can remove certain object from our heap. When writting Maxi ...
安装 yum install squid -y 配置 配置文件 /etc/squid/squid.conf 1.无认证配置 cache_mem 64 MB 缓存和日志设置maximum_object_size 4 MBcache_dir ufs /var/spool/squid 100 16 256 ...
分类:
其他好文 时间:
2017-07-14 13:11:08
阅读次数:
200
前言:在介绍select组件的时候,博主之前分享过一篇JS组件系列——两种bootstrap multiselect组件大比拼,这两个组件的功能确实很强大,只可惜没有图文结合的效果(也就是将图片放入到select里面随着文字一起显示)。前两天做一个菜单图标选择的功能,就要用到这个图文选择的功能。于是 ...
分类:
Web程序 时间:
2017-07-11 21:21:35
阅读次数:
227
算法旨在用尽可能简单的思路解决这个问题。理解算法也应该是一个越看越简单的过程,当你看到算法里的一串概念,或者一大坨代码,第一感觉是复杂,此时最好还是从样例入手。通过一个简单的样例,并编程实现,这个过程事实上就能够理解清楚算法里的最重要的思想,之后扩展。对算法的引理或者更复杂的情况。对算法进行改进。最 ...
分类:
其他好文 时间:
2017-07-11 19:32:40
阅读次数:
214
P2255 [USACO14JAN]记录奥林比克Recording the M… P2255 [USACO14JAN]记录奥林比克Recording the M… P2255 [USACO14JAN]记录奥林比克Recording the M… 题目描述 Being a fan of all col ...
分类:
其他好文 时间:
2017-07-11 17:59:34
阅读次数:
259
Say you have an array for which the ith element is the price of a given stock on day i. Design an algorithm to find the maximum profit. You may comple ...
分类:
其他好文 时间:
2017-07-11 11:10:04
阅读次数:
230
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 l ...
分类:
其他好文 时间:
2017-07-11 11:08:51
阅读次数:
191