leetcode题解


[leetcode] H-Index

H-Index Given an array of citations (each citation is a non-negative integer) of a researcher, write a function to compute the researcher’s h-index. According to the definition of h-index on Wikipedia: “A scientist has index h if h of his/her N papers have at leasth citations each, and the other […]


[leetcode] Peeking Iterator

Peeking Iterator Given an Iterator class interface with methods: next() and hasNext(), design and implement a PeekingIterator that support the peek() operation — it essentially peek() at the element that will be returned by the next call to next(). Here is an example. Assume that the iterator is initialized to […]