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 10:45:34
阅读次数:
225
题目描述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
Description
The cows, as you know, have no fingers or thumbs and thus are unable to play Scissors, Paper, Stone' (also known as 'Rock, Paper, Scissors', 'Ro, Sham, Bo', and a host of other names) i...
分类:
其他好文 时间:
2014-06-22 17:15:11
阅读次数:
275
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
题目:
Given a binary tree containing digits from 0-9 only, each root-to-leaf
path could represent a number.
An example is the root-to-leaf path 1->2->3 which represents the number 123.
Find...
分类:
其他好文 时间:
2014-06-22 08:30:24
阅读次数:
236
(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