Well, first you have to boil the algorithm down and eliminate all but a few of those conditional statements (if-else). You cannot extend or contract this program every time your input changes. You have to generalize the idea so that your program works for all sizes of lists, whether it has 0 or 500 numbers in it.

Look for

patterns in the code, like consistent changes from one part to the next. Then look for the most basic case. The basic case can usually be identified by a literal value instead of a relative value. A literal value is something like

`5` -- that's the actual number 5. A relative value would be where

`N` represents the value of

`4`, then the relative value of

`5` is represented by the expression

`N + 1`. That is, speaking relatively, the value 5 is one more than the value of 4. In recursion, a case that where you can specify a literal value is usually the

*base* or

*degenerate* case where you can end recursion. The relative cases are where you use relative values, in which case you need to continue the recursion and reduce the problem so that the next problem is closer to the base/degenerate case relative to the current case.