方勤 分享的题:
- Implement pop_heap http://en.cppreference.com/w/cpp/algorithm/pop_heap
- Zero one Knapsack https://github.com/soulmachine/acm-cheat-sheet/tree/master/C%2B%2B 的 10.5.1
贺峰 分享的题:
- FlatIterator iterator的iterator
- bool hasNext()
- T next();
- T remove();
cydu 分享的题:
- power sequence
- http://www.careercup.com/question?id=8591375
//Provide an implementation of the following interface:
public interface Powers extends Iterator<Long>
{
/* Returns the next integer a in the arithmetic sequence of integers where
* * a = m^n, m > 1 n > 1, and m and n are both integers
* * Thus, the first few outputs will be 4, 8, 9, 16, 25, 27, 32, 36, etc.
* */
public Long next();
/* Resets the sequence to the beginning, such that the next call to next()
* * will return 4.
* */
public void reset();
}
/*
A string is called sstring if it consists of lowercase english letters and no two of its consecutive characters are the same.
You are given string s of length n. Calculate the number of sstrings of length that are not lexicographically greater than s.
Input format
The only line of input contains the string s. It's length is not greater than 100.
All characters of input are lowercase english letters.
Output format:
Print the answer of test modulo 1009 to the only line of output.
Sample input:
bcd
Sample output:
653
Answer to "ccc" is 291
Answer to "ddd" is 941
Answer to "abbc" is 25
*/