You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single ...
分类:
其他好文 时间:
2014-06-28 14:31:12
阅读次数:
201
题目描述Given a non-negative integer sequence A with length N, you can exchange two adjacent numbers each time. After K exchanging operations, what’s the ...
分类:
其他好文 时间:
2014-06-22 23:36:42
阅读次数:
232
Next Permutation:Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers.If such arrangeme...
分类:
其他好文 时间:
2014-06-22 23:35:19
阅读次数:
262
Minimum Path Sum:Given amxngrid filled with non-negative numbers, find a path from top left to bottom right whichminimizesthe sum of all numbers along...
分类:
其他好文 时间:
2014-06-22 23:06:39
阅读次数:
290
Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list.
For example,
Given 1->2->3->3->4->4->5, return 1->2->5.
Given 1->1-...
分类:
其他好文 时间:
2014-06-22 22:57:49
阅读次数:
347
Given a sorted array of integers, find the starting and ending position of a given target value.
Your algorithm's runtime complexity must be in the order of O(log n).
If the target is not found ...
分类:
其他好文 时间:
2014-06-22 21:47:15
阅读次数:
269
使用线段树预处理,可以使得查询RMQ时间效率在O(lgn)。
线段树是记录某范围内的最小值。
标准的线段树应用。
Geeks上只有两道线段树的题目了,而且没有讲到pushUp和pushDown操作,只是线段树的入门了。
参考:http://www.geeksforgeeks.org/segment-tree-set-1-range-minimum-query/
我修改了一下他的程序,使用...
分类:
其他好文 时间:
2014-06-22 18:08:05
阅读次数:
217
Given a triangle, find the minimum path sum from top to bottom. Each step you may
move to adjacent numbers on the row below.
For example, given the following triangle
[
[2],...
分类:
其他好文 时间:
2014-06-22 17:07:52
阅读次数:
166
题目大意:
T组测试数据,求(A1B1+A2B2+ ... +AHBH)mod M.
解题思路:
对于普通暴力算法一定是
A1*A1*A1.....*A1 乘以 B1次,
A2*A2...........*A2 乘以 B2次,
......................................
然后全部相加起来,这样效率很低,肯定是超时了
那么有什么办法解决这一问题,可以用快速幂,
如果 A1^2有了,那么 A1^4就可以得到,A1^8也可以得到,...... ,立刻由n降到了lgn
可以...
分类:
其他好文 时间:
2014-06-22 16:17:10
阅读次数:
178
(image from Anatomy of an open source cloud) A cloud data center consists of large numbers of physical servers, each running a hypervisor with one or ...
分类:
其他好文 时间:
2014-06-21 14:48:04
阅读次数:
225