the problem is to find the minimum numbers to be popped from an array to make it sorted.

so for example 12534756, you can pop all but one, but it's best to pop 5 and 7 cause it's the least needed to make it sorted.

I'm having difficulties finding a good algorithm that doesn't try every possible way...

i tried splitting the array into sub-arrays, and putting them into a table indexed by the first and last indexes of the sub-array. so i'd give 0 to all sub-arrays of length 1 and 1 to those of length 2 where the first element is larger than the second..

```
for( int i = 0; i < n; ++i )
for( int j = i+1; j <= n; ++j )
```

this is the idea how to go through the table but adding the values of two sub-arrays of a larger one resulted with huge numbers...

the table for the given example would look like this if i made it:

(for the first 4 numbers...i'm lazy)

[0] 0 0 1

0 [0] 0 1

0 0 [0] 1

0 0 0 [0]

the bracketed zeros are the ones with sub-array length 1..

the table actually gives the right result in this example, but for many others it's wrong

so all put in 4 words.. my algorithm skills suck! Help!! :)