This time you are asked to tell the difference between the lowest grade of all the male students and the highest grade of all the female students.
Input Specification:
Each input file contains one t...
分类:
其他好文 时间:
2015-04-29 17:12:41
阅读次数:
131
Lowest BitTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 9273 Accepted Submission(s): 6824Problem Description
Given an positive integer A...
分类:
其他好文 时间:
2015-04-23 23:32:14
阅读次数:
185
Given a string ‘str’ of digits and an integer ‘n’, build the lowest possible number by removing ‘n’ digits from the string and not changing the order ...
分类:
其他好文 时间:
2015-04-16 11:49:38
阅读次数:
179
mplement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers.
If such arrangement is not possible, it must rearrange it as the lowest possible or...
分类:
其他好文 时间:
2015-04-13 12:54:13
阅读次数:
122
Lowest Common Multiple Plus
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 39183 Accepted Submission(s): 16144
Problem Description
...
分类:
其他好文 时间:
2015-04-09 23:49:44
阅读次数:
285
root指向一棵二叉树的头结点,p和q分别指向该二叉树中任意两个结点的指针,编写算法,找到p和q的最近公共祖先结点r。
为了不失一般性,设p在q的左边。同时,为了编写方便,将以p和q所指结点的值代替p和q本身。根据【后续遍历最后访问根节点,在递归算法中,根是压在栈底的】,很容易想到,采用后序遍历非递归算法:栈中存放二叉树结点的指针。当访问到某结点时,栈中所有的元素都是该结点的祖先。设一个辅助栈,当没...
分类:
其他好文 时间:
2015-04-04 21:18:20
阅读次数:
150
Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers.
If such arrangement is not possible, it must rearrange it as the lowest possible...
分类:
其他好文 时间:
2015-04-02 16:32:47
阅读次数:
116
RMQ问题,全名(Range Minimum/Maximum Query),是求给定区间中的最值问题。
主要方法及复杂度如下:
1、朴素(即搜索),O(n)-O(qn) online。
2、线段树,O(n)-O(qlogn) online。
3、Sparse_Table(实质是动态规划),O(nlogn)-O(1) online。
4、RMQ标准算法:先规约成LCA(Lowest C...
分类:
编程语言 时间:
2015-04-01 17:43:37
阅读次数:
174
Lowest Bit
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 9052 Accepted Submission(s): 6656
Problem Description
Given an positive i...
分类:
其他好文 时间:
2015-03-30 09:23:04
阅读次数:
125
Given the root and two nodes in a Binary Tree. Find the lowest common ancestor(LCA) of the two nodes.The lowest common ancestor is the node with large...
分类:
其他好文 时间:
2015-03-12 06:25:09
阅读次数:
117