Given an array A of numbers, find a pair of numbers A[i] and A[j], such that A[i] < A[j] and j-i is maximized.
solution: There is a trivial O(N^2) solution and a tricky O(N) based on a very simple intuition, where is the minimum?
Random commentary about C++, STL, Boost, Perl, Python, Algorithms, Problem Solving and Web Search
0 commenti:
Post a Comment