An array of integers p1,p2,…,pnp1,p2,…,pn is called a permutation if it contains each number from 11 to nn exactly once. For example, the following arrays are p...
Say you have an array for which the ith element is the price of a given stock on day i.